all repos — mgba @ 526a9ce44665cfda05b8d33e03449d9e419c3aa8

mGBA Game Boy Advance Emulator

GB Video: Add HDMA
Jeffrey Pfau jeffrey@endrift.com
Wed, 17 Feb 2016 20:00:23 -0800
commit

526a9ce44665cfda05b8d33e03449d9e419c3aa8

parent

371f6913e7570a5cede360262f1e04bc1ef46435

2 files changed, 9 insertions(+), 1 deletions(-)

jump to
M src/gb/memory.csrc/gb/memory.c

@@ -340,7 +340,11 @@ gb->cpu->cycles += 2;

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; + } } }
M src/gb/video.csrc/gb/video.c

@@ -178,6 +178,10 @@ if (GBRegisterSTATIsHblankIRQ(video->stat)) {

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