Adjust the handling of >4MB ISX files

This commit is contained in:
Lior Halphon 2024-02-23 19:03:36 +02:00
parent 8c9c97b74f
commit 5e4a1f6db7
1 changed files with 4 additions and 2 deletions

View File

@ -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--) {