feat(dma): implement all dma i/o reads

This commit is contained in:
2022-10-29 01:30:12 -03:00
parent 3e62feacba
commit 268961262d
3 changed files with 34 additions and 14 deletions

View File

@@ -13,6 +13,7 @@ const log = std.log.scoped(.PPU);
const setHi = util.setHi;
const setLo = util.setLo;
const shift = util.shift;
const pollDmaOnBlank = @import("bus/dma.zig").pollDmaOnBlank;
pub const width = 240;
@@ -81,13 +82,6 @@ pub fn read(comptime T: type, ppu: *const Ppu, addr: u32) ?T {
};
}
/// Calculates the correct shift offset for an aligned/unaligned u8 read
///
/// TODO: Rename this
inline fn shift(byte: u8) u4 {
return @truncate(u4, byte & 1) << 3;
}
pub fn write(comptime T: type, ppu: *Ppu, addr: u32, value: T) void {
const byte = @truncate(u8, addr); // prefixed with 0x0400_00