From 20557a14eb24ca5e884de210720c6a235af4bb21 Mon Sep 17 00:00:00 2001 From: sBubshait Date: Mon, 3 Jun 2024 20:34:14 +0100 Subject: [PATCH] Fix emulate so not increment PC if branch inst, w/ T --- src/emulate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/emulate.c b/src/emulate.c index df2f471..82245e9 100755 --- a/src/emulate.c +++ b/src/emulate.c @@ -1,5 +1,6 @@ #include #include +#include "a64instruction.h" #include "emulator.h" #include "fileio.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 execute(&state, inst); - state.pc += sizeof(word); + if (inst->type != a64inst_BRANCH) + state.pc += sizeof(word); } while (inst->type != a64inst_HALT); state.pc -= sizeof(word);