From fa35869bc4ee6dd91cff8c5635798127c6c3a17d Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Tue, 11 Oct 2016 13:37:43 +0300 Subject: [PATCH] Implemented DMG STAT-write interrupt bug, fixed Road Rash and Zero no Densetsu (These game do not work on CGBs) --- Core/memory.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Core/memory.c b/Core/memory.c index 28d2a7d..beb9a09 100644 --- a/Core/memory.c +++ b/Core/memory.c @@ -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 */