Implemented DMG STAT-write interrupt bug, fixed Road Rash and Zero no Densetsu (These game do not work on CGBs)

This commit is contained in:
Lior Halphon 2016-10-11 13:37:43 +03:00
parent 11cbe58eb1
commit fa35869bc4
1 changed files with 4 additions and 0 deletions

View File

@ -433,6 +433,10 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
return;
case GB_IO_STAT:
/* A DMG bug: http://www.devrs.com/gb/files/faqs.html#GBBugs */
if (!gb->is_cgb && (gb->io_registers[GB_IO_STAT] & 0x3) < 2 && (gb->io_registers[GB_IO_LCDC] & 0x80)) {
gb->io_registers[GB_IO_IF] |= 2;
}
/* Delete previous R/W bits */
gb->io_registers[GB_IO_STAT] &= 7;
/* Set them by value */