chore: clean up io

This commit is contained in:
2022-10-21 05:12:25 -03:00
parent c6a544a824
commit d54e593276
3 changed files with 35 additions and 39 deletions

View File

@@ -57,10 +57,7 @@ pub fn read32(self: *const Self, addr: u32) u32 {
0x0A00_0000...0x0BFF_FFFF => self.pak.get32(addr - 0x0A00_0000),
0x0C00_0000...0x0DFF_FFFF => self.pak.get32(addr - 0x0C00_0000),
else => blk: {
log.warn("Tried to read from 0x{X:0>8}", .{addr});
break :blk 0x0000_0000;
},
else => failedRead("Tried to read from 0x{X:0>8}", .{addr}),
};
}
@@ -157,3 +154,8 @@ pub fn write8(self: *Self, addr: u32, byte: u8) void {
else => std.debug.panic("Tried to write 0x{X:0>2} to 0x{X:0>8}", .{ byte, addr }),
}
}
fn failedRead(comptime format: []const u8, args: anytype) u8 {
log.warn(format, args);
return 0;
}