Fixed a bug where modifying RTC data would corrupt cartridge RAM data. Fixes #136

This commit is contained in:
Lior Halphon 2019-01-18 02:36:14 +02:00
parent 312478e509
commit 4536581a6e

View File

@ -520,6 +520,7 @@ static void write_mbc_ram(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
if (gb->cartridge_type->has_rtc && gb->mbc_ram_bank >= 8 && gb->mbc_ram_bank <= 0xC) { if (gb->cartridge_type->has_rtc && gb->mbc_ram_bank >= 8 && gb->mbc_ram_bank <= 0xC) {
gb->rtc_latched.data[gb->mbc_ram_bank - 8] = gb->rtc_real.data[gb->mbc_ram_bank - 8] = value; gb->rtc_latched.data[gb->mbc_ram_bank - 8] = gb->rtc_real.data[gb->mbc_ram_bank - 8] = value;
return;
} }
if (!gb->mbc_ram) { if (!gb->mbc_ram) {