GB Video: Add HDMA

This commit is contained in:
Jeffrey Pfau 2016-02-17 20:00:23 -08:00
parent 371f6913e7
commit 526a9ce446
2 changed files with 9 additions and 1 deletions

View File

@ -340,7 +340,11 @@ void _GBMemoryHDMAService(struct GB* gb) {
if (gb->memory.hdmaRemaining) {
gb->memory.hdmaNext += 2;
} else {
gb->memory.io[REG_HDMA5] |= 0x80;
if (gb->memory.isHdma) {
--gb->memory.io[REG_HDMA5];
} else {
gb->memory.io[REG_HDMA5] |= 0x80;
}
}
}

View File

@ -178,6 +178,10 @@ int32_t GBVideoProcessEvents(struct GBVideo* video, int32_t cycles) {
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
GBUpdateIRQs(video->p);
}
if (video->ly < GB_VIDEO_VERTICAL_PIXELS && video->p->memory.isHdma && video->p->memory.io[REG_HDMA5] != 0xFF) {
video->p->memory.hdmaRemaining = 0x10;
video->p->memory.hdmaNext = video->p->cpu->cycles;
}
break;
}
video->stat = GBRegisterSTATSetMode(video->stat, video->mode);