From c863dc835cc2658887e0fee893bea76889368143 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Tue, 3 Aug 2021 20:23:08 -0500 Subject: [PATCH] fix(apu): fix index out of bounds error on channel 3 write --- src/apu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apu.rs b/src/apu.rs index 734a48f..f41b72e 100644 --- a/src/apu.rs +++ b/src/apu.rs @@ -671,7 +671,7 @@ impl BusIo for Channel3 { fn write_byte(&mut self, addr: u16, byte: u8) { if self.enabled { - self.wave_ram[self.offset as usize] = byte; + self.wave_ram[self.offset as usize / 2] = byte; } else { self.wave_ram[(addr - Self::WAVE_RAM_START_ADDR) as usize] = byte; }