feat(snd): implement channel 3

This commit is contained in:
2021-06-15 00:29:31 -05:00
parent e45c13f719
commit 909972d36e
2 changed files with 78 additions and 29 deletions

View File

@@ -227,9 +227,14 @@ impl BusIo for Bus {
0x16 => self.sound.ch2.duty.into(),
0x17 => self.sound.ch2.envelope.into(),
0x19 => self.sound.ch2.freq_hi.into(),
0x1A => self.sound.ch3.enabled(),
0x1B => self.sound.ch3.len,
0x1C => self.sound.ch3.volume(),
0x1E => self.sound.ch3.freq_hi.into(),
0x24 => self.sound.ctrl.channel.into(),
0x25 => self.sound.ctrl.output.into(),
0x26 => self.sound.ctrl.status.into(),
0x30..=0x3F => self.sound.ch3.ram[addr as usize - 0xFF30],
0x40 => self.ppu.ctrl.into(),
0x41 => self.ppu.stat.into(),
0x42 => self.ppu.pos.scroll_y,
@@ -328,15 +333,21 @@ impl BusIo for Bus {
0x10 => self.sound.ch1.sweep = byte.into(),
0x11 => self.sound.ch1.duty = byte.into(),
0x12 => self.sound.ch1.envelope = byte.into(),
0x13 => self.sound.ch1.freq_lo = byte.into(),
0x13 => self.sound.ch1.freq_lo = byte,
0x14 => self.sound.ch1.freq_hi = byte.into(),
0x16 => self.sound.ch2.duty = byte.into(),
0x17 => self.sound.ch2.envelope = byte.into(),
0x18 => self.sound.ch2.freq_lo = byte.into(),
0x18 => self.sound.ch2.freq_lo = byte,
0x19 => self.sound.ch2.freq_hi = byte.into(),
0x1A => self.sound.ch3.set_enabled(byte),
0x1B => self.sound.ch3.len = byte,
0x1C => self.sound.ch3.set_volume(byte),
0x1D => self.sound.ch3.freq_lo = byte,
0x1E => self.sound.ch3.freq_hi = byte.into(),
0x24 => self.sound.ctrl.channel = byte.into(),
0x25 => self.sound.ctrl.output = byte.into(),
0x26 => self.sound.ctrl.status = byte.into(), // FIXME: Should we control which bytes are written to here?
0x30..=0x3F => self.sound.ch3.ram[addr as usize - 0xFF30] = byte,
0x40 => self.ppu.ctrl = byte.into(),
0x41 => self.ppu.stat.update(byte),
0x42 => self.ppu.pos.scroll_y = byte,