all repos — mgba @ afc0a9df57907264fb7526ba9065c9e1cf944022

mGBA Game Boy Advance Emulator

GBA BIOS: Implement (most of) RegisterRamReset
Jeffrey Pfau jeffrey@endrift.com
Wed, 07 Jan 2015 22:18:08 -0800
commit

afc0a9df57907264fb7526ba9065c9e1cf944022

parent

600080ba0c3286dc7d3cf5e3dce65afe344674d9

2 files changed, 27 insertions(+), 3 deletions(-)

jump to
M CHANGESCHANGES

@@ -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, Diff8bitUnFilterVram, and Diff16bitUnFilter + - Implemented BIOS routines RegisterRamReset, 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.csrc/gba/gba-bios.c

@@ -19,8 +19,32 @@ static void _unFilter(struct GBA* gba, int inwidth, int outwidth);

static void _RegisterRamReset(struct GBA* gba) { uint32_t registers = gba->cpu->gprs[0]; - UNUSED(registers); - GBALog(gba, GBA_LOG_STUB, "RegisterRamReset unimplemented"); + struct ARMCore* cpu = gba->cpu; + cpu->memory.store16(cpu, BASE_IO | REG_DISPCNT, 0x0080, 0); + if (registers & 0x01) { + memset(gba->memory.wram, 0, SIZE_WORKING_RAM); + } + if (registers & 0x02) { + memset(gba->memory.iwram, 0, SIZE_WORKING_IRAM - 0x200); + } + if (registers & 0x04) { + memset(gba->video.palette, 0, SIZE_PALETTE_RAM); + } + if (registers & 0x08) { + memset(gba->video.renderer->vram, 0, SIZE_VRAM); + } + if (registers & 0x10) { + memset(gba->video.oam.raw, 0, SIZE_OAM); + } + if (registers & 0x20) { + GBALog(gba, GBA_LOG_STUB, "RegisterRamReset on SIO unimplemented"); + } + if (registers & 0x40) { + GBALog(gba, GBA_LOG_STUB, "RegisterRamReset on Audio unimplemented"); + } + if (registers & 0x80) { + GBALog(gba, GBA_LOG_STUB, "RegisterRamReset on IO unimplemented"); + } } static void _BgAffineSet(struct GBA* gba) {