From 0f8385a79823a3ce282824e22954299ad95803b8 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Wed, 25 Apr 2018 00:08:06 +0300 Subject: [PATCH] Refined line 153 behavior on a CGB. Verified on CGB-E. --- Core/display.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Core/display.c b/Core/display.c index 45a6fd9..8899f88 100644 --- a/Core/display.c +++ b/Core/display.c @@ -859,25 +859,19 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles) GB_SLEEP(gb, display, 13, LINE_LENGTH - 4); } + /* TODO: Verified on SGB2 and CGB-E. Actual interrupt timings not tested. */ /* Lines 153 */ gb->io_registers[GB_IO_LY] = 153; - if (!gb->cgb_mode) { - gb->ly_for_comparison = gb->is_cgb? 153 : -1; - } + gb->ly_for_comparison = gb->is_cgb? 152 : -1; GB_STAT_update(gb); GB_SLEEP(gb, display, 14, 6); gb->io_registers[GB_IO_LY] = 0; - gb->ly_for_comparison = gb->cgb_mode? 0 : 153; + gb->ly_for_comparison = gb->is_cgb? 0 : 153; GB_STAT_update(gb); GB_SLEEP(gb, display, 15, 2); - if (gb->cgb_mode) { - gb->ly_for_comparison = 0; - } - else if(!gb->is_cgb) { - gb->ly_for_comparison = -1; - } + gb->ly_for_comparison = gb->is_cgb? 153 : -1; GB_STAT_update(gb); GB_SLEEP(gb, display, 16, 4);