fix(barrel_shifter): fix PC being 1 word ahead in barrel shifter

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:12:00 -03:00
parent f79e7126ee
commit 7c20e5fdb5
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@ fn immShift(comptime S: bool, cpu: *Arm7tdmi, opcode: u32) u32 {
const amount = @truncate(u8, opcode >> 7 & 0x1F); const amount = @truncate(u8, opcode >> 7 & 0x1F);
const rm_idx = opcode & 0xF; 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; var result: u32 = undefined;
if (amount == 0) { if (amount == 0) {