all repos — mgba @ 5d8f676bb0c51fba3fa4073ec033f4c25428a886

mGBA Game Boy Advance Emulator

GB Memory: Bypass GBStore8 for DMA
Jeffrey Pfau jeffrey@endrift.com
Wed, 27 Jan 2016 23:25:36 -0800
commit

5d8f676bb0c51fba3fa4073ec033f4c25428a886

parent

1589b26ade442d1779ac339ca1e1b56b17fede27

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

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

@@ -260,13 +260,15 @@ if (gb->memory.dmaNext < gb->cpu->nextEvent) {

gb->cpu->nextEvent = gb->memory.dmaNext; } gb->memory.dmaSource = base; - gb->memory.dmaDest = GB_BASE_OAM; + gb->memory.dmaDest = 0; gb->memory.dmaRemaining = 0xA0; } void _GBMemoryDMAService(struct GB* gb) { uint8_t b = GBLoad8(gb->cpu, gb->memory.dmaSource); - GBStore8(gb->cpu, gb->memory.dmaDest, b); + // TODO: Can DMA write OAM during modes 2-3? + gb->video.oam.raw[gb->memory.dmaDest] = b; + gb->video.renderer->writeOAM(gb->video.renderer, gb->memory.dmaDest); ++gb->memory.dmaSource; ++gb->memory.dmaDest; --gb->memory.dmaRemaining;