From 89a1f9188f7020271df89656a2d4e80084a9378f Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Tue, 1 Mar 2022 21:47:14 -0400 Subject: [PATCH] feat: pretend unhandled I/O reads/writes never happened Doom is now playable but I think it dereferences a null pointer every once and a while (completely my fault) --- src/bus/io.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bus/io.zig b/src/bus/io.zig index ef1a3e3..f8da076 100644 --- a/src/bus/io.zig +++ b/src/bus/io.zig @@ -110,7 +110,7 @@ pub fn write32(bus: *Bus, addr: u32, word: u32) void { }, 0x0400_0204 => log.warn("Wrote 0x{X:0>8} to WAITCNT", .{word}), 0x0400_0208 => bus.io.ime = word & 1 == 1, - else => std.debug.panic("Tried to write 0x{X:0>8} to 0x{X:0>8}", .{ word, addr }), + else => log.warn("Tried to write 0x{X:0>8} to 0x{X:0>8}", .{ word, addr }), } } @@ -128,7 +128,7 @@ pub fn read16(bus: *const Bus, addr: u32) u16 { 0x0400_010A => failed_read("Tried to read halfword from TM2CNT_H", .{}), 0x0400_010E => failed_read("Tried to read halfword from TM3CNT_H", .{}), 0x0400_0204 => failed_read("Tried to read halfword from WAITCNT", .{}), - else => std.debug.panic("Tried to read halfword from 0x{X:0>8}", .{addr}), + else => failed_read("Tried to read halfword from 0x{X:0>8}", .{addr}), }; } @@ -190,7 +190,7 @@ pub fn write16(bus: *Bus, addr: u32, halfword: u16) void { 0x0400_0202 => bus.io.irq.raw &= ~halfword, 0x0400_0204 => log.warn("Wrote 0x{X:0>4} to WAITCNT", .{halfword}), 0x0400_0208 => bus.io.ime = halfword & 1 == 1, - else => std.debug.panic("Tried to write 0x{X:0>4} to 0x{X:0>8}", .{ halfword, addr }), + else => log.warn("Tried to write 0x{X:0>4} to 0x{X:0>8}", .{ halfword, addr }), } }