mirror of https://github.com/mgba-emu/mgba.git
GBA Memory: Fix DMA register writing behavior (fixes #148)
This commit is contained in:
parent
ec32efd8e4
commit
31862db5a5
2
CHANGES
2
CHANGES
|
@ -7,13 +7,13 @@ Features:
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
- Util: Fix PowerPC PNG read/write pixel order
|
- Util: Fix PowerPC PNG read/write pixel order
|
||||||
- Qt: Use safer isLoaded check in GameController
|
- Qt: Use safer isLoaded check in GameController
|
||||||
- GBA Memory: Fix DMAs from BIOS while not in BIOS
|
|
||||||
- GBA: Fix idle skip state being retained between games
|
- GBA: Fix idle skip state being retained between games
|
||||||
- Qt: Fix a race condition in PainterGL that could lead to a crash
|
- Qt: Fix a race condition in PainterGL that could lead to a crash
|
||||||
- Qt: Fix clear button/analog buttons in gamepad mapper on some platforms
|
- Qt: Fix clear button/analog buttons in gamepad mapper on some platforms
|
||||||
- GBA Video: Fix _mix for 15-bit color
|
- GBA Video: Fix _mix for 15-bit color
|
||||||
- VFS: Fix VFileReadline and remove _vfdReadline
|
- VFS: Fix VFileReadline and remove _vfdReadline
|
||||||
- Qt: Fix font size in memory viewer
|
- Qt: Fix font size in memory viewer
|
||||||
|
- GBA Memory: Fix DMA register writing behavior
|
||||||
Misc:
|
Misc:
|
||||||
- Qt: Window size command line options are now supported
|
- Qt: Window size command line options are now supported
|
||||||
- Qt: Increase usability of key mapper
|
- Qt: Increase usability of key mapper
|
||||||
|
|
16
src/gba/io.c
16
src/gba/io.c
|
@ -535,28 +535,28 @@ void GBAIOWrite32(struct GBA* gba, uint32_t address, uint32_t value) {
|
||||||
GBAAudioWriteFIFO(&gba->audio, address, value);
|
GBAAudioWriteFIFO(&gba->audio, address, value);
|
||||||
break;
|
break;
|
||||||
case REG_DMA0SAD_LO:
|
case REG_DMA0SAD_LO:
|
||||||
GBAMemoryWriteDMASAD(gba, 0, value);
|
value = GBAMemoryWriteDMASAD(gba, 0, value);
|
||||||
break;
|
break;
|
||||||
case REG_DMA0DAD_LO:
|
case REG_DMA0DAD_LO:
|
||||||
GBAMemoryWriteDMADAD(gba, 0, value);
|
value = GBAMemoryWriteDMADAD(gba, 0, value);
|
||||||
break;
|
break;
|
||||||
case REG_DMA1SAD_LO:
|
case REG_DMA1SAD_LO:
|
||||||
GBAMemoryWriteDMASAD(gba, 1, value);
|
value = GBAMemoryWriteDMASAD(gba, 1, value);
|
||||||
break;
|
break;
|
||||||
case REG_DMA1DAD_LO:
|
case REG_DMA1DAD_LO:
|
||||||
GBAMemoryWriteDMADAD(gba, 1, value);
|
value = GBAMemoryWriteDMADAD(gba, 1, value);
|
||||||
break;
|
break;
|
||||||
case REG_DMA2SAD_LO:
|
case REG_DMA2SAD_LO:
|
||||||
GBAMemoryWriteDMASAD(gba, 2, value);
|
value = GBAMemoryWriteDMASAD(gba, 2, value);
|
||||||
break;
|
break;
|
||||||
case REG_DMA2DAD_LO:
|
case REG_DMA2DAD_LO:
|
||||||
GBAMemoryWriteDMADAD(gba, 2, value);
|
value = GBAMemoryWriteDMADAD(gba, 2, value);
|
||||||
break;
|
break;
|
||||||
case REG_DMA3SAD_LO:
|
case REG_DMA3SAD_LO:
|
||||||
GBAMemoryWriteDMASAD(gba, 3, value);
|
value = GBAMemoryWriteDMASAD(gba, 3, value);
|
||||||
break;
|
break;
|
||||||
case REG_DMA3DAD_LO:
|
case REG_DMA3DAD_LO:
|
||||||
GBAMemoryWriteDMADAD(gba, 3, value);
|
value = GBAMemoryWriteDMADAD(gba, 3, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GBAIOWrite(gba, address, value & 0xFFFF);
|
GBAIOWrite(gba, address, value & 0xFFFF);
|
||||||
|
|
|
@ -330,13 +330,8 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
|
||||||
LOAD_32(value, address, memory->bios); \
|
LOAD_32(value, address, memory->bios); \
|
||||||
} else { \
|
} else { \
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load32: 0x%08X", address); \
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load32: 0x%08X", address); \
|
||||||
if (memory->activeDMA) { \
|
|
||||||
/* TODO: Test on hardware */ \
|
|
||||||
value = 0; \
|
|
||||||
} else { \
|
|
||||||
value = memory->biosPrefetch; \
|
value = memory->biosPrefetch; \
|
||||||
} \
|
} \
|
||||||
} \
|
|
||||||
} else { \
|
} else { \
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load32: 0x%08X", address); \
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load32: 0x%08X", address); \
|
||||||
LOAD_BAD; \
|
LOAD_BAD; \
|
||||||
|
@ -451,12 +446,8 @@ uint32_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
|
||||||
LOAD_16(value, address, memory->bios);
|
LOAD_16(value, address, memory->bios);
|
||||||
} else {
|
} else {
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load16: 0x%08X", address);
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load16: 0x%08X", address);
|
||||||
if (memory->activeDMA) {
|
|
||||||
value = 0;
|
|
||||||
} else {
|
|
||||||
value = (memory->biosPrefetch >> ((address & 2) * 8)) & 0xFFFF;
|
value = (memory->biosPrefetch >> ((address & 2) * 8)) & 0xFFFF;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load16: 0x%08X", address);
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load16: 0x%08X", address);
|
||||||
LOAD_BAD;
|
LOAD_BAD;
|
||||||
|
@ -1320,15 +1311,21 @@ void GBAAdjustWaitstates(struct GBA* gba, uint16_t parameters) {
|
||||||
cpu->memory.activeNonseqCycles16 = memory->waitstatesNonseq16[memory->activeRegion];
|
cpu->memory.activeNonseqCycles16 = memory->waitstatesNonseq16[memory->activeRegion];
|
||||||
}
|
}
|
||||||
|
|
||||||
void 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) {
|
||||||
memory->dma[dma].source = address & 0x0FFFFFFE;
|
memory->dma[dma].source = address & 0x0FFFFFFE;
|
||||||
}
|
}
|
||||||
|
return memory->dma[dma].source;
|
||||||
|
}
|
||||||
|
|
||||||
void 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) {
|
||||||
memory->dma[dma].dest = address & 0x0FFFFFFE;
|
memory->dma[dma].dest = address & 0x0FFFFFFE;
|
||||||
}
|
}
|
||||||
|
return memory->dma[dma].dest;
|
||||||
|
}
|
||||||
|
|
||||||
void GBAMemoryWriteDMACNT_LO(struct GBA* gba, int dma, uint16_t count) {
|
void GBAMemoryWriteDMACNT_LO(struct GBA* gba, int dma, uint16_t count) {
|
||||||
struct GBAMemory* memory = &gba->memory;
|
struct GBAMemory* memory = &gba->memory;
|
||||||
|
|
|
@ -166,8 +166,8 @@ uint32_t GBAStoreMultiple(struct ARMCore*, uint32_t baseAddress, int mask, enum
|
||||||
|
|
||||||
void GBAAdjustWaitstates(struct GBA* gba, uint16_t parameters);
|
void GBAAdjustWaitstates(struct GBA* gba, uint16_t parameters);
|
||||||
|
|
||||||
void GBAMemoryWriteDMASAD(struct GBA* gba, int dma, uint32_t address);
|
uint32_t GBAMemoryWriteDMASAD(struct GBA* gba, int dma, uint32_t address);
|
||||||
void GBAMemoryWriteDMADAD(struct GBA* gba, int dma, uint32_t address);
|
uint32_t GBAMemoryWriteDMADAD(struct GBA* gba, int dma, uint32_t address);
|
||||||
void GBAMemoryWriteDMACNT_LO(struct GBA* gba, int dma, uint16_t count);
|
void GBAMemoryWriteDMACNT_LO(struct GBA* gba, int dma, uint16_t count);
|
||||||
uint16_t GBAMemoryWriteDMACNT_HI(struct GBA* gba, int dma, uint16_t control);
|
uint16_t GBAMemoryWriteDMACNT_HI(struct GBA* gba, int dma, uint16_t control);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue