chore: stub a few I/O registers

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-05-03 22:41:05 -03:00
parent 46ac1542a6
commit 5df023fb41
1 changed files with 8 additions and 0 deletions

View File

@ -63,6 +63,9 @@ pub fn read(bus: *const Bus, comptime T: type, address: u32) T {
// Keypad Input // Keypad Input
0x0400_0130 => unimplementedRead("Read {} from KEYINPUT", .{T}), 0x0400_0130 => unimplementedRead("Read {} from KEYINPUT", .{T}),
// Serial Communication 2
0x0400_0150 => unimplementedRead("Read {} from JOY_RECV", .{T}),
// Interrupts // Interrupts
0x0400_0200 => @as(T, bus.io.irq.raw) << 16 | bus.io.ie.raw, 0x0400_0200 => @as(T, bus.io.irq.raw) << 16 | bus.io.ie.raw,
0x0400_0208 => @boolToInt(bus.io.ime), 0x0400_0208 => @boolToInt(bus.io.ime),
@ -139,6 +142,9 @@ pub fn read(bus: *const Bus, comptime T: type, address: u32) T {
// Serial Communication 1 // Serial Communication 1
0x0400_0128 => unimplementedRead("Read {} from SIOCNT_L", .{T}), 0x0400_0128 => unimplementedRead("Read {} from SIOCNT_L", .{T}),
// Keypad Input
0x0400_0130 => unimplementedRead("read {} from KEYINPUT_L", .{T}),
// Serial Communication 2 // Serial Communication 2
0x0400_0135 => unimplementedRead("Read {} from RCNT_H", .{T}), 0x0400_0135 => unimplementedRead("Read {} from RCNT_H", .{T}),
@ -418,7 +424,9 @@ pub fn write(bus: *Bus, comptime T: type, address: u32, value: T) void {
0x0400_0140 => log.debug("Wrote 0x{X:0>2} to JOYCNT_L", .{value}), 0x0400_0140 => log.debug("Wrote 0x{X:0>2} to JOYCNT_L", .{value}),
// Interrupts // Interrupts
0x0400_0202 => bus.io.irq.raw &= ~@as(u16, value),
0x0400_0208 => bus.io.ime = value & 1 == 1, 0x0400_0208 => bus.io.ime = value & 1 == 1,
0x0400_0300 => bus.io.postflg = std.meta.intToEnum(PostFlag, value & 1) catch unreachable,
0x0400_0301 => bus.io.haltcnt = if (value >> 7 & 1 == 0) .Halt else std.debug.panic("TODO: Implement STOP", .{}), 0x0400_0301 => bus.io.haltcnt = if (value >> 7 & 1 == 0) .Halt else std.debug.panic("TODO: Implement STOP", .{}),
0x0400_0410 => log.debug("Wrote 0x{X:0>2} to the common yet undocumented 0x{X:0>8}", .{ value, address }), 0x0400_0410 => log.debug("Wrote 0x{X:0>2} to the common yet undocumented 0x{X:0>8}", .{ value, address }),