From 4cb56dc76fd7858aef8a558bf5e917433b470359 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 27 Mar 2020 16:35:36 +0300 Subject: [PATCH] Improve MBC2 emulation. Fixes #238 --- Core/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/memory.c b/Core/memory.c index fccfd86..d3d9aaa 100644 --- a/Core/memory.c +++ b/Core/memory.c @@ -456,9 +456,9 @@ static void write_mbc(GB_gameboy_t *gb, uint16_t addr, uint8_t value) } break; case GB_MBC2: - switch (addr & 0xF000) { - case 0x0000: case 0x1000: if (!(addr & 0x100)) gb->mbc_ram_enable = (value & 0xF) == 0xA; break; - case 0x2000: case 0x3000: if ( addr & 0x100) gb->mbc2.rom_bank = value; break; + switch (addr & 0x4100) { + case 0x0000: gb->mbc_ram_enable = (value & 0xF) == 0xA; break; + case 0x0100: gb->mbc2.rom_bank = value; break; } break; case GB_MBC3: