Modified how registers and opcodes are represented. This commit is a bit buggy but doesn't crash and burn at least. I just wanted the new structs push out before making a bigger mess of things as I try to organize this all.

This commit is contained in:
2022-02-17 21:35:57 -06:00
parent 3d4ab57f05
commit 19021ff782
6 changed files with 106 additions and 59 deletions
+7 -7
View File
@@ -9,11 +9,11 @@ void ProcessDirective(List*);
void ProcessVariableDeclaration(List*);
void ParseTokens(List* tokens) {
for(int i = 0; i < tokens->size; i++) {
if (((Token *) tokens->content[i])->type == TK_Directive){
ProcessDirective(tokens);
}
}
// for(int i = 0; i < tokens->size; i++) {
// if (((Token *) tokens->content[i])->type == TK_Directive){
// ProcessDirective(tokens);
// }
// }
}
void ProcessDirective(List* tokens) {
@@ -26,11 +26,11 @@ void ProcessDirective(List* tokens) {
if (strcmp(".org", directive->value) == 0) {
Token* address_start = (Token*) tokens->content[1];
if (address_start->type == TK_Number) {
if (address_start->type == NUMBER) {
long address = strtol(address_start->value, NULL, 10);
printf("Address starting at '%ld'\n", address);
}
else if (address_start->type == TK_Hex) {
else if (address_start->type == HEX) {
long address = strtol(address_start->value, NULL, 16);
printf("Setting address to '%ld'\n", address);
}