From 5e4a1f6db78f51449d745c66e31c23017443b78e Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 23 Feb 2024 19:03:36 +0200 Subject: [PATCH] Adjust the handling of >4MB ISX files --- Core/gb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/gb.c b/Core/gb.c index e89cac8..b22a01c 100644 --- a/Core/gb.c +++ b/Core/gb.c @@ -549,7 +549,10 @@ int GB_load_isx(GB_gameboy_t *gb, const char *path) bank = byte; if (byte >= 0x80) { READ(byte); - bank |= byte << 8; + /* TODO: This is just a guess, the docs don't elaborator on how banks > 0xFF are saved, + other than the fact that banks >= 80 requires two bytes to store them, and I haven't + encountered an ISX file for a ROM larger than 4MBs yet. */ + bank += byte << 7; } READ(address); @@ -603,7 +606,6 @@ int GB_load_isx(GB_gameboy_t *gb, const char *path) uint8_t flag; uint16_t bank; uint16_t address; - uint8_t byte; READ(count); count = LE16(count); while (count--) {