Fixed a bug where CMP REG, REG wouldn't get encoded and a disassembler bug related to said CMP bug.

This commit is contained in:
2022-08-29 19:29:34 +00:00
parent 5f437b6869
commit 6c7b8d5356
4 changed files with 26 additions and 16 deletions
+10 -1
View File
@@ -199,7 +199,16 @@ void HandleRegisterBasedOpcode(unsigned char instruction, unsigned char mask) {
Memory[ProgramCounter + 1] = *value & 0xFF;
AdvanceParser();
} else {
}
else if (token->token_class == Reg) {
Memory[ProgramCounter] = (PeekToken()->type - R1) & 0x07;
AdvanceParser();
ProgramCounter++;
return;
}
else {
fprintf(stderr, "[Error] Expected operand, got %s\n", token->lexeme);
exit(1);
}