From 832e1b7633a4bdfa0f44ab2898349e4690f6d64f Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Mon, 2 Aug 2021 22:37:40 -0500 Subject: [PATCH] fix(apu): implement WAVE RAM blocking --- src/apu.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/apu.rs b/src/apu.rs index 0de2fa7..5ebb305 100644 --- a/src/apu.rs +++ b/src/apu.rs @@ -664,7 +664,11 @@ pub(crate) struct Channel3 { impl BusIo for Channel3 { fn read_byte(&self, addr: u16) -> u8 { - self.wave_ram[(addr - Self::WAVE_RAM_START_ADDR) as usize] + if self.enabled { + self.wave_ram[self.offset as usize] + } else { + self.wave_ram[(addr - Self::WAVE_RAM_START_ADDR) as usize] + } } fn write_byte(&mut self, addr: u16, byte: u8) {