Skip to content

Commit

Permalink
Correctly emulate LYC edge cases when emulating CGB-0 to CGB-C in dou…
Browse files Browse the repository at this point in the history
…ble speed mode
  • Loading branch information
LIJI32 committed Aug 16, 2024
1 parent b8e32e6 commit 4610835
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Core/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ void GB_STAT_update(GB_gameboy_t *gb)

bool previous_interrupt_line = gb->stat_interrupt_line;
/* Set LY=LYC bit */
if (gb->ly_for_comparison != (uint16_t)-1 || gb->model <= GB_MODEL_CGB_C) {
if (gb->ly_for_comparison != (uint16_t)-1 || (gb->model <= GB_MODEL_CGB_C && !gb->cgb_double_speed)) {
if (gb->ly_for_comparison == gb->io_registers[GB_IO_LYC]) {
gb->lyc_interrupt_line = true;
gb->io_registers[GB_IO_STAT] |= 4;
Expand Down Expand Up @@ -2141,7 +2141,7 @@ void GB_display_run(GB_gameboy_t *gb, unsigned cycles, bool force)
GB_SLEEP(gb, display, 15, (gb->model > GB_MODEL_CGB_C)? 4: 2);

gb->io_registers[GB_IO_LY] = 0;
gb->ly_for_comparison = (gb->model > GB_MODEL_CGB_C)? 153 : -1;
gb->ly_for_comparison = (gb->model > GB_MODEL_CGB_C || gb->cgb_double_speed)? 153 : -1;
GB_STAT_update(gb);
GB_SLEEP(gb, display, 16, 4);

Expand Down

0 comments on commit 4610835

Please sign in to comment.