Fixed a bug that prevented STAT interrupt blocking from functioning correctly in the transition to VBlank while the OAM interrupt was disabled

This commit is contained in:
Lior Halphon 2021-06-18 01:20:05 +03:00
parent 7a6ae2d951
commit 339613263c
1 changed files with 5 additions and 5 deletions

View File

@ -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);