Fix emulate so not increment PC if branch inst, w/ T

This commit is contained in:
sBubshait 2024-06-03 20:34:14 +01:00
parent 851a54a51e
commit 20557a14eb

View File

@ -1,5 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "a64instruction.h"
#include "emulator.h" #include "emulator.h"
#include "fileio.h" #include "fileio.h"
#include "global.h" #include "global.h"
@ -47,7 +48,8 @@ int main(int argc, char **argv) {
// Step 3: Update processor state to reflect executing the instruction, and increment PC // Step 3: Update processor state to reflect executing the instruction, and increment PC
execute(&state, inst); execute(&state, inst);
state.pc += sizeof(word); if (inst->type != a64inst_BRANCH)
state.pc += sizeof(word);
} while (inst->type != a64inst_HALT); } while (inst->type != a64inst_HALT);
state.pc -= sizeof(word); state.pc -= sizeof(word);