GBA BIOS: Finish implementing RegisterRamReset

This commit is contained in:
Jeffrey Pfau 2016-01-23 19:50:31 -08:00
parent 3d996caf53
commit 6fe43d1d4c
3 changed files with 89 additions and 3 deletions

View File

@ -63,6 +63,7 @@ Misc:
- 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:

View File

@ -125,7 +125,6 @@ Footnotes
- 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.

View File

@ -71,10 +71,96 @@ static void _RegisterRamReset(struct GBA* gba) {
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);
}
}