Refinements to DMG STAT write interrupt bug. Fixes stat_irq_blocking on DMG.

This commit is contained in:
Lior Halphon 2017-02-25 21:56:46 +02:00
parent 2c1d2571d3
commit 55e54d9499

View File

@ -452,7 +452,8 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
case GB_IO_STAT: case GB_IO_STAT:
/* A DMG bug: http://www.devrs.com/gb/files/faqs.html#GBBugs */ /* 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; gb->io_registers[GB_IO_IF] |= 2;
} }
/* Delete previous R/W bits */ /* Delete previous R/W bits */