diff --git a/Core/memory.c b/Core/memory.c index a13b374..32a19aa 100644 --- a/Core/memory.c +++ b/Core/memory.c @@ -577,6 +577,10 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value) } gb->hdma_on = (value & 0x80) == 0; gb->hdma_on_hblank = (value & 0x80) != 0; + if (gb->hdma_on_hblank && (gb->io_registers[GB_IO_STAT] & 3) == 0) { + gb->hdma_on = true; + gb->hdma_cycles = 0; + } gb->io_registers[GB_IO_HDMA5] = value; gb->hdma_steps_left = (gb->io_registers[GB_IO_HDMA5] & 0x7F) + 1; /* Todo: Verify this. Gambatte's DMA tests require this. */