chore: implement I/O regsister for Minish Cap
This commit is contained in:
parent
81db06d2fc
commit
f4a48d536c
12
src/apu.zig
12
src/apu.zig
|
@ -105,13 +105,13 @@ pub const Apu = struct {
|
|||
}
|
||||
|
||||
/// NR52
|
||||
pub fn soundCntX(self: *const Self) u32 {
|
||||
const apu_enable = @boolToInt(self.cnt.apu_enable.read());
|
||||
pub fn soundCntX(self: *const Self) u8 {
|
||||
const apu_enable: u8 = @boolToInt(self.cnt.apu_enable.read());
|
||||
|
||||
const ch1_enable = @boolToInt(self.ch1.enabled);
|
||||
const ch2_enable = @boolToInt(self.ch2.enabled);
|
||||
const ch3_enable = @boolToInt(self.ch3.enabled);
|
||||
const ch4_enable = @boolToInt(self.ch4.enabled);
|
||||
const ch1_enable: u8 = @boolToInt(self.ch1.enabled);
|
||||
const ch2_enable: u8 = @boolToInt(self.ch2.enabled);
|
||||
const ch3_enable: u8 = @boolToInt(self.ch3.enabled);
|
||||
const ch4_enable: u8 = @boolToInt(self.ch4.enabled);
|
||||
|
||||
return apu_enable << 7 | ch4_enable << 3 | ch3_enable << 2 | ch2_enable << 1 | ch1_enable;
|
||||
}
|
||||
|
|
|
@ -124,6 +124,7 @@ pub fn read(bus: *const Bus, comptime T: type, address: u32) T {
|
|||
0x0400_0079 => bus.apu.ch4.envelope.raw,
|
||||
0x0400_007C => bus.apu.ch4.poly.raw,
|
||||
0x0400_0081 => @truncate(T, bus.apu.psg_cnt.raw >> 8),
|
||||
0x0400_0084 => bus.apu.soundCntX(),
|
||||
0x0400_0089 => @truncate(T, bus.apu.bias.raw >> 8),
|
||||
|
||||
// Serial Communication 1
|
||||
|
|
Loading…
Reference in New Issue