GBA Memory: Fix DMA addresses

This commit is contained in:
Jeffrey Pfau 2015-11-05 20:59:16 -08:00
parent 2b5b8a0d6a
commit f1816279a5
1 changed files with 6 additions and 4 deletions
src/gba

View File

@ -1313,16 +1313,18 @@ void GBAAdjustWaitstates(struct GBA* gba, uint16_t parameters) {
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;
}