From d81c23cb16711e3daf05fd3c933b73f8fd1a1a8e Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 16 Jun 2018 23:52:24 +0300 Subject: [PATCH] Fixed HDMA regression --- Core/memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/memory.c b/Core/memory.c index 43cb049..ee9ad18 100644 --- a/Core/memory.c +++ b/Core/memory.c @@ -906,15 +906,17 @@ void GB_dma_run(GB_gameboy_t *gb) void GB_hdma_run(GB_gameboy_t *gb) { if (!gb->hdma_on) return; + while (gb->hdma_cycles >= 0x4) { gb->hdma_cycles -= 0x4; GB_write_memory(gb, 0x8000 | (gb->hdma_current_dest++ & 0x1FFF), GB_read_memory(gb, (gb->hdma_current_src++))); if ((gb->hdma_current_dest & 0xf) == 0) { - if(--gb->hdma_steps_left == 0){ + if (--gb->hdma_steps_left == 0) { gb->hdma_on = false; gb->hdma_on_hblank = false; + gb->hdma_starting = false; gb->io_registers[GB_IO_HDMA5] &= 0x7F; break; }