GBA-Exploader/arm7/source/ret_menu7_mse.c
ApacheThunder 11ea610150 Fix fifo ...
* FIFO on arm7 appears to now work as intended.
* GBA mode switch funcition remains broken.
* Default GBA_Exploader.ini file now created if one is not present.
* Moved GBA_File struct to ctrl_tble and removed duplicate from main.c.
This was causing issues where I would forget to update both when I
removed the now unused Alias char array. All code now shares the single
instance which will prevent this issue should this struct need to be
updated in the future.
2024-05-08 15:24:51 -05:00

51 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/***********************************************************
Arm7 Soft rest for reset.mse
by Rudolph (<28>cé)
***************************************************************/
#include <nds.h>
//#include <nds/registers_alt.h> // devkitPror20
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SOUND_CR REG_SOUNDCNT
void ret_menu7_mse() {
u32 i;
while(*((vu32*)0x027FFDFC) != 0x06000000) { // Timing adjustment with ARM9
vu32 w;
for(w=0;w<0x100;w++);
}
REG_IME = IME_DISABLE; // Disable interrupts
REG_IF = REG_IF; // Acknowledge interrupt
for (i = 0x04000400; i < 0x04000500; i+=4)*((u32*)i) = 0;
SOUND_CR = 0;
for(i = 0x040000B0; i < (0x040000B0+0x30); i+=4)*((vu32*)i) = 0;
for(i = 0x04000100; i < 0x04000110; i+=2)*((u16*)i) = 0;
//switch to user mode
asm("mov r0, #0x1F");
asm("msr cpsr, r0");
REG_IE = 0;
REG_IF = ~0;
(*(vu32*)(0x04000000-4)) = 0; //IRQ_HANDLER ARM7 version
(*(vu32*)(0x04000000-8)) = ~0; //VBLANK_INTR_WAIT_FLAGS, ARM7 version
REG_POWERCNT = 1; //turn off power to stuffs
*((vu32*)0x027FFE34) = *((vu32*)0x027FFDFC); // Bootloader start address
// asm("swi 0x00"); // JUMP 0x027FFE34
swiSoftReset();
while(1);
}