Nintendo GAME BOY ADVANCE Programming Manual page 167

Hide thumbs Also See for GAME BOY ADVANCE:
Table of Contents

Advertisement

May 25, 2005
17 Game Boy Advance System Calls
Please refer to the
 AGB System Call Ref erence Manual 
17.1
System Call Operation
17.1.1
Normal Calls
1. When an argument is required for the system call used, after writing to registers R0-R3 call the monitor
ROM system call with the "SWI<Number>". The CPU mode changes to Supervisor Mode.
2. Save the registers, SPSR_svc (formerly CPSR), R 11, R12, LR_svc (formerly PC) to the system call
stack with the monitor ROM.
USR Stack
03007F00
3. Switch from CPU mode to system mode. Call the IRQ disable flag with monitor ROM. The previous
status will continue.
4. Save the R2 and LR_usr registers to the user stack. Other registers will be saved with each system
call.
USR Stack
03007F00
LR_usr 
R2
Save with each
System Call
5. Complete processing using each system call.
USR Stack
03007F00
6. Return value to registers R0, R1, and R3, in cases where a system call provides a return value, and
then return to the user program.
USR Stack
03007F00
© 1999-2005 NINTENDO
  for Game Boy Advance system calls.
IRQ Stack
03007FA0
SP_usr
03007F00
IRQ Stack
03007FA0
SP_usr 
03007F00
IRQ Stack
03007FA0
SP_usr
03007F00
IRQ Stack
03007FA0
SP_usr
03007F00
SVC Stack
03007FE0
SP_irq
4 WORDS
03007FA0
SVC Stack
03007FE0
SP_irq
4 WORDS
03007FA0
SVC Stack
03007FE0
SP_irq
4 WORDS
03007FA0
SVC Stack
03007FE0
SP_irq
03007FA0
AGB-06-0001-002-B13
Released: May 27, 2005
145
SP_svc
SP_svc
SP_svc
SP_svc

Advertisement

Table of Contents
loading

Table of Contents