From 36687c5c678dc9877f0438d1bf8ff2c2f527edcb Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:12:14 -0300 Subject: [PATCH] chore: add more debug information to CPU panic method --- src/cpu.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cpu.zig b/src/cpu.zig index b51591f..eca8323 100644 --- a/src/cpu.zig +++ b/src/cpu.zig @@ -303,6 +303,16 @@ pub const Arm7tdmi = struct { std.debug.print("spsr: 0x{X:0>8} ", .{self.spsr.raw}); prettyPrintPsr(&self.spsr); + if (self.cpsr.t.read()) { + const opcode = self.bus.read16(self.r[15] - 4); + const id = thumbIdx(opcode); + std.debug.print("opcode: ID: 0x{b:0>10} 0x{X:0>4}\n", .{ id, opcode }); + } else { + const opcode = self.bus.read32(self.r[15] - 4); + const id = armIdx(opcode); + std.debug.print("opcode: ID: 0x{X:0>3} 0x{X:0>8}\n", .{ id, opcode }); + } + std.debug.print("tick: {}\n\n", .{self.sched.tick}); std.debug.panic(format, args);