Improve MBC2 emulation. Fixes #238

This commit is contained in:
Lior Halphon 2020-03-27 16:35:36 +03:00
parent fa1c84f18f
commit 4cb56dc76f

View File

@ -456,9 +456,9 @@ static void write_mbc(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
} }
break; break;
case GB_MBC2: case GB_MBC2:
switch (addr & 0xF000) { switch (addr & 0x4100) {
case 0x0000: case 0x1000: if (!(addr & 0x100)) gb->mbc_ram_enable = (value & 0xF) == 0xA; break; case 0x0000: gb->mbc_ram_enable = (value & 0xF) == 0xA; break;
case 0x2000: case 0x3000: if ( addr & 0x100) gb->mbc2.rom_bank = value; break; case 0x0100: gb->mbc2.rom_bank = value; break;
} }
break; break;
case GB_MBC3: case GB_MBC3: