1
@---------------------------------------------------------------------------------
4
@---------------------------------------------------------------------------------
7
@---------------------------------------------------------------------------------
9
@---------------------------------------------------------------------------------
10
mov r0, #0x04000000 @ IME = 0;
13
mov r0, #0x12 @ Switch to IRQ Mode
15
ldr sp, =__sp_irq @ Set IRQ stack
17
mov r0, #0x13 @ Switch to SVC Mode
19
ldr sp, =__sp_svc @ Set SVC stack
21
mov r0, #0x1F @ Switch to System Mode
23
ldr sp, =__sp_usr @ Set user stack
25
ldr r0, =__bss_start @ Clear BSS section to 0x00
31
mov r1, #0 @ char *argv[]
36
@ If the user ever returns, return to flash cartridge
40
@---------------------------------------------------------------------------------
41
@ Clear memory to 0x00 if length != 0
44
@---------------------------------------------------------------------------------
46
@---------------------------------------------------------------------------------
47
mov r2, #3 @ Round down to nearest word boundary
48
add r1, r1, r2 @ Shouldn't be needed
49
bics r1, r1, r2 @ Clear 2 LSB (and set Z)
50
bxeq lr @ Quit if copy size is 0
59
@---------------------------------------------------------------------------------
60
@ Copy memory if length != 0
63
@ r4 = Dest Address + Length
64
@---------------------------------------------------------------------------------
66
@---------------------------------------------------------------------------------
67
sub r3, r4, r2 @ Is there any data to copy?
68
@---------------------------------------------------------------------------------
73
@---------------------------------------------------------------------------------
75
@---------------------------------------------------------------------------------
76
mov r0, #3 @ These commands are used in cases where
77
add r3, r3, r0 @ the length is not a multiple of 4,
78
bics r3, r3, r0 @ even though it should be.
79
bxeq lr @ Length is zero, so exit
87
@---------------------------------------------------------------------------------
91
@---------------------------------------------------------------------------------