From 746158043d90aaacf516884edf7b014a9086481b Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Sat, 5 Feb 2022 13:46:24 -0400 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);