From d5c9a52337166e7962c539b20c5381aca7a8d11c Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Tue, 7 Feb 2017 00:24:26 +0200 Subject: [PATCH] Fixed: HDMA registers were not being updated during transfer --- Core/memory.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Core/memory.c b/Core/memory.c index ecc9e54..f626a59 100644 --- a/Core/memory.c +++ b/Core/memory.c @@ -677,6 +677,17 @@ void GB_hdma_run(GB_gameboy_t *gb) } gb->hdma_current_src += 0x10; gb->hdma_current_dest += 0x10; + + gb->io_registers[GB_IO_HDMA2] += 0x10; + if ((gb->io_registers[GB_IO_HDMA2] & 0xF0) == 0) { + gb->io_registers[GB_IO_HDMA1]++; + } + + gb->io_registers[GB_IO_HDMA4] += 0x10; + if ((gb->io_registers[GB_IO_HDMA4] & 0xF0) == 0) { + gb->io_registers[GB_IO_HDMA3]++; + } + if(--gb->hdma_steps_left == 0){ gb->hdma_on = false; gb->hdma_on_hblank = false; @@ -688,4 +699,4 @@ void GB_hdma_run(GB_gameboy_t *gb) break; } } -} \ No newline at end of file +}