Fixed a bug where HDMA begins in the middle of an instruction while cycles are pending to be flushed. Fixes #230

This commit is contained in:
Lior Halphon 2020-02-10 00:21:33 +02:00
parent dcb3f6db9e
commit 804b9bec63
1 changed files with 2 additions and 1 deletions

View File

@ -1512,10 +1512,11 @@ void GB_cpu_run(GB_gameboy_t *gb)
opcodes[gb->last_opcode_read](gb, gb->last_opcode_read);
}
flush_pending_cycles(gb);
if (gb->hdma_starting) {
gb->hdma_starting = false;
gb->hdma_on = true;
gb->hdma_cycles = -8;
}
flush_pending_cycles(gb);
}