boot processors into thumb mode correctly; fixes some games that hang immediately after loading

This commit is contained in:
zeromus 2013-09-02 20:42:28 +00:00
parent 7d359a2be5
commit 8d45169345
3 changed files with 21 additions and 25 deletions

View File

@ -2582,7 +2582,7 @@ bool NDS_FakeBoot()
_MMU_write32<ARMCPU_ARM9>(0x027FFE00+i*4, LE_TO_LOCAL_32(((u32*)MMU.CART_ROM)[i]));
}
//firmware sets the cpus to an initial state with their respective programs entrypoints
//the firmware will be booting to these entrypoint addresses via BX (well, the arm9 at least; is unverified for the arm7)
armcpu_init(&NDS_ARM7, header->ARM7exe);
armcpu_init(&NDS_ARM9, header->ARM9exe);
@ -2618,11 +2618,6 @@ bool NDS_FakeBoot()
TSCal.scr.width = (TSCal.scr.x2 - TSCal.scr.x1);
TSCal.scr.height = (TSCal.scr.y2 - TSCal.scr.y1);
//zero 11-aug-2013 - dont think we need this. the emulator will be setting these nonstop
//_MMU_write16<ARMCPU_ARM9>(REG_KEYINPUT, 0x3FF);
//_MMU_write16<ARMCPU_ARM7>(REG_KEYINPUT, 0x3FF);
//_MMU_write08<ARMCPU_ARM7>(REG_EXTKEYIN, 0x43);
//bitbox 4k demo is so stripped down it relies on default stack values
//otherwise the arm7 will crash before making a sound
//(these according to gbatek softreset bios docs)
@ -2655,7 +2650,10 @@ bool NDS_FakeBoot()
const u32 kCommandline = 0x027E0000;
//const u32 kCommandline = 0x027FFF84;
//
//homebrew-related stuff.
//its safe to put things in this position.. apparently nothing important is here.
//however, some games could be checking them as an anti-desmume measure, so we might have to control it with slot-1 settings to suggest booting a homebrew app
//perhaps we could automatically boot homebrew to an R4-like device.
_MMU_write32<ARMCPU_ARM9>(0x02FFFE70, 0x5f617267);
_MMU_write32<ARMCPU_ARM9>(0x02FFFE74, kCommandline); //(commandline starts here)
_MMU_write32<ARMCPU_ARM9>(0x02FFFE78, rompath.size()+1);

View File

@ -171,7 +171,7 @@ void armcpu_init(armcpu_t *armcpu, u32 adr)
memcpy(&armcpu->cond_table[0], &arm_cond_table[0], sizeof(arm_cond_table));
#endif
armcpu->LDTBit = (armcpu->proc_ID==0); //Si ARM9 utiliser le syte v5 pour le load
armcpu->LDTBit = (armcpu->proc_ID==0); //set ARMv5 style bit--different for each processor
armcpu->intVector = 0xFFFF0000 * (armcpu->proc_ID==0);
armcpu->waitIRQ = FALSE;
armcpu->halt_IE_and_IF = FALSE;
@ -202,7 +202,9 @@ void armcpu_init(armcpu_t *armcpu, u32 adr)
//armcpu->R[15] = adr;
//#endif
armcpu->next_instruction = adr;
//do something sensible when booting up to a thumb address
armcpu->next_instruction = adr & ~1;
armcpu->CPSR.bits.T = BIT0(adr);
//#ifndef GDB_STUB
armcpu_prefetch(armcpu);

View File

@ -685,14 +685,6 @@
RelativePath=".\disView.h"
>
</File>
<File
RelativePath=".\fsnitroView.cpp"
>
</File>
<File
RelativePath=".\fsnitroView.h"
>
</File>
<File
RelativePath=".\FEX_Interface.cpp"
>
@ -705,6 +697,14 @@
RelativePath=".\FirmConfig.h"
>
</File>
<File
RelativePath=".\fsnitroView.cpp"
>
</File>
<File
RelativePath=".\fsnitroView.h"
>
</File>
<File
RelativePath=".\gbaslot_config.cpp"
>
@ -1593,6 +1593,10 @@
RelativePath="..\utils\emufat.h"
>
</File>
<File
RelativePath="..\utils\emufat_types.h"
>
</File>
<File
RelativePath="..\utils\fsnitro.cpp"
>
@ -1601,10 +1605,6 @@
RelativePath="..\utils\fsnitro.h"
>
</File>
<File
RelativePath="..\utils\emufat_types.h"
>
</File>
<File
RelativePath="..\utils\guid.cpp"
>
@ -2520,10 +2520,6 @@
RelativePath="..\arm_instructions.cpp"
>
</File>
<File
RelativePath="..\arm_instructions.h"
>
</File>
<File
RelativePath="..\arm_jit.cpp"
>