Compare commits
2 Commits
7441af9582
...
35dba63b94
Author | SHA1 | Date |
---|---|---|
Rekai Nyangadzayi Musuka | 35dba63b94 | |
Rekai Nyangadzayi Musuka | a753912cb5 |
|
@ -113,14 +113,14 @@ pub fn write(self: *Self, comptime T: type, word_count: u16, address: u32, value
|
||||||
|
|
||||||
switch (T) {
|
switch (T) {
|
||||||
u32 => switch (address) {
|
u32 => switch (address) {
|
||||||
0x0800_00C4 => log.err("Wrote {} 0x{X:} to I/O Port Data and Direction", .{ T, value }),
|
0x0800_00C4 => log.debug("Wrote {} 0x{X:} to I/O Port Data and Direction", .{ T, value }),
|
||||||
0x0800_00C6 => log.err("Wrote {} 0x{X:} to I/O Port Direction and Control", .{ T, value }),
|
0x0800_00C6 => log.debug("Wrote {} 0x{X:} to I/O Port Direction and Control", .{ T, value }),
|
||||||
else => {},
|
else => {},
|
||||||
},
|
},
|
||||||
u16 => switch (address) {
|
u16 => switch (address) {
|
||||||
0x0800_00C4 => log.err("Wrote {} 0x{X:} to I/O Port Data", .{ T, value }),
|
0x0800_00C4 => log.debug("Wrote {} 0x{X:} to I/O Port Data", .{ T, value }),
|
||||||
0x0800_00C6 => log.err("Wrote {} 0x{X:} to I/O Port Direction", .{ T, value }),
|
0x0800_00C6 => log.debug("Wrote {} 0x{X:} to I/O Port Direction", .{ T, value }),
|
||||||
0x0800_00C8 => log.err("Wrote {} 0x{X:} to I/O Port Control", .{ T, value }),
|
0x0800_00C8 => log.debug("Wrote {} 0x{X:} to I/O Port Control", .{ T, value }),
|
||||||
else => {},
|
else => {},
|
||||||
},
|
},
|
||||||
u8 => log.debug("Wrote {} 0x{X:} to 0x{X:0>8}, Ignored.", .{ T, value, address }),
|
u8 => log.debug("Wrote {} 0x{X:} to 0x{X:0>8}, Ignored.", .{ T, value, address }),
|
||||||
|
|
|
@ -156,12 +156,12 @@ pub fn write(bus: *Bus, comptime T: type, address: u32, value: T) void {
|
||||||
0x0400_001C => bus.ppu.setBgOffsets(3, value),
|
0x0400_001C => bus.ppu.setBgOffsets(3, value),
|
||||||
0x0400_0020 => bus.ppu.aff_bg[0].writePaPb(value),
|
0x0400_0020 => bus.ppu.aff_bg[0].writePaPb(value),
|
||||||
0x0400_0024 => bus.ppu.aff_bg[0].writePcPd(value),
|
0x0400_0024 => bus.ppu.aff_bg[0].writePcPd(value),
|
||||||
0x0400_0028 => bus.ppu.aff_bg[0].x = @bitCast(i32, value),
|
0x0400_0028 => bus.ppu.aff_bg[0].setX(bus.ppu.dispstat.vblank.read(), value),
|
||||||
0x0400_002C => bus.ppu.aff_bg[0].y = @bitCast(i32, value),
|
0x0400_002C => bus.ppu.aff_bg[0].setY(bus.ppu.dispstat.vblank.read(), value),
|
||||||
0x0400_0030 => bus.ppu.aff_bg[1].writePaPb(value),
|
0x0400_0030 => bus.ppu.aff_bg[1].writePaPb(value),
|
||||||
0x0400_0034 => bus.ppu.aff_bg[1].writePcPd(value),
|
0x0400_0034 => bus.ppu.aff_bg[1].writePcPd(value),
|
||||||
0x0400_0038 => bus.ppu.aff_bg[1].x = @bitCast(i32, value),
|
0x0400_0038 => bus.ppu.aff_bg[1].setX(bus.ppu.dispstat.vblank.read(), value),
|
||||||
0x0400_003C => bus.ppu.aff_bg[1].y = @bitCast(i32, value),
|
0x0400_003C => bus.ppu.aff_bg[1].setY(bus.ppu.dispstat.vblank.read(), value),
|
||||||
0x0400_0040 => log.debug("Wrote 0x{X:0>8} to WIN0H and WIN1H", .{value}),
|
0x0400_0040 => log.debug("Wrote 0x{X:0>8} to WIN0H and WIN1H", .{value}),
|
||||||
0x0400_0044 => log.debug("Wrote 0x{X:0>8} to WIN0V and WIN1V", .{value}),
|
0x0400_0044 => log.debug("Wrote 0x{X:0>8} to WIN0V and WIN1V", .{value}),
|
||||||
0x0400_0048 => log.debug("Wrote 0x{X:0>8} to WININ and WINOUT", .{value}),
|
0x0400_0048 => log.debug("Wrote 0x{X:0>8} to WININ and WINOUT", .{value}),
|
||||||
|
|
10
src/ppu.zig
10
src/ppu.zig
|
@ -752,6 +752,16 @@ const AffineBackground = struct {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn setX(self: *Self, is_vblank: bool, value: u32) void {
|
||||||
|
self.x = @bitCast(i32, value);
|
||||||
|
if (!is_vblank) self.x_latch = @bitCast(i32, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn setY(self: *Self, is_vblank: bool, value: u32) void {
|
||||||
|
self.y = @bitCast(i32, value);
|
||||||
|
if (!is_vblank) self.y_latch = @bitCast(i32, value);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn writePaPb(self: *Self, value: u32) void {
|
pub fn writePaPb(self: *Self, value: u32) void {
|
||||||
self.pa = @bitCast(i16, @truncate(u16, value));
|
self.pa = @bitCast(i16, @truncate(u16, value));
|
||||||
self.pb = @bitCast(i16, @truncate(u16, value >> 16));
|
self.pb = @bitCast(i16, @truncate(u16, value >> 16));
|
||||||
|
|
|
@ -102,13 +102,13 @@ pub const FilePaths = struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn readUndefined(log: anytype, comptime format: []const u8, args: anytype) u8 {
|
pub fn readUndefined(log: anytype, comptime format: []const u8, args: anytype) u8 {
|
||||||
log.debug(format, args);
|
log.warn(format, args);
|
||||||
if (builtin.mode == .Debug) std.debug.panic("TODO: Implement I/O Register", .{});
|
if (builtin.mode == .Debug) std.debug.panic("TODO: Implement I/O Register", .{});
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn writeUndefined(log: anytype, comptime format: []const u8, args: anytype) void {
|
pub fn writeUndefined(log: anytype, comptime format: []const u8, args: anytype) void {
|
||||||
log.debug(format, args);
|
log.warn(format, args);
|
||||||
if (builtin.mode == .Debug) std.debug.panic("TODO: Implement I/O Register", .{});
|
if (builtin.mode == .Debug) std.debug.panic("TODO: Implement I/O Register", .{});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue