Fixed a bug in the parser where the size of the binary was too big.

This commit is contained in:
2022-08-29 18:02:11 +00:00
parent ae1e73e00f
commit e3b4293314
2 changed files with 5 additions and 12 deletions
+4 -8
View File
@@ -188,8 +188,6 @@ void HandleRegisterBasedOpcode(unsigned char instruction, unsigned char mask) {
Memory[ProgramCounter] = 2 >> symbol->address & 0xFF;
Memory[ProgramCounter + 1] = symbol->address & 0xFF;
ProgramCounter += 2;
AdvanceParser();
}
else if (token->type == NUMBER) {
@@ -200,13 +198,13 @@ void HandleRegisterBasedOpcode(unsigned char instruction, unsigned char mask) {
Memory[ProgramCounter] = 2 >> *value & 0xFF;
Memory[ProgramCounter + 1] = *value & 0xFF;
ProgramCounter += 2;
AdvanceParser();
} else {
fprintf(stderr, "[Error] Expected operand, got %s\n", token->lexeme);
exit(1);
}
ProgramCounter += 2;
}
void HandleOperation(void) {
@@ -251,8 +249,6 @@ void HandleOperation(void) {
Memory[ProgramCounter] = 2 >> *value & 0xFF;
Memory[ProgramCounter + 1] = *value & 0xFF;
ProgramCounter += 2;
}
else {
fprintf(stderr, "[Error] Line: %d: Expected address after jump if zero (JZ) instruction.\n", ((Token*) TokensList->content[CurrentToken - 1])->line);
@@ -272,14 +268,14 @@ void HandleOperation(void) {
Memory[ProgramCounter] = 2 >> *value & 0xFF;
Memory[ProgramCounter + 1] = *value & 0xFF;
ProgramCounter += 2;
}
else {
fprintf(stderr, "[Error] Line %d: Expected Interrupt vector.\n", PeekToken()->line);
exit(1);
}
ProgramCounter += 2;
return;
}