-
Notifications
You must be signed in to change notification settings - Fork 0
/
gba.s
96 lines (48 loc) · 1.27 KB
/
gba.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.section ".init"
.align
.arm
header: b multiboot
.fill 0x9C, 0x01, 0x00 @ Nintendo Logo Character Data
.fill 0x10, 0x01, 0x00 @ Game Title
.byte 0x30, 0x31 @ Maker Code
.byte 0x96 @ Fixed Value
.byte 0x00 @ Main Unit Code
.byte 0x00 @ Device Type
.fill 0x07, 0x01, 0x00 @ Unused
.byte 0x00 @ Software Version Number
.byte 0xF0 @ Complement Check
.byte 0x00, 0x00 @ Checksum
multiboot: b start
.byte 0x00 @ Boot Method (0 = ROM boot, 3 = Multiplay)
.byte 0x00 @ Slave Number
.byte 0x00 @ Reserved
.byte 0x00 @ Reserved
.word 0x00 @ Reserved
.word 0x00 @ Reserved
.word 0x00 @ Reserved
.word 0x00 @ Reserved
.word 0x00 @ Reserved
.word 0x00 @ Reserved
.section ".text"
.global start
.align
.equ REGBASE, 0x4000000
.equ DISPCNT, 0x4000000
.equ VRAM_ADDR, 0x6000000
.arm
start:
mov r0, #REGBASE
str r0, [r0, #0x208]
/* Put the ARM processor into IRQ mode. */
mov r0, #0x12
msr cpsr, r0
/* Set up the IRQ stack. */
ldr sp, =__sp_irq__
/* Put the ARM processor into System mode. */
mov r0, #0x1F
msr cpsr, r0
/* Set up the user stack. */
ldr sp, =__sp_user__
bl main
stop: b stop
.fill 161, 0x01, 0x00