38 lines
857 B
C
38 lines
857 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "util/registers.h"
|
|
#include "util/functions.h"
|
|
|
|
int help() {
|
|
printf(
|
|
"\nA CLI-based tool to convert MIPS assembly instructions in a .asm file into hexadecimal instructions in a .hex file.\n"
|
|
"\nUsage:\n"
|
|
" mipsToHex -h\n"
|
|
" mipsToHex --help\n"
|
|
" mipsToHex [ file ]\n"
|
|
" mipsToHex --asm [ asmFile ]\n"
|
|
" mipsToHex --asm [ asmFile ] --hex [ hexFile ]\n"
|
|
);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int error() {
|
|
printf("There must be at least one argument.");
|
|
help();
|
|
return 1;
|
|
}
|
|
|
|
int main(int argc, char* args[]) {
|
|
if(argc < 2) return error();
|
|
if(strcmp(args[1], "-h") == 0 || strcmp(args[1], "--help") == 0) return help();
|
|
|
|
initFunctions();
|
|
|
|
for(int i = 0; i < 32; i++)
|
|
printf("%d: %s\n", i, REGISTER_STRING[i]);
|
|
return 0;
|
|
}
|