-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyLib.s
240 lines (240 loc) · 4.63 KB
/
myLib.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
.cpu arm7tdmi
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 2
.eabi_attribute 18, 4
.file "myLib.c"
.text
.align 2
.global DMANow
.type DMANow, %function
DMANow:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr ip, .L2
str r4, [sp, #-4]!
ldr ip, [ip, #0]
add r0, r0, r0, asl #1
add r4, ip, r0, asl #2
orr r3, r3, #-2147483648
str r1, [ip, r0, asl #2]
str r2, [r4, #4]
str r3, [r4, #8]
ldmfd sp!, {r4}
bx lr
.L3:
.align 2
.L2:
.word .LANCHOR0
.size DMANow, .-DMANow
.align 2
.global loadPalette
.type loadPalette, %function
loadPalette:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr r3, .L5
ldr r1, [r3, #0]
mov r3, #-2147483648
add r2, r1, #36
str r0, [r1, #36]
add r3, r3, #256
mov r1, #83886080
str r1, [r2, #4]
str r3, [r2, #8]
bx lr
.L6:
.align 2
.L5:
.word .LANCHOR0
.size loadPalette, .-loadPalette
.align 2
.global drawImage4
.type drawImage4, %function
drawImage4:
@ Function supports interworking.
@ args = 4, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
stmfd sp!, {r4, r5, r6, r7, r8, sl}
ldr r7, [sp, #24]
tst r2, #1
addne r2, r2, #1
cmp r7, #0
ble .L7
ldr r5, .L13
add r8, r3, r3, lsr #31
ldr r4, [r5, #0]
rsb r1, r1, r1, asl #4
mov r8, r8, asr #1
mov ip, #0
ldr sl, [r5, #4]
add r2, r2, r1, asl #4
add r4, r4, #36
orr r8, r8, #-2147483648
mov r1, ip
.L10:
add r6, ip, ip, lsr #31
add r5, r2, r2, lsr #31
bic r6, r6, #1
bic r5, r5, #1
add r1, r1, #1
add r6, r0, r6
add r5, sl, r5
cmp r1, r7
str r6, [r4, #0]
add ip, ip, r3
str r5, [r4, #4]
add r2, r2, #240
str r8, [r4, #8]
bne .L10
.L7:
ldmfd sp!, {r4, r5, r6, r7, r8, sl}
bx lr
.L14:
.align 2
.L13:
.word .LANCHOR0
.size drawImage4, .-drawImage4
.align 2
.global drawBackgroundImage4
.type drawBackgroundImage4, %function
drawBackgroundImage4:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr r3, .L16
ldmia r3, {r1, ip} @ phole ldm
mov r3, #-2147483648
add r2, r1, #36
add r3, r3, #19200
str r0, [r1, #36]
str ip, [r2, #4]
str r3, [r2, #8]
bx lr
.L17:
.align 2
.L16:
.word .LANCHOR0
.size drawBackgroundImage4, .-drawBackgroundImage4
.align 2
.global drawRect
.type drawRect, %function
drawRect:
@ Function supports interworking.
@ args = 4, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
str r4, [sp, #-4]!
sub sp, sp, #12
ldrh ip, [sp, #16]
cmp r2, #0
strh ip, [sp, #6] @ movhi
ble .L18
ldr ip, .L22
rsb r0, r0, r0, asl #4
ldmia ip, {r4, ip} @ phole ldm
add r1, r1, r0, asl #4
add r1, ip, r1, asl #1
add r0, r4, #36
mov ip, #0
orr r4, r3, #-2147483648
add r3, sp, #6
.L20:
add ip, ip, #1
cmp ip, r2
str r3, [r0, #0]
str r1, [r0, #4]
str r4, [r0, #8]
add r1, r1, #480
bne .L20
.L18:
add sp, sp, #12
ldmfd sp!, {r4}
bx lr
.L23:
.align 2
.L22:
.word .LANCHOR0
.size drawRect, .-drawRect
.align 2
.global waitForVblank
.type waitForVblank, %function
waitForVblank:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
mov r2, #67108864
.L25:
ldrh r3, [r2, #6]
cmp r3, #160
bhi .L25
mov r2, #67108864
.L27:
ldrh r3, [r2, #6]
cmp r3, #159
bls .L27
bx lr
.size waitForVblank, .-waitForVblank
.align 2
.global flipPage
.type flipPage, %function
flipPage:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
mov r3, #67108864
ldrh r2, [r3, #0]
tst r2, #16
ldrne r1, .L33
ldreq r1, .L33
ldrne r0, [r1, #8]
ldreq r0, [r1, #12]
bicne r2, r2, #16
orreq r2, r2, #16
strneh r2, [r3, #0] @ movhi
streqh r2, [r3, #0] @ movhi
strne r0, [r1, #4]
streq r0, [r1, #4]
bx lr
.L34:
.align 2
.L33:
.word .LANCHOR0
.size flipPage, .-flipPage
.global videoBuffer
.global frontBuffer
.global backBuffer
.global dma
.data
.align 2
.set .LANCHOR0,. + 0
.type dma, %object
.size dma, 4
dma:
.word 67109040
.type videoBuffer, %object
.size videoBuffer, 4
videoBuffer:
.word 100663296
.type backBuffer, %object
.size backBuffer, 4
backBuffer:
.word 100704256
.type frontBuffer, %object
.size frontBuffer, 4
frontBuffer:
.word 100663296
.ident "GCC: (devkitARM release 31) 4.5.0"