about summary refs log tree commit diff stats
path: root/gba/start
diff options
context:
space:
mode:
authorslipstream/RoL <l33twax@yahoo.com>2017-02-19 01:19:35 +0000
committerslipstream/RoL <l33twax@yahoo.com>2017-02-19 01:19:35 +0000
commitd4e309bb19b74c4b21ca19952c9b1cdd067c667a (patch)
tree36d4e67a43ab746135a18de3eef4edb09867b568 /gba/start
parent004575f7cec14946c1936aceca6efee38b7f8a74 (diff)
downloadgen3uploader-d4e309bb19b74c4b21ca19952c9b1cdd067c667a.tar.gz
gen3uploader-d4e309bb19b74c4b21ca19952c9b1cdd067c667a.tar.bz2
gen3uploader-d4e309bb19b74c4b21ca19952c9b1cdd067c667a.zip
Initial commit of the fork
Forking gba-link-cable-dumper to gba-gen3multiboot
Diffstat (limited to 'gba/start')
-rw-r--r--gba/start/pkjb_crt0.s98
1 files changed, 98 insertions, 0 deletions
diff --git a/gba/start/pkjb_crt0.s b/gba/start/pkjb_crt0.s new file mode 100644 index 0000000..1bf5bd7 --- /dev/null +++ b/gba/start/pkjb_crt0.s
@@ -0,0 +1,98 @@
1 .section ".init"
2 .global _start
3 .align
4 .arm
5@---------------------------------------------------------------------------------
6_start:
7@---------------------------------------------------------------------------------
8 b rom_header_end
9
10 .fill 156,1,0 @ Nintendo Logo Character Data (8000004h)
11 .fill 16,1,0 @ Game Title
12 .byte 0x30,0x31 @ Maker Code (80000B0h)
13 .byte 0x96 @ Fixed Value (80000B2h)
14 .byte 0x00 @ Main Unit Code (80000B3h)
15 .byte 0x00 @ Device Type (80000B4h)
16 .fill 7,1,0 @ unused
17 .byte 0x00 @ Software Version No (80000BCh)
18 .byte 0xf0 @ Complement Check (80000BDh)
19 .byte 0x00,0x00 @ Checksum (80000BEh)
20
21@---------------------------------------------------------------------------------
22rom_header_end:
23@---------------------------------------------------------------------------------
24 b start_vector @ This branch must be here for proper
25 @ positioning of the following header.
26
27 .GLOBAL __boot_method, __slave_number
28@---------------------------------------------------------------------------------
29__boot_method:
30@---------------------------------------------------------------------------------
31 .byte 0 @ boot method (0=ROM boot, 3=Multiplay boot)
32@---------------------------------------------------------------------------------
33__slave_number:
34@---------------------------------------------------------------------------------
35 .byte 0 @ slave # (1=slave#1, 2=slave#2, 3=slave#3)
36
37 .byte 0 @ reserved
38 .byte 0 @ reserved
39 .word 0 @ reserved
40 .word 0 @ reserved
41 .word 0 @ reserved
42 .word 0 @ reserved
43 .word 0 @ reserved
44 .word 0 @ reserved
45
46 .fill 4096,1,0 @ 4kb of filler so no useful code gets overwritten when flash bytes get copied over the top.
47 .global start_vector
48 .align
49@---------------------------------------------------------------------------------
50start_vector:
51@---------------------------------------------------------------------------------
52
53@---------------------------------------------------------------------------------
54@ Enter Thumb mode
55@---------------------------------------------------------------------------------
56 add r0, pc, #1
57 bx r0
58
59 .thumb
60@ Turn off sound
61 ldr r1, =0x4000084
62 eor r0, r0, r0
63 strh r0, [r1]
64
65@---------------------------------------------------------------------------------
66@ set heap end
67@---------------------------------------------------------------------------------
68 ldr r1, =fake_heap_end
69 ldr r0, =__eheap_end
70 str r0, [r1]
71@---------------------------------------------------------------------------------
72@ global constructors
73@---------------------------------------------------------------------------------
74 ldr r3, =__libc_init_array
75 push {lr}
76 bl _blx_r3_stub
77@---------------------------------------------------------------------------------
78@ Jump to user code
79@---------------------------------------------------------------------------------
80 mov r0, #0 @ int argc
81 mov r1, #0 @ char *argv[]
82 ldr r3, =main
83 bl _blx_r3_stub
84@; If we're here, turn the sound back on before we return
85 ldr r1, =0x4000084
86 mov r0, #0x8F
87 strh r0, [r1]
88 pop {pc}
89
90@---------------------------------------------------------------------------------
91_blx_r3_stub:
92@---------------------------------------------------------------------------------
93 bx r3
94
95 .align
96 .pool
97 .end
98