GBA BIOS: Implement Diff8bitUnFilterVram
Jeffrey Pfau jeffrey@endrift.com
Wed, 07 Jan 2015 21:43:21 -0800
2 files changed,
18 insertions(+),
12 deletions(-)
M
CHANGES
→
CHANGES
@@ -14,7 +14,7 @@ - Game Pak overrides dialog for setting savetype and sensor values
- Support for games using the tilt sensor - Remappable shortcuts for keyboard and gamepad - Rewinding of emulation - - Implemented BIOS routines Diff8bitUnFilterWram, and Diff16bitUnFilter + - Implemented BIOS routines Diff8bitUnFilterWram, Diff8bitUnFilterVram, and Diff16bitUnFilter Bugfixes: - Qt: Fix issue with set frame sizes being the wrong height - Qt: Fix emulator crashing when full screen if a game is not running
M
src/gba/gba-bios.c
→
src/gba/gba-bios.c
@@ -477,26 +477,32 @@ uint16_t halfword = 0;
uint16_t old = 0; source += 4; while (remaining > 0) { + uint16_t new; if (inwidth == 1) { - halfword = cpu->memory.loadU8(cpu, source, 0); + new = cpu->memory.loadU8(cpu, source, 0); } else { - halfword = cpu->memory.loadU16(cpu, source, 0); + new = cpu->memory.loadU16(cpu, source, 0); } - halfword += old; + new += old; if (outwidth > inwidth) { - GBALog(gba, GBA_LOG_STUB, "Unimplemented Diff8bitUnFilterVram"); - } else { - if (outwidth == 1) { - halfword &= 0xFF; - cpu->memory.store8(cpu, dest, halfword, 0); - } else { + halfword >>= 8; + halfword |= (new << 8); + if (source & 1) { cpu->memory.store16(cpu, dest, halfword, 0); + dest += outwidth; + remaining -= outwidth; } - old = halfword; + } else if (outwidth == 1) { + cpu->memory.store8(cpu, dest, new, 0); dest += outwidth; + remaining -= outwidth; + } else { + cpu->memory.store16(cpu, dest, new, 0); + dest += outwidth; + remaining -= outwidth; } + old = new; source += inwidth; - remaining -= outwidth; } cpu->gprs[0] = source; cpu->gprs[1] = dest;