feat(bus): add Io Struct

Also, add more information to all panic messages
This commit is contained in:
2022-10-21 05:11:46 -03:00
parent 614ac4a262
commit cbcc6282df
6 changed files with 109 additions and 50 deletions

View File

@@ -23,13 +23,13 @@ pub fn comptimeDataProcessing(comptime I: bool, comptime S: bool, comptime instr
// ADD
cpu.r[rd] = cpu.r[op1] + op2;
if (S) std.debug.panic("TODO: implement ADD condition codes", .{});
if (S) std.debug.panic("[CPU] TODO: implement ADD condition codes", .{});
},
0xD => {
// MOV
cpu.r[rd] = op2;
if (S) std.debug.panic("TODO: implement MOV condition codes", .{});
if (S) std.debug.panic("[CPU] implement MOV condition codes", .{});
},
0xA => {
// CMP
@@ -45,7 +45,7 @@ pub fn comptimeDataProcessing(comptime I: bool, comptime S: bool, comptime instr
cpu.cpsr.z.write(result == 0x00);
cpu.cpsr.n.write(result >> 31 & 0x01 == 0x01);
},
else => std.debug.panic("TODO: implement data processing type {}", .{instrKind}),
else => std.debug.panic("[CPU] TODO: implement data processing type {}", .{instrKind}),
}
}
}.dataProcessing;

View File

@@ -30,7 +30,7 @@ pub fn comptimeHalfSignedDataTransfer(comptime P: bool, comptime U: bool, compti
switch (@truncate(u2, opcode >> 5)) {
0b00 => {
// SWP
std.debug.panic("TODO: Implement SWP", .{});
std.debug.panic("[CPU] TODO: Implement SWP", .{});
},
0b01 => {
// LDRH
@@ -56,7 +56,7 @@ pub fn comptimeHalfSignedDataTransfer(comptime P: bool, comptime U: bool, compti
bus.write16(address + 2, src);
bus.write16(address, src);
} else {
std.debug.panic("TODO Figure out if this is also SWP", .{});
std.debug.panic("[CPU] TODO: Figure out if this is also SWP", .{});
}
}