NWRAM & Direct Boot (#1149)

* SCFG_BIOS now selects between NDS and DSi BIOS
Allowing experimental direct boot.

* - making NWRAM Priorities work as in the HW
- fixed loading DSi stage2 Bootloader when in direct boot (should not be loaded) and might interfere with the image loaded into the (N)WRAM previously

* NWRAM and SCFG Registers are now write-guarded by the corresponding SCFG_EXT7/9 Bits

* removed debugging remainder

* Moved NDSHeader dependent SCFG initialization into the new DSi::SetupDirectBoot function called from NDS::SetupDirectBoot when ConsoleType is DSi

* removed redundant SCFG_BIOS bit checks

* Set of changes from RSDuck's review

* removed a forgotten comment

* - removed the guarded debug outputs for NWRAM
- NWRAM writes to bank and window registers now apply their write masks.
- added comment on an existing TODO within the code describing, why this is OK
- fixed initial NWRAM bank reset just accessing set A

* NWRAM not mapped to 03... range if bit25 in SCFG_EXT is cleared

* removed NWRAM write block on cleared bit25 in SCFG_EXT

* changed type of iterator for MapNWRAM_x functions from s8 to int

* - reduced calculations/comparisons on NWRAM write operations
- changed u8 to unsigned int for an iterator MapNWRAM_x

Co-authored-by: Tim Seidel <t.seidel@kts-systeme.de>
This commit is contained in:
DesperateProgrammer 2021-07-23 12:21:54 +02:00 committed by GitHub
parent a09ce44c48
commit b1c2665c39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 698 additions and 318 deletions

File diff suppressed because it is too large Load Diff

View File

@ -60,6 +60,7 @@ bool Init();
void DeInit(); void DeInit();
void Reset(); void Reset();
void SetupDirectBoot();
void SoftReset(); void SoftReset();
bool LoadBIOS(); bool LoadBIOS();

View File

@ -164,7 +164,6 @@ bool Running;
bool RunningGame; bool RunningGame;
void DivDone(u32 param); void DivDone(u32 param);
void SqrtDone(u32 param); void SqrtDone(u32 param);
void RunTimer(u32 tid, s32 cycles); void RunTimer(u32 tid, s32 cycles);
@ -342,8 +341,13 @@ void SetupDirectBoot()
{ {
if (ConsoleType == 1) if (ConsoleType == 1)
{ {
printf("!! DIRECT BOOT NOT SUPPORTED IN DSI MODE\n"); // With the BIOS select in SCFG_BIOS and the initialization od
return; // SCFG_BIOS depending on the Header->UnitType, we can now boot
// directly in the roms.
// There are some more SCFG Settings that change depending on
// the unit type, so this is experimental
printf("!! DIRECT BOOT NOT STABLE IN DSI MODE\n");
DSi::SetupDirectBoot();
} }
u32 bootparams[8]; u32 bootparams[8];