The fetcher pushes pixels to the FIFO as soon as it's empty

This commit is contained in:
Lior Halphon 2020-02-28 18:10:09 +02:00
parent 60f01fe947
commit 2a8f15c68b

View File

@ -656,7 +656,7 @@ static void advance_fetcher_state_machine(GB_gameboy_t *gb)
} }
} }
gb->fetcher_state++; gb->fetcher_state++;
break; // fallthrough
case GB_FETCHER_PUSH: { case GB_FETCHER_PUSH: {
@ -964,7 +964,7 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
fifo_clear(&gb->bg_fifo); fifo_clear(&gb->bg_fifo);
gb->bg_fifo_paused = true; gb->bg_fifo_paused = true;
gb->oam_fifo_paused = true; gb->oam_fifo_paused = true;
gb->fetcher_state = 1; gb->fetcher_state = 0;
window_got_activated = true; window_got_activated = true;
} }
} }
@ -988,7 +988,6 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
/* TODO: This is wrong. It is only correct for a single object, not for more than one. */ /* TODO: This is wrong. It is only correct for a single object, not for more than one. */
if (window_got_activated) { if (window_got_activated) {
window_got_activated = false; window_got_activated = false;
gb->fetcher_state = 0;
gb->cycles_for_line += 6; gb->cycles_for_line += 6;
GB_SLEEP(gb, display, 42, 6); GB_SLEEP(gb, display, 42, 6);
} }