fix: incorrect order-of-operations in ARM BL impl

This commit is contained in:
2022-10-21 05:12:39 -03:00
parent 36f3b0d381
commit 1a23073424
2 changed files with 5 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ pub fn branch(comptime L: bool) InstrFn {
return struct {
fn inner(cpu: *Arm7tdmi, _: *Bus, opcode: u32) void {
if (L) cpu.r[14] = cpu.r[15];
cpu.r[15] = cpu.fakePC() +% sext(24, opcode << 2);
cpu.r[15] = cpu.fakePC() +% (sext(24, opcode) << 2);
}
}.inner;
}