From 178fb674f5ac6ebd3b90d03265fcf6a9cc89de39 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Sat, 2 Jul 2022 04:30:58 -0300 Subject: [PATCH] fix: off-by-one error in debug logs --- src/cpu.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpu.zig b/src/cpu.zig index 09cb80b..54c9d04 100644 --- a/src/cpu.zig +++ b/src/cpu.zig @@ -463,7 +463,7 @@ pub const Arm7tdmi = struct { if (self.cpsr.t.read()) { if (opcode >> 11 == 0x1E) { // Instruction 1 of a BL Opcode, print in ARM mode - const other_half = self.bus.debugRead(u16, self.r[15]); + const other_half = self.bus.debugRead(u16, self.r[15] - 2); const bl_opcode = @as(u32, opcode) << 16 | other_half; log_str = try std.fmt.bufPrint(&buf, arm_fmt, .{ r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, c_psr, bl_opcode });