gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Resetting the GBA

#824 - darkcloud - Fri Jan 10, 2003 10:35 pm

Is there a way to reset the GBA in code?
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.

#826 - Vortex - Fri Jan 10, 2003 10:44 pm

From the GBATEK Documentation:

Quote:

BIOS Reset Functions

SoftReset
RegisterRamReset

SWI 0 - SoftReset
Clears the CPU internal RAM area from 3007E00h-3007FFFh, initializes system, supervisor, and irq stack pointers, and sets R0-R12 to zero, and enters system mode.
[3007FFAh] Return Address Select (00h for 8000000h, 01h-FFh for 2000000h)


Return: Does not return to calling procedure, instead, jumps to 8000000h (ROM) or 2000000h (WRAM), in ARM state.

SWI 1 - RegisterRamReset
Resets the I/O registers and RAM specified in ResetFlags. However, it does not clear the CPU internal RAM area from 3007E00h-3007FFFh.
r0 ResetFlags
Bit Expl.
0 Clear 256K on-board WRAM ;-don't use when returning to WRAM
1 Clear 32K in-chip WRAM ;-excluding last 200h bytes
2 Clear Palette
3 Clear VRAM
4 Clear OAM ;-zerofilled! does NOT disable OBJs!
5 Reset SIO registers ;-switches to general purpose mode!
6 Reset Sound registers
7 Reset all other registers (except SIO, Sound)


Return: No return value.
Bug: LSBs of SIODATA32 are always destroyed, even if Bit5 of R0 was cleared.
The function always switches the screen into forced blank by setting DISPCNT=0080h (regardless of incoming R0, screen becomes white).

#1366 - Gordon - Fri Jan 17, 2003 4:27 am

darkcloud wrote:
Is there a way to reset the GBA in code?

Add the following Codes.

Code:
void softReset() {
                asm volatile("swi 0x00000"); // 0x00 Soft Reset
         }


Note:
Modify the [ Bios Interrrup number ] and append 4 zeros after that.
for every bios call .

Format:
SWI 0x[Bios Interrupt number]0000

Bye now!
Gordon

[/code]