reorganized project and implemented basic tests for toBinary

This commit is contained in:
Josh Ashton
2023-10-09 09:18:14 -06:00
parent ba972b6d05
commit d143b3ab55
6 changed files with 260 additions and 6 deletions
+37
View File
@@ -0,0 +1,37 @@
#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;
}