From 55e54d94994d2fc6c297ba47084bd11bb6bf6507 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 25 Feb 2017 21:56:46 +0200 Subject: [PATCH] Refinements to DMG STAT write interrupt bug. Fixes stat_irq_blocking on DMG. --- Core/memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/memory.c b/Core/memory.c index 32a19aa..3c8356e 100644 --- a/Core/memory.c +++ b/Core/memory.c @@ -452,7 +452,8 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value) 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)) { + if (!gb->is_cgb && !gb->stat_interrupt_line && + (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 */