From 5df023fb4159f60fd6ccc58b09a9c1aa70313fcb Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Tue, 3 May 2022 22:41:05 -0300 Subject: [PATCH] chore: stub a few I/O registers --- src/bus/io.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bus/io.zig b/src/bus/io.zig index 1c5e99f..0880613 100644 --- a/src/bus/io.zig +++ b/src/bus/io.zig @@ -63,6 +63,9 @@ pub fn read(bus: *const Bus, comptime T: type, address: u32) T { // Keypad Input 0x0400_0130 => unimplementedRead("Read {} from KEYINPUT", .{T}), + // Serial Communication 2 + 0x0400_0150 => unimplementedRead("Read {} from JOY_RECV", .{T}), + // Interrupts 0x0400_0200 => @as(T, bus.io.irq.raw) << 16 | bus.io.ie.raw, 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 0x0400_0128 => unimplementedRead("Read {} from SIOCNT_L", .{T}), + // Keypad Input + 0x0400_0130 => unimplementedRead("read {} from KEYINPUT_L", .{T}), + // Serial Communication 2 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}), // Interrupts + 0x0400_0202 => bus.io.irq.raw &= ~@as(u16, value), 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_0410 => log.debug("Wrote 0x{X:0>2} to the common yet undocumented 0x{X:0>8}", .{ value, address }),