From 1991893d9eed8e5b95a7421bbbc9040e2191a50a Mon Sep 17 00:00:00 2001
From: Leandro Nini <drfiemost@users.noreply.github.com>
Date: Thu, 25 Mar 2021 17:50:35 +0100
Subject: [PATCH 1/2] =?UTF-8?q?Zero=20out=20IO=20area=20($FF00=20=E2=80=93?=
 =?UTF-8?q?=20$FF7F)=20at=20startup.=20Fixes=20issue=20#40?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 gme/Gbs_Emu.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gme/Gbs_Emu.cpp b/gme/Gbs_Emu.cpp
index dc19215..249a1ff 100644
--- a/gme/Gbs_Emu.cpp
+++ b/gme/Gbs_Emu.cpp
@@ -208,8 +208,8 @@ blargg_err_t Gbs_Emu::start_track_( int track )
 	RETURN_ERR( Classic_Emu::start_track_( track ) );
 	
 	memset( ram, 0, 0x4000 );
-	memset( ram + 0x4000, 0xFF, 0x1F80 );
-	memset( ram + 0x5F80, 0, sizeof ram - 0x5F80 );
+	memset( ram + 0x4000, 0xFF, 0x1EFF );
+	memset( ram + 0x5F00, 0, sizeof ram - 0x5F00 );
 	ram [hi_page] = 0; // joypad reads back as 0
 	
 	apu.reset();
-- 
2.10.5


From b6702b1fe96cf745993ecc24ce2737bd4fa76d6f Mon Sep 17 00:00:00 2001
From: Leandro Nini <drfiemost@email.it>
Date: Fri, 2 Apr 2021 06:43:42 +0000
Subject: [PATCH 2/2] Fix stupid off by one error.

---
 gme/Gbs_Emu.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gme/Gbs_Emu.cpp b/gme/Gbs_Emu.cpp
index 249a1ff..df96e1d 100644
--- a/gme/Gbs_Emu.cpp
+++ b/gme/Gbs_Emu.cpp
@@ -208,7 +208,7 @@ blargg_err_t Gbs_Emu::start_track_( int track )
 	RETURN_ERR( Classic_Emu::start_track_( track ) );
 	
 	memset( ram, 0, 0x4000 );
-	memset( ram + 0x4000, 0xFF, 0x1EFF );
+	memset( ram + 0x4000, 0xFF, 0x1F00 );
 	memset( ram + 0x5F00, 0, sizeof ram - 0x5F00 );
 	ram [hi_page] = 0; // joypad reads back as 0
 	
-- 
2.10.5

