mirror of https://github.com/mgba-emu/mgba.git
GBA Memory: Fix DMA addresses
This commit is contained in:
parent
2b5b8a0d6a
commit
f1816279a5
|
@ -1313,16 +1313,18 @@ void GBAAdjustWaitstates(struct GBA* gba, uint16_t parameters) {
|
||||||
|
|
||||||
uint32_t GBAMemoryWriteDMASAD(struct GBA* gba, int dma, uint32_t address) {
|
uint32_t GBAMemoryWriteDMASAD(struct GBA* gba, int dma, uint32_t address) {
|
||||||
struct GBAMemory* memory = &gba->memory;
|
struct GBAMemory* memory = &gba->memory;
|
||||||
if ((dma >= 1 || address < BASE_CART0) && address >= BASE_WORKING_RAM && address < BASE_CART_SRAM) {
|
address &= 0x0FFFFFFE;
|
||||||
memory->dma[dma].source = 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;
|
return memory->dma[dma].source;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GBAMemoryWriteDMADAD(struct GBA* gba, int dma, uint32_t address) {
|
uint32_t GBAMemoryWriteDMADAD(struct GBA* gba, int dma, uint32_t address) {
|
||||||
struct GBAMemory* memory = &gba->memory;
|
struct GBAMemory* memory = &gba->memory;
|
||||||
if ((dma >= 1 || address < BASE_CART0) && address >= BASE_WORKING_RAM && address < BASE_CART_SRAM) {
|
address &= 0x0FFFFFFE;
|
||||||
memory->dma[dma].dest = 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;
|
return memory->dma[dma].dest;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue