chore: implement I/O regsister for Minish Cap

This commit is contained in:
2022-04-25 08:01:34 -05:00
parent 81db06d2fc
commit f4a48d536c
2 changed files with 7 additions and 6 deletions

View File

@@ -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;
}