Refined line 153 behavior on a CGB. Verified on CGB-E.

This commit is contained in:
Lior Halphon 2018-04-25 00:08:06 +03:00
parent be9df4d658
commit 0f8385a798
1 changed files with 4 additions and 10 deletions

View File

@ -859,25 +859,19 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
GB_SLEEP(gb, display, 13, LINE_LENGTH - 4); GB_SLEEP(gb, display, 13, LINE_LENGTH - 4);
} }
/* TODO: Verified on SGB2 and CGB-E. Actual interrupt timings not tested. */
/* Lines 153 */ /* Lines 153 */
gb->io_registers[GB_IO_LY] = 153; gb->io_registers[GB_IO_LY] = 153;
if (!gb->cgb_mode) { gb->ly_for_comparison = gb->is_cgb? 152 : -1;
gb->ly_for_comparison = gb->is_cgb? 153 : -1;
}
GB_STAT_update(gb); GB_STAT_update(gb);
GB_SLEEP(gb, display, 14, 6); GB_SLEEP(gb, display, 14, 6);
gb->io_registers[GB_IO_LY] = 0; 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_STAT_update(gb);
GB_SLEEP(gb, display, 15, 2); GB_SLEEP(gb, display, 15, 2);
if (gb->cgb_mode) { gb->ly_for_comparison = gb->is_cgb? 153 : -1;
gb->ly_for_comparison = 0;
}
else if(!gb->is_cgb) {
gb->ly_for_comparison = -1;
}
GB_STAT_update(gb); GB_STAT_update(gb);
GB_SLEEP(gb, display, 16, 4); GB_SLEEP(gb, display, 16, 4);