fix: 8-bit writes to WIN PPU registers
Advance Wars depends on these registers similar to Mario Kart's 8-bit writes to Affine Background registers:
This commit is contained in:
parent
3195a45e3d
commit
e906506e16
|
@ -449,8 +449,12 @@ pub const BldY = extern union {
|
||||||
raw: u16,
|
raw: u16,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const u8WriteKind = enum { Hi, Lo };
|
||||||
|
|
||||||
/// Write-only
|
/// Write-only
|
||||||
pub const WinH = extern union {
|
pub const WinH = extern union {
|
||||||
|
const Self = @This();
|
||||||
|
|
||||||
x2: Bitfield(u16, 0, 8),
|
x2: Bitfield(u16, 0, 8),
|
||||||
x1: Bitfield(u16, 8, 8),
|
x1: Bitfield(u16, 8, 8),
|
||||||
raw: u16,
|
raw: u16,
|
||||||
|
@ -458,9 +462,18 @@ pub const WinH = extern union {
|
||||||
|
|
||||||
/// Write-only
|
/// Write-only
|
||||||
pub const WinV = extern union {
|
pub const WinV = extern union {
|
||||||
|
const Self = @This();
|
||||||
|
|
||||||
y2: Bitfield(u16, 0, 8),
|
y2: Bitfield(u16, 0, 8),
|
||||||
y1: Bitfield(u16, 8, 8),
|
y1: Bitfield(u16, 8, 8),
|
||||||
raw: u16,
|
raw: u16,
|
||||||
|
|
||||||
|
pub fn set(self: *Self, comptime K: u8WriteKind, value: u8) void {
|
||||||
|
self.raw = switch (K) {
|
||||||
|
.Hi => (@as(u16, value) << 8) | self.raw & 0xFF,
|
||||||
|
.Lo => (self.raw & 0xFF00) | value,
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const WinIn = extern union {
|
pub const WinIn = extern union {
|
||||||
|
|
Loading…
Reference in New Issue