chore: use zig slices for fun
This commit is contained in:
parent
fab6d4c2a2
commit
1b17b1eb0c
|
@ -73,9 +73,7 @@ pub const Ppu = struct {
|
||||||
},
|
},
|
||||||
0x3 => {
|
0x3 => {
|
||||||
const start = framebuf_pitch * @as(usize, scanline);
|
const start = framebuf_pitch * @as(usize, scanline);
|
||||||
const end = start + framebuf_pitch;
|
std.mem.copy(u8, self.framebuf[start..][0..framebuf_pitch], self.vram.buf[start..][0..framebuf_pitch]);
|
||||||
|
|
||||||
std.mem.copy(u8, self.framebuf[start..end], self.vram.buf[start..end]);
|
|
||||||
},
|
},
|
||||||
0x4 => {
|
0x4 => {
|
||||||
const select = self.dispcnt.frame_select.read();
|
const select = self.dispcnt.frame_select.read();
|
||||||
|
@ -90,8 +88,7 @@ pub const Ppu = struct {
|
||||||
const id = byte * 2;
|
const id = byte * 2;
|
||||||
const j = i * @sizeOf(u16);
|
const j = i * @sizeOf(u16);
|
||||||
|
|
||||||
self.framebuf[buf_start + j + 1] = self.palette.buf[id + 1];
|
std.mem.copy(u8, self.framebuf[(buf_start + j)..][0..2], self.palette.buf[id..][0..2]);
|
||||||
self.framebuf[buf_start + j] = self.palette.buf[id];
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
else => std.debug.panic("[PPU] TODO: Implement BG Mode {}", .{bg_mode}),
|
else => std.debug.panic("[PPU] TODO: Implement BG Mode {}", .{bg_mode}),
|
||||||
|
|
Loading…
Reference in New Issue