Compare commits

..

No commits in common. "35dba63b94a1b6d88cf8993c0727902488196078" and "7441af9582baa207d5cc0fdb6cf319970def14b2" have entirely different histories.

4 changed files with 11 additions and 21 deletions

View File

@ -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.debug("Wrote {} 0x{X:} to I/O Port Data and Direction", .{ T, value }), 0x0800_00C4 => log.err("Wrote {} 0x{X:} to I/O Port Data and Direction", .{ T, value }),
0x0800_00C6 => log.debug("Wrote {} 0x{X:} to I/O Port Direction and Control", .{ T, value }), 0x0800_00C6 => log.err("Wrote {} 0x{X:} to I/O Port Direction and Control", .{ T, value }),
else => {}, else => {},
}, },
u16 => switch (address) { u16 => switch (address) {
0x0800_00C4 => log.debug("Wrote {} 0x{X:} to I/O Port Data", .{ T, value }), 0x0800_00C4 => log.err("Wrote {} 0x{X:} to I/O Port Data", .{ T, value }),
0x0800_00C6 => log.debug("Wrote {} 0x{X:} to I/O Port Direction", .{ T, value }), 0x0800_00C6 => log.err("Wrote {} 0x{X:} to I/O Port Direction", .{ T, value }),
0x0800_00C8 => log.debug("Wrote {} 0x{X:} to I/O Port Control", .{ T, value }), 0x0800_00C8 => log.err("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 }),

View File

@ -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].setX(bus.ppu.dispstat.vblank.read(), value), 0x0400_0028 => bus.ppu.aff_bg[0].x = @bitCast(i32, value),
0x0400_002C => bus.ppu.aff_bg[0].setY(bus.ppu.dispstat.vblank.read(), value), 0x0400_002C => bus.ppu.aff_bg[0].y = @bitCast(i32, 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].setX(bus.ppu.dispstat.vblank.read(), value), 0x0400_0038 => bus.ppu.aff_bg[1].x = @bitCast(i32, value),
0x0400_003C => bus.ppu.aff_bg[1].setY(bus.ppu.dispstat.vblank.read(), value), 0x0400_003C => bus.ppu.aff_bg[1].y = @bitCast(i32, 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}),

View File

@ -752,16 +752,6 @@ 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));

View File

@ -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.warn(format, args); log.debug(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.warn(format, args); log.debug(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", .{});
} }