chore: clean up io

This commit is contained in:
2022-03-04 21:53:49 -04:00
parent c5b4b51ae0
commit f1df3d6615
3 changed files with 35 additions and 39 deletions

View File

@@ -64,6 +64,16 @@ pub const Ppu = struct {
self.palette.deinit();
}
pub fn setBgOffsets(self: *Self, comptime n: u3, word: u32) void {
self.bg[n].hofs.raw = @truncate(u16, word);
self.bg[n].vofs.raw = @truncate(u16, word >> 16);
}
pub fn setAdjCnts(self: *Self, comptime n: u3, word: u32) void {
self.bg[n].cnt.raw = @truncate(u16, word);
self.bg[n + 1].cnt.raw = @truncate(u16, word >> 16);
}
fn drawBackround(self: *Self, comptime n: u3) void {
// A Tile in a charblock is a byte, while a Screen Entry is a halfword
const charblock_len: u32 = 0x4000;