Compare commits

..

1 Commits

Author SHA1 Message Date
Rekai Nyangadzayi Musuka 443941293c chore: don't panic on 32-bit writes 2022-02-17 11:01:36 -04:00
2 changed files with 2 additions and 5 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("32-bit read from 0x{X:0>8}", .{addr});
break :blk 0x0000_0000;
},
else => std.debug.panic("32-bit read from 0x{X:0>8}", .{addr}),
};
}

View File

@ -114,7 +114,7 @@ pub const Ppu = struct {
// and then we can index the palette
const pal_id = if (!is_8bpp) blk: {
tile = if (col & 1 == 1) tile >> 4 else tile & 0xF;
const pal_bank: u16 = @as(u8, entry.palette_bank.read()) << 4;
const pal_bank: u8 = @as(u8, entry.palette_bank.read()) << 4;
break :blk pal_bank | tile;
} else tile;