all repos — mgba @ f1816279a57555d2b8ca4ad1b4c28c0a21576c37

mGBA Game Boy Advance Emulator

GBA Memory: Fix DMA addresses
Jeffrey Pfau jeffrey@endrift.com
Thu, 05 Nov 2015 20:59:16 -0800
commit

f1816279a57555d2b8ca4ad1b4c28c0a21576c37

parent

2b5b8a0d6a29c233ac1f3ce664f57ddc3dfb19b4

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

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

@@ -1313,16 +1313,18 @@ }

uint32_t GBAMemoryWriteDMASAD(struct GBA* gba, int dma, uint32_t address) { struct GBAMemory* memory = &gba->memory; - if ((dma >= 1 || address < BASE_CART0) && address >= BASE_WORKING_RAM && address < BASE_CART_SRAM) { - memory->dma[dma].source = address & 0x0FFFFFFE; + address &= 0x0FFFFFFE; + if ((dma > 0 || address < BASE_CART0) && address >= BASE_WORKING_RAM && address < BASE_CART_SRAM) { + memory->dma[dma].source = address; } return memory->dma[dma].source; } uint32_t GBAMemoryWriteDMADAD(struct GBA* gba, int dma, uint32_t address) { struct GBAMemory* memory = &gba->memory; - if ((dma >= 1 || address < BASE_CART0) && address >= BASE_WORKING_RAM && address < BASE_CART_SRAM) { - memory->dma[dma].dest = address & 0x0FFFFFFE; + address &= 0x0FFFFFFE; + if ((dma > 2 || address < BASE_CART0) && address >= BASE_WORKING_RAM && address < BASE_CART_SRAM) { + memory->dma[dma].dest = address; } return memory->dma[dma].dest; }