fix(apu): implement write guards for Ch1 & Ch1 when disabled

This commit is contained in:
2021-07-18 22:10:32 -05:00
parent f429d72882
commit 6f6c308d84
2 changed files with 93 additions and 45 deletions

View File

@@ -224,12 +224,12 @@ impl BusIo for Bus {
0x06 => self.timer.modulo,
0x07 => self.timer.ctrl.into(),
0x0F => self.interrupt_flag().into(),
0x10 => self.apu.ch1.sweep.into(),
0x10 => self.apu.ch1.sweep(),
0x11 => self.apu.ch1.duty(),
0x12 => self.apu.ch1.envelope.into(),
0x12 => self.apu.ch1.envelope(),
0x14 => self.apu.ch1.freq_hi(),
0x16 => self.apu.ch2.duty(),
0x17 => self.apu.ch2.envelope.into(),
0x17 => self.apu.ch2.envelope(),
0x19 => self.apu.ch2.freq_hi(),
0x1A => self.apu.ch3.enabled(),
0x1B => self.apu.ch3.len(),
@@ -342,13 +342,13 @@ impl BusIo for Bus {
0x06 => self.timer.modulo = byte,
0x07 => self.timer.ctrl = byte.into(),
0x0F => self.set_interrupt_flag(byte),
0x10 => self.apu.ch1.sweep = byte.into(),
0x10 => self.apu.ch1.set_sweep(byte),
0x11 => self.apu.ch1.set_duty(byte),
0x12 => self.apu.ch1.envelope = byte.into(),
0x12 => self.apu.ch1.set_envelope(byte),
0x13 => self.apu.ch1.set_freq_lo(byte),
0x14 => self.apu.ch1.set_freq_hi(byte),
0x16 => self.apu.ch2.set_duty(byte),
0x17 => self.apu.ch2.envelope = byte.into(),
0x17 => self.apu.ch2.set_envelope(byte),
0x18 => self.apu.ch2.set_freq_lo(byte),
0x19 => self.apu.ch2.set_freq_hi(byte),
0x1A => self.apu.ch3.set_enabled(byte),