all repos — mgba @ 6fe43d1d4cfc7c15046e8a7df3354df272e97f4d

mGBA Game Boy Advance Emulator

GBA BIOS: Finish implementing RegisterRamReset
Jeffrey Pfau jeffrey@endrift.com
Sat, 23 Jan 2016 19:50:31 -0800
commit

6fe43d1d4cfc7c15046e8a7df3354df272e97f4d

parent

3d996caf533cd55badf30f328f1a1f5fb72d450f

3 files changed, 89 insertions(+), 3 deletions(-)

jump to
M CHANGESCHANGES

@@ -63,6 +63,7 @@ - GBA RR: Add support for resets in movies

- GBA Input: Consolidate GBA_KEY_NONE and GBA_NO_MAPPING - Debugger: Convert breakpoints and watchpoints from linked-lists to vectors - Qt: Added button for breaking into the GDB debugger + - GBA BIOS: Finish implementing RegisterRamReset 0.3.2: (2015-12-16) Bugfixes:
M README.mdREADME.md

@@ -125,7 +125,6 @@ <a name="missing">[1]</a> Currently missing features are

- OBJ window for modes 3, 4 and 5 ([Bug #5](http://mgba.io/b/5)) - Mosaic for transformed OBJs ([Bug #9](http://mgba.io/b/9)) -- BIOS call RegisterRamReset is partially stubbed out ([Bug #141](http://mgba.io/b/141)) <a name="flashdetect">[2]</a> Flash memory size detection does not work in some cases. These can be configured at runtime, but filing a bug is recommended if such a case is encountered.
M src/gba/bios.csrc/gba/bios.c

@@ -71,10 +71,96 @@ cpu->memory.store32(cpu, BASE_IO | REG_JOY_RECV, 0, 0);

cpu->memory.store32(cpu, BASE_IO | REG_JOY_TRANS, 0, 0); } if (registers & 0x40) { - GBALog(gba, GBA_LOG_STUB, "RegisterRamReset on Audio unimplemented"); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND1CNT_LO, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND1CNT_HI, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND1CNT_X, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND2CNT_LO, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND2CNT_HI, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND3CNT_LO, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND3CNT_HI, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND3CNT_X, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND4CNT_LO, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUND4CNT_HI, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUNDCNT_LO, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUNDCNT_HI, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUNDCNT_X, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_SOUNDBIAS, 0x200, 0); + memset(gba->audio.ch3.wavedata, 0, sizeof(gba->audio.ch3.wavedata)); } if (registers & 0x80) { - GBALog(gba, GBA_LOG_STUB, "RegisterRamReset on IO unimplemented"); + cpu->memory.store16(cpu, BASE_IO | 0x00, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x04, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x06, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x08, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x0A, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x0C, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x0E, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x10, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x12, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x14, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x16, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x18, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x1A, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x1C, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x1E, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_BG2PA, 0x100, 0); + cpu->memory.store16(cpu, BASE_IO | REG_BG2PB, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_BG2PC, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_BG2PD, 0x100, 0); + cpu->memory.store32(cpu, BASE_IO | 0x28, 0, 0); + cpu->memory.store32(cpu, BASE_IO | 0x2C, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_BG3PA, 0x100, 0); + cpu->memory.store16(cpu, BASE_IO | REG_BG3PB, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_BG3PC, 0, 0); + cpu->memory.store16(cpu, BASE_IO | REG_BG3PD, 0x100, 0); + cpu->memory.store32(cpu, BASE_IO | 0x38, 0, 0); + cpu->memory.store32(cpu, BASE_IO | 0x3C, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x40, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x42, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x44, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x46, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x48, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x4A, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x4C, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x50, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x52, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x54, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xB0, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xB2, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xB4, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xB6, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xB8, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xBA, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xBC, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xBE, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xC0, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xC2, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xC4, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xC6, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xC8, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xCA, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xCC, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xCE, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xD0, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xD2, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xD4, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xD6, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xD8, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xDA, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xDC, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0xDE, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x100, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x102, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x104, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x106, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x108, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x10A, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x10C, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x10E, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x200, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x202, 0xFFFF, 0); + cpu->memory.store16(cpu, BASE_IO | 0x204, 0, 0); + cpu->memory.store16(cpu, BASE_IO | 0x208, 0, 0); } }