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)
This commit is contained in:
Rekai Nyangadzayi Musuka 2022-03-01 21:47:14 -04:00
parent 90302d1c52
commit 89a1f9188f
1 changed files with 3 additions and 3 deletions

View File

@ -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 }),
}
}