Fixed vblank_stat_intr-C

This commit is contained in:
Lior Halphon 2018-03-10 15:52:22 +02:00
parent c267ad00b5
commit 15b6c48d7c
1 changed files with 9 additions and 1 deletions

View File

@ -685,7 +685,15 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
for (; gb->current_line < VIRTUAL_LINES - 1; gb->current_line++) {
gb->io_registers[GB_IO_LY] = gb->current_line;
gb->ly_for_comparison = -1;
GB_STAT_update(gb);
if (gb->is_cgb && gb->current_line == LINES) {
gb->io_registers[GB_IO_STAT] &= ~3;
gb->io_registers[GB_IO_STAT] |= 2;
GB_STAT_update(gb);
gb->io_registers[GB_IO_STAT] &= ~3;
}
else {
GB_STAT_update(gb);
}
GB_SLEEP(gb, display, 12, 4);
gb->ly_for_comparison = gb->current_line;