From b1f991bf9431c99e2ba3b2486d4d38b3d74d77b3 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 9 May 2023 14:50:57 -0700 Subject: [PATCH] GB I/O: Read back proper SVBK value after writing 0 (fixes #2921) --- CHANGES | 1 + src/gb/io.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ca460464c..d45c14d5e 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ Features: - Debugger: Add range watchpoints Emulation fixes: - GB Audio: Fix channels 1/2 staying muted if restarted after long silence + - GB I/O: Read back proper SVBK value after writing 0 (fixes mgba.io/i/2921) - GB Serialize: Add missing Pocket Cam state to savestates - GB SIO: Disabling SIO should cancel pending transfers (fixes mgba.io/i/2537) - GB Video: Implement DMG-style sprite ordering diff --git a/src/gb/io.c b/src/gb/io.c index ba4473550..560ad7e62 100644 --- a/src/gb/io.c +++ b/src/gb/io.c @@ -491,7 +491,7 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) { return; case GB_REG_SVBK: GBMemorySwitchWramBank(&gb->memory, value); - value = gb->memory.wramCurrentBank; + value &= 7; break; default: goto failed;