From 15b6c48d7cbe624bb00b69b3307db9a671d47d39 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 10 Mar 2018 15:52:22 +0200 Subject: [PATCH] Fixed vblank_stat_intr-C --- Core/display.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Core/display.c b/Core/display.c index 8e4a66e..b7e3e80 100755 --- a/Core/display.c +++ b/Core/display.c @@ -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;