GBA Memory: Fix alignment of open bus 8- and 16-bit loads

This commit is contained in:
Jeffrey Pfau 2015-01-15 01:10:54 -08:00
parent 1119d773e1
commit 06bf931b77
2 changed files with 11 additions and 10 deletions

View File

@ -57,6 +57,7 @@ Bugfixes:
- GBA Memory: Fix initial DMA state
- GBA BIOS: Fix BIOS prefetch after returning from an IRQ
- GBA BIOS: Fix BIOS prefetch after reset
- GBA Memory: Fix alignment of open bus 8- and 16-bit loads
Misc:
- Qt: Disable sync to video by default
- GBA: Exit cleanly on FATAL if the port supports it

View File

@ -297,14 +297,14 @@ uint32_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
LOAD_16(value, address, memory->bios);
} else {
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load16: 0x%08X", address);
value = memory->biosPrefetch & 0xFFFF;
LOAD_16(value, address & 2, &memory->biosPrefetch);
}
} else {
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load16: 0x%08X", address);
if (cpu->cycles >= cpu->nextEvent) {
value = gba->bus & 0xFFFF;
LOAD_16(value, address & 2, &gba->bus);
} else {
value = cpu->prefetch[1] & 0xFFFF;
LOAD_16(value, address & 2, &cpu->prefetch[1]);
}
}
break;
@ -364,9 +364,9 @@ uint32_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
default:
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load16: 0x%08X", address);
if (cpu->cycles >= cpu->nextEvent) {
value = gba->bus;
LOAD_16(value, address & 2, &gba->bus);
} else {
value = cpu->prefetch[1];
LOAD_16(value, address & 2, &cpu->prefetch[1]);
}
break;
}
@ -392,14 +392,14 @@ uint32_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
value = ((int8_t*) memory->bios)[address];
} else {
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load8: 0x%08X", address);
value = memory->biosPrefetch;
value = ((uint8_t*) &memory->biosPrefetch)[address & 3];
}
} else {
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load8: 0x%08x", address);
if (cpu->cycles >= cpu->nextEvent) {
value = gba->bus;
value = ((uint8_t*) &gba->bus)[address & 3];
} else {
value = cpu->prefetch[1];
value = ((uint8_t*) &cpu->prefetch[1])[address & 3];
}
}
break;
@ -461,9 +461,9 @@ uint32_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
default:
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load8: 0x%08x", address);
if (cpu->cycles >= cpu->nextEvent) {
value = gba->bus;
value = ((uint8_t*) &gba->bus)[address & 3];
} else {
value = cpu->prefetch[1];
value = ((uint8_t*) &cpu->prefetch[1])[address & 3];
}
break;
}