From 12e67588053160d2f9599a09ef932f9b37b1b873 Mon Sep 17 00:00:00 2001 From: gbc dev Date: Wed, 15 Jul 2026 00:37:04 +0200 Subject: apu: register-level emulation of 0xFF10-0xFF3F (fixes music fades) The APU was a black hole: reads returned 0xFF, writes were dropped. That hangs any game that fades music out by decrementing the NR50/rAUDVOL volume register until it reads 0 (Pokemon's StopMusic spin-wait) - the write never stuck, the read never hit 0, infinite loop. Store the 48 sound registers and return them with the standard hardware read-back OR-masks (NR50 mask 0x00 = exact readback). No synthesis, just correct register behavior. --- src/gb.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gb.h') diff --git a/src/gb.h b/src/gb.h index 806daba..7439615 100644 --- a/src/gb.h +++ b/src/gb.h @@ -94,6 +94,11 @@ struct GB { // serial u8 sb, sc; + // APU registers 0xFF10-0xFF3F. We don't synthesize sound, but games read + // these back (e.g. the music fade-out decrements NR50/rAUDVOL until it + // reads 0), so they must behave as real storage, not a 0xFF black hole. + u8 apu[0x30]; + // DMA u8 dma; -- cgit v1.3.1-sl0p