Get rid of the FIFO pause flags
This commit is contained in:
parent
e29246fd91
commit
955860b463
@ -422,20 +422,21 @@ static void render_pixel_if_possible(GB_gameboy_t *gb)
|
|||||||
bool draw_oam = false;
|
bool draw_oam = false;
|
||||||
bool bg_enabled = true, bg_priority = false;
|
bool bg_enabled = true, bg_priority = false;
|
||||||
|
|
||||||
if (!gb->bg_fifo_paused) {
|
if (fifo_size(&gb->bg_fifo)) {
|
||||||
fifo_item = fifo_pop(&gb->bg_fifo);
|
fifo_item = fifo_pop(&gb->bg_fifo);
|
||||||
bg_priority = fifo_item->bg_priority;
|
bg_priority = fifo_item->bg_priority;
|
||||||
}
|
|
||||||
|
if (fifo_size(&gb->oam_fifo)) {
|
||||||
if (!gb->oam_fifo_paused && fifo_size(&gb->oam_fifo)) {
|
oam_fifo_item = fifo_pop(&gb->oam_fifo);
|
||||||
oam_fifo_item = fifo_pop(&gb->oam_fifo);
|
if (oam_fifo_item->pixel && (gb->io_registers[GB_IO_LCDC] & 2)) {
|
||||||
if (oam_fifo_item->pixel && (gb->io_registers[GB_IO_LCDC] & 2)) {
|
draw_oam = true;
|
||||||
draw_oam = true;
|
bg_priority |= oam_fifo_item->bg_priority;
|
||||||
bg_priority |= oam_fifo_item->bg_priority;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gb->bg_fifo_paused) return;
|
|
||||||
|
if (!fifo_item) return;
|
||||||
|
|
||||||
/* Drop pixels for scrollings */
|
/* Drop pixels for scrollings */
|
||||||
if (gb->position_in_line >= 160 || (gb->disable_rendering && !gb->sgb)) {
|
if (gb->position_in_line >= 160 || (gb->disable_rendering && !gb->sgb)) {
|
||||||
@ -658,7 +659,6 @@ static void advance_fetcher_state_machine(GB_gameboy_t *gb)
|
|||||||
gb->fetcher_state++;
|
gb->fetcher_state++;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
|
|
||||||
case GB_FETCHER_PUSH: {
|
case GB_FETCHER_PUSH: {
|
||||||
if (fifo_size(&gb->bg_fifo) > 0) break;
|
if (fifo_size(&gb->bg_fifo) > 0) break;
|
||||||
|
|
||||||
@ -673,8 +673,6 @@ static void advance_fetcher_state_machine(GB_gameboy_t *gb)
|
|||||||
|
|
||||||
fifo_push_bg_row(&gb->bg_fifo, gb->current_tile_data[0], gb->current_tile_data[1],
|
fifo_push_bg_row(&gb->bg_fifo, gb->current_tile_data[0], gb->current_tile_data[1],
|
||||||
gb->current_tile_attributes & 7, gb->current_tile_attributes & 0x80, gb->current_tile_attributes & 0x20);
|
gb->current_tile_attributes & 7, gb->current_tile_attributes & 0x80, gb->current_tile_attributes & 0x20);
|
||||||
gb->bg_fifo_paused = false;
|
|
||||||
gb->oam_fifo_paused = false;
|
|
||||||
gb->fetcher_state = 0;
|
gb->fetcher_state = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -946,8 +944,6 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
|
|||||||
|
|
||||||
/* The actual rendering cycle */
|
/* The actual rendering cycle */
|
||||||
gb->fetcher_state = 0;
|
gb->fetcher_state = 0;
|
||||||
gb->bg_fifo_paused = false;
|
|
||||||
gb->oam_fifo_paused = false;
|
|
||||||
while (true) {
|
while (true) {
|
||||||
/* Handle window */
|
/* Handle window */
|
||||||
/* Todo: verify timings */
|
/* Todo: verify timings */
|
||||||
@ -962,8 +958,6 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
|
|||||||
gb->wx_triggered = true;
|
gb->wx_triggered = true;
|
||||||
gb->window_tile_x = 0;
|
gb->window_tile_x = 0;
|
||||||
fifo_clear(&gb->bg_fifo);
|
fifo_clear(&gb->bg_fifo);
|
||||||
gb->bg_fifo_paused = true;
|
|
||||||
gb->oam_fifo_paused = true;
|
|
||||||
gb->fetcher_state = 0;
|
gb->fetcher_state = 0;
|
||||||
window_got_activated = true;
|
window_got_activated = true;
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,7 @@ struct GB_gameboy_internal_s {
|
|||||||
bool vram_read_blocked;
|
bool vram_read_blocked;
|
||||||
bool oam_write_blocked;
|
bool oam_write_blocked;
|
||||||
bool vram_write_blocked;
|
bool vram_write_blocked;
|
||||||
GB_PADDING(bool, window_disabled_while_active);
|
bool fifo_insertion_glitch;
|
||||||
uint8_t current_line;
|
uint8_t current_line;
|
||||||
uint16_t ly_for_comparison;
|
uint16_t ly_for_comparison;
|
||||||
GB_fifo_t bg_fifo, oam_fifo;
|
GB_fifo_t bg_fifo, oam_fifo;
|
||||||
@ -500,8 +500,8 @@ struct GB_gameboy_internal_s {
|
|||||||
uint8_t current_tile_attributes;
|
uint8_t current_tile_attributes;
|
||||||
uint8_t current_tile_data[2];
|
uint8_t current_tile_data[2];
|
||||||
uint8_t fetcher_state;
|
uint8_t fetcher_state;
|
||||||
bool bg_fifo_paused;
|
GB_PADDING(bool,bg_fifo_paused);
|
||||||
bool oam_fifo_paused;
|
GB_PADDING(bool,oam_fifo_paused);
|
||||||
bool wx_triggered;
|
bool wx_triggered;
|
||||||
uint8_t visible_objs[10];
|
uint8_t visible_objs[10];
|
||||||
uint8_t obj_comparators[10];
|
uint8_t obj_comparators[10];
|
||||||
|
Loading…
Reference in New Issue
Block a user