GB Memory: Clearing the HDMA bit disabled HDMA

This commit is contained in:
Jeffrey Pfau 2016-02-20 13:57:16 -08:00
parent b8ed859c21
commit a260b4cf91
1 changed files with 2 additions and 1 deletions

View File

@ -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;