Merge branch 'master' into timing

# Conflicts:
#	Core/display.c
#	Core/z80_cpu.c
This commit is contained in:
Lior Halphon 2018-03-19 23:46:33 +02:00
commit 3883b7d86a
3 changed files with 8 additions and 2 deletions

View File

@ -680,8 +680,7 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
gb->oam_write_blocked = false; gb->oam_write_blocked = false;
gb->vram_write_blocked = false; gb->vram_write_blocked = false;
if (gb->hdma_on_hblank) { if (gb->hdma_on_hblank) {
gb->hdma_on = true; gb->hdma_starting = true;
gb->hdma_cycles = 0;
} }
gb->cycles_for_line++; gb->cycles_for_line++;
GB_SLEEP(gb, display, 22, 1); GB_SLEEP(gb, display, 22, 1);

View File

@ -289,6 +289,7 @@ struct GB_gameboy_internal_s {
int16_t dma_cycles; int16_t dma_cycles;
bool is_dma_restarting; bool is_dma_restarting;
uint8_t last_opcode_read; /* Required to emulte HDMA reads from Exxx */ uint8_t last_opcode_read; /* Required to emulte HDMA reads from Exxx */
bool hdma_starting;
); );
/* MBC */ /* MBC */

View File

@ -1424,4 +1424,10 @@ void GB_cpu_run(GB_gameboy_t *gb)
} }
opcodes[gb->last_opcode_read](gb, gb->last_opcode_read); opcodes[gb->last_opcode_read](gb, gb->last_opcode_read);
} }
if (gb->hdma_starting) {
gb->hdma_starting = false;
gb->hdma_on = true;
gb->hdma_cycles = 0;
}
} }