GB Memory: Bypass GBStore8 for DMA
Jeffrey Pfau jeffrey@endrift.com
Wed, 27 Jan 2016 23:25:36 -0800
1 files changed,
4 insertions(+),
2 deletions(-)
jump to
M
src/gb/memory.c
→
src/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;