From 7c20e5fdb520ec4db2b1f2c1003d8081af10ee66 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:12:00 -0300 Subject: [PATCH] fix(barrel_shifter): fix PC being 1 word ahead in barrel shifter --- src/cpu/arm/barrel_shifter.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpu/arm/barrel_shifter.zig b/src/cpu/arm/barrel_shifter.zig index 23d36fb..b9e5e88 100644 --- a/src/cpu/arm/barrel_shifter.zig +++ b/src/cpu/arm/barrel_shifter.zig @@ -33,7 +33,7 @@ fn immShift(comptime S: bool, cpu: *Arm7tdmi, opcode: u32) u32 { const amount = @truncate(u8, opcode >> 7 & 0x1F); const rm_idx = opcode & 0xF; - const rm = if (rm_idx == 0xF) cpu.fakePC() + 4 else cpu.r[rm_idx]; + const rm = if (rm_idx == 0xF) cpu.fakePC() else cpu.r[rm_idx]; var result: u32 = undefined; if (amount == 0) {