Fixed a bug in the parser where the size of the binary was too big.
This commit is contained in:
+4
-8
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user