chore: add more debug information to CPU panic method

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-02-05 13:46:24 -04:00
parent 25300c8a9f
commit 746158043d
1 changed files with 10 additions and 0 deletions

View File

@ -303,6 +303,16 @@ pub const Arm7tdmi = struct {
std.debug.print("spsr: 0x{X:0>8} ", .{self.spsr.raw}); std.debug.print("spsr: 0x{X:0>8} ", .{self.spsr.raw});
prettyPrintPsr(&self.spsr); 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.print("tick: {}\n\n", .{self.sched.tick});
std.debug.panic(format, args); std.debug.panic(format, args);