chore(sound): implement channel 2 registers

This commit is contained in:
2021-06-14 23:37:30 -05:00
parent f2513c6964
commit 6a7ff66274
2 changed files with 37 additions and 19 deletions

View File

@@ -220,12 +220,15 @@ impl BusIo for Bus {
0x06 => self.timer.modulo,
0x07 => self.timer.ctrl.into(),
0x0F => self.interrupt_flag().into(),
0x11 => self.sound.ch1.sound_duty.into(),
0x12 => self.sound.ch1.vol_envelope.into(),
0x11 => self.sound.ch1.duty.into(),
0x12 => self.sound.ch1.envelope.into(),
0x14 => self.sound.ch1.freq_hi.into(),
0x24 => self.sound.control.channel.into(),
0x25 => self.sound.control.output.into(),
0x26 => self.sound.control.status.into(),
0x16 => self.sound.ch2.duty.into(),
0x17 => self.sound.ch2.envelope.into(),
0x19 => self.sound.ch2.freq_hi.into(),
0x24 => self.sound.ctrl.channel.into(),
0x25 => self.sound.ctrl.output.into(),
0x26 => self.sound.ctrl.status.into(),
0x40 => self.ppu.ctrl.into(),
0x41 => self.ppu.stat.into(),
0x42 => self.ppu.pos.scroll_y,
@@ -238,7 +241,6 @@ impl BusIo for Bus {
0x49 => self.ppu.monochrome.obj_palette_1.into(),
0x4A => self.ppu.pos.window_y,
0x4B => self.ppu.pos.window_x,
0x4D => 0x00, // Reading from this address is useful on the CGB only
_ => unimplemented!("Unable to read {:#06X} in I/O Registers", addr),
}
}
@@ -322,13 +324,17 @@ impl BusIo for Bus {
0x06 => self.timer.modulo = byte,
0x07 => self.timer.ctrl = byte.into(),
0x0F => self.set_interrupt_flag(byte),
0x11 => self.sound.ch1.sound_duty = byte.into(),
0x12 => self.sound.ch1.vol_envelope = byte.into(),
0x11 => self.sound.ch1.duty = byte.into(),
0x12 => self.sound.ch1.envelope = byte.into(),
0x13 => self.sound.ch1.freq_lo = byte.into(),
0x14 => self.sound.ch1.freq_hi = byte.into(),
0x24 => self.sound.control.channel = byte.into(),
0x25 => self.sound.control.output = byte.into(),
0x26 => self.sound.control.status = byte.into(), // FIXME: Should we control which bytes are written to here?
0x16 => self.sound.ch2.duty = byte.into(),
0x17 => self.sound.ch2.envelope = byte.into(),
0x18 => self.sound.ch2.freq_lo = byte.into(),
0x19 => self.sound.ch2.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?
0x40 => self.ppu.ctrl = byte.into(),
0x41 => self.ppu.stat.update(byte),
0x42 => self.ppu.pos.scroll_y = byte,