diff --git a/src/gb/memory.c b/src/gb/memory.c index 6fe4144cc..1e7ccaabd 100644 --- a/src/gb/memory.c +++ b/src/gb/memory.c @@ -322,8 +322,9 @@ void GBMemoryWriteHDMA5(struct GB* gb, uint8_t value) { } gb->memory.hdmaDest &= 0x1FF0; gb->memory.hdmaDest |= 0x8000; + bool wasHdma = gb->memory.isHdma; gb->memory.isHdma = value & 0x80; - if (!gb->memory.isHdma) { + if (!wasHdma && !gb->memory.isHdma) { gb->memory.hdmaRemaining = ((value & 0x7F) + 1) * 0x10; gb->memory.hdmaNext = gb->cpu->cycles; gb->cpu->nextEvent = gb->cpu->cycles;