mirror of https://github.com/mgba-emu/mgba.git
GB: Fix some memory errors in reset
This commit is contained in:
parent
af96ee7087
commit
4b43a88ebd
|
@ -195,6 +195,7 @@ void GBReset(struct LR35902Core* cpu) {
|
||||||
cpu->d = 0;
|
cpu->d = 0;
|
||||||
cpu->sp = 0xFFFE;
|
cpu->sp = 0xFFFE;
|
||||||
cpu->pc = 0x100;
|
cpu->pc = 0x100;
|
||||||
|
cpu->memory.setActiveRegion(cpu, cpu->pc);
|
||||||
|
|
||||||
if (gb->yankedRomSize) {
|
if (gb->yankedRomSize) {
|
||||||
gb->memory.romSize = gb->yankedRomSize;
|
gb->memory.romSize = gb->yankedRomSize;
|
||||||
|
|
|
@ -134,6 +134,7 @@ void GBMemoryReset(struct GB* gb) {
|
||||||
memset(&gb->memory.rtcRegs, 0, sizeof(gb->memory.rtcRegs));
|
memset(&gb->memory.rtcRegs, 0, sizeof(gb->memory.rtcRegs));
|
||||||
|
|
||||||
memset(&gb->memory.hram, 0, sizeof(gb->memory.hram));
|
memset(&gb->memory.hram, 0, sizeof(gb->memory.hram));
|
||||||
|
memset(&gb->memory.mbcState, 0, sizeof(gb->memory.mbcState));
|
||||||
|
|
||||||
const struct GBCartridge* cart = (const struct GBCartridge*) &gb->memory.rom[0x100];
|
const struct GBCartridge* cart = (const struct GBCartridge*) &gb->memory.rom[0x100];
|
||||||
switch (cart->type) {
|
switch (cart->type) {
|
||||||
|
@ -183,7 +184,6 @@ void GBMemoryReset(struct GB* gb) {
|
||||||
case 0x22:
|
case 0x22:
|
||||||
gb->memory.mbc = _GBMBC7;
|
gb->memory.mbc = _GBMBC7;
|
||||||
gb->memory.mbcType = GB_MBC7;
|
gb->memory.mbcType = GB_MBC7;
|
||||||
memset(&gb->memory.mbcState.mbc7, 0, sizeof(gb->memory.mbcState.mbc7));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue