diff --git a/Core/display.c b/Core/display.c index b94ff26..a546127 100644 --- a/Core/display.c +++ b/Core/display.c @@ -1305,10 +1305,9 @@ abort_fetching_object: gb->io_registers[GB_IO_LY] = gb->current_line; gb->ly_for_comparison = -1; GB_SLEEP(gb, display, 26, 2); - if (gb->current_line == LINES) { - gb->mode_for_interrupt = 2; + if (gb->current_line == LINES && !gb->stat_interrupt_line && (gb->io_registers[GB_IO_STAT] & 0x20)) { + gb->io_registers[GB_IO_IF] |= 2; } - GB_STAT_update(gb); GB_SLEEP(gb, display, 12, 2); gb->ly_for_comparison = gb->current_line; @@ -1317,8 +1316,9 @@ abort_fetching_object: gb->io_registers[GB_IO_STAT] &= ~3; gb->io_registers[GB_IO_STAT] |= 1; gb->io_registers[GB_IO_IF] |= 1; - gb->mode_for_interrupt = 2; - GB_STAT_update(gb); + if (!gb->stat_interrupt_line && (gb->io_registers[GB_IO_STAT] & 0x20)) { + gb->io_registers[GB_IO_IF] |= 2; + } gb->mode_for_interrupt = 1; GB_STAT_update(gb);