-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.s
753 lines (753 loc) · 12.4 KB
/
game.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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
.cpu arm7tdmi
.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 34, 0
.eabi_attribute 18, 4
.file "game.c"
.text
.align 2
.arch armv4t
.syntax unified
.arm
.fpu softvfp
.type updateBullet.part.0, %function
updateBullet.part.0:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr r2, [r0]
cmp r2, #0
ble .L2
ldr r1, [r0, #12]
ldr r3, [r0, #4]
add r3, r3, r1
sub r1, r3, #1
cmp r1, #238
bls .L5
.L2:
mov r3, #0
str r3, [r0, #28]
bx lr
.L5:
ldr r1, [r0, #8]
add r2, r1, r2
stm r0, {r2, r3}
bx lr
.size updateBullet.part.0, .-updateBullet.part.0
.align 2
.syntax unified
.arm
.fpu softvfp
.type updateBall.part.0, %function
updateBall.part.0:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, r7, r8, r9, lr}
ldr r2, [r0]
cmp r2, #1
mov r5, r0
sub sp, sp, #20
ldr r0, [r0, #8]
ble .L7
ldr r3, [r5, #16]
add r3, r2, r3
cmp r3, #119
bgt .L7
.L8:
ldr r3, [r5, #4]
cmp r3, #1
ldr r1, [r5, #12]
ble .L9
ldr ip, [r5, #20]
add ip, r3, ip
cmp ip, #238
bgt .L9
.L10:
mov r7, #0
add r2, r2, r0
add r3, r3, r1
ldr r4, .L21
stm r5, {r2, r3}
ldr r8, .L21+4
ldr r9, .L21+8
add r6, r4, #160
.L14:
ldr r3, [r4, #28]
cmp r3, #0
bne .L20
.L12:
add r4, r4, #32
cmp r6, r4
bne .L14
add sp, sp, #20
@ sp needed
pop {r4, r5, r6, r7, r8, r9, lr}
bx lr
.L9:
rsb r1, r1, #0
str r1, [r5, #12]
b .L10
.L7:
rsb r0, r0, #0
str r0, [r5, #8]
b .L8
.L20:
add r0, r4, #16
ldm r0, {r0, r1}
ldm r4, {r2, r3}
str r0, [sp, #12]
str r1, [sp, #8]
str r2, [sp, #4]
str r3, [sp]
ldr r3, [r5, #16]
ldr r2, [r5, #20]
ldr r1, [r5]
ldr r0, [r5, #4]
mov lr, pc
bx r8
cmp r0, #0
ldrne r3, [r9]
subne r3, r3, #1
strne r7, [r4, #28]
strne r3, [r9]
strne r7, [r5, #28]
b .L12
.L22:
.align 2
.L21:
.word bullets
.word collision
.word ballsRemaining
.size updateBall.part.0, .-updateBall.part.0
.align 2
.global drawBar
.syntax unified
.arm
.fpu softvfp
.type drawBar, %function
drawBar:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
mov r2, #253
push {r4, lr}
sub sp, sp, #8
str r2, [sp]
mov r3, #3
mov r2, #240
mov r1, #120
mov r0, #0
ldr r4, .L25
mov lr, pc
bx r4
add sp, sp, #8
@ sp needed
pop {r4, lr}
bx lr
.L26:
.align 2
.L25:
.word drawRect4
.size drawBar, .-drawBar
.align 2
.global initPlayer
.syntax unified
.arm
.fpu softvfp
.type initPlayer, %function
initPlayer:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
mvn r1, #3
push {r4, r5, lr}
mov ip, #10
mov r5, #130
mov r4, #118
mov lr, #2
mov r0, #5
mov r2, #20
ldr r3, .L29
strb r1, [r3, #20]
stmib r3, {r4, lr}
str r5, [r3]
str ip, [r3, #12]
str r0, [r3, #16]
str r2, [r3, #24]
pop {r4, r5, lr}
bx lr
.L30:
.align 2
.L29:
.word player
.size initPlayer, .-initPlayer
.align 2
.global drawPlayer
.syntax unified
.arm
.fpu softvfp
.type drawPlayer, %function
drawPlayer:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r0, .L33
ldrb r2, [r0, #20] @ zero_extendqisi2
sub sp, sp, #8
ldr r3, [r0, #12]
str r2, [sp]
ldr r4, .L33+4
ldr r2, [r0, #16]
ldr r1, [r0]
ldr r0, [r0, #4]
mov lr, pc
bx r4
add sp, sp, #8
@ sp needed
pop {r4, lr}
bx lr
.L34:
.align 2
.L33:
.word player
.word drawRect4
.size drawPlayer, .-drawPlayer
.align 2
.global initBullets
.syntax unified
.arm
.fpu softvfp
.type initBullets, %function
initBullets:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
mov r2, #0
mvn r0, #1
mov r1, r2
ldr r3, .L39
.L36:
add r2, r2, #1
rsb ip, r2, #0
cmp r2, #5
str r2, [r3, #16]
str r2, [r3, #20]
str r1, [r3, #4]
str r0, [r3, #8]
str r1, [r3, #12]
strb r0, [r3, #24]
str r1, [r3, #28]
str ip, [r3]
add r3, r3, #32
bne .L36
bx lr
.L40:
.align 2
.L39:
.word bullets
.size initBullets, .-initBullets
.align 2
.global fireBullet
.syntax unified
.arm
.fpu softvfp
.type fireBullet, %function
fireBullet:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
mov r3, #0
ldr r1, .L52
ldr r2, [r1, r3, lsl #5]
cmp r2, #0
lsl r2, r3, #5
beq .L51
.L42:
add r3, r3, #1
cmp r3, #5
bxeq lr
ldr r2, [r1, r3, lsl #5]
cmp r2, #0
lsl r2, r3, #5
bne .L42
.L51:
push {r4, r5, lr}
mov r5, #1
ldr ip, .L52+4
ldr r4, .L52+8
ldr lr, [ip, #16]
add r2, r4, r2
ldr r1, [ip, #4]
ldr r0, [r2, #20]
add lr, lr, lr, lsr #31
add r1, r1, lr, asr r5
add r0, r0, r0, lsr #31
ldr lr, [ip, #28]
ldr ip, [ip]
sub r1, r1, r0, asr r5
str lr, [r2, #12]
str ip, [r4, r3, lsl #5]
str r5, [r2, #28]
str r1, [r2, #4]
pop {r4, r5, lr}
bx lr
.L53:
.align 2
.L52:
.word bullets+28
.word player
.word bullets
.size fireBullet, .-fireBullet
.align 2
.global updatePlayer
.syntax unified
.arm
.fpu softvfp
.type updatePlayer, %function
updatePlayer:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r3, .L67
ldrh r3, [r3, #48]
tst r3, #32
push {r4, lr}
ldr r4, .L67+4
bne .L55
ldr r3, [r4, #4]
ldr r2, [r4, #8]
cmp r3, r2
blt .L55
mvn r1, #0
sub r3, r3, r2
str r3, [r4, #4]
str r1, [r4, #28]
b .L56
.L55:
ldr r3, .L67
ldrh r3, [r3, #48]
tst r3, #16
beq .L66
.L57:
mov r3, #0
str r3, [r4, #28]
.L56:
ldr r3, .L67+8
ldrh r3, [r3]
tst r3, #1
ldr r3, [r4, #24]
beq .L65
ldr r2, .L67+12
ldrh r2, [r2]
tst r2, #1
beq .L60
.L65:
add r3, r3, #1
.L59:
str r3, [r4, #24]
pop {r4, lr}
bx lr
.L66:
ldr r2, [r4, #4]
ldr r3, [r4, #16]
ldr r1, [r4, #8]
add r3, r2, r3
rsb r0, r1, #240
cmp r3, r0
bgt .L57
mov r3, #1
add r2, r2, r1
str r2, [r4, #4]
str r3, [r4, #28]
b .L56
.L60:
cmp r3, #12
ble .L65
bl fireBullet
mov r3, #1
b .L59
.L68:
.align 2
.L67:
.word 67109120
.word player
.word oldButtons
.word buttons
.size updatePlayer, .-updatePlayer
.align 2
.global updateGame
.syntax unified
.arm
.fpu softvfp
.type updateGame, %function
updateGame:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr}
bl updatePlayer
ldr r0, .L83
add r4, r0, #160
.L71:
ldr r3, [r0, #28]
cmp r3, #0
blne updateBullet.part.0
.L70:
add r0, r0, #32
cmp r0, r4
bne .L71
ldr r4, .L83+4
add r5, r4, #160
.L73:
ldr r3, [r4, #28]
cmp r3, #0
movne r0, r4
blne updateBall.part.0
.L72:
add r4, r4, #32
cmp r5, r4
bne .L73
pop {r4, r5, r6, lr}
bx lr
.L84:
.align 2
.L83:
.word bullets
.word balls
.size updateGame, .-updateGame
.align 2
.global updateBullet
.syntax unified
.arm
.fpu softvfp
.type updateBullet, %function
updateBullet:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr r3, [r0, #28]
cmp r3, #0
bxeq lr
b updateBullet.part.0
.size updateBullet, .-updateBullet
.align 2
.global drawBullet
.syntax unified
.arm
.fpu softvfp
.type drawBullet, %function
drawBullet:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r3, [r0, #28]
cmp r3, #0
bxeq lr
push {r4, lr}
ldrb r2, [r0, #24] @ zero_extendqisi2
sub sp, sp, #8
ldr r3, [r0, #16]
str r2, [sp]
ldr r4, .L96
ldr r2, [r0, #20]
ldr r1, [r0]
ldr r0, [r0, #4]
mov lr, pc
bx r4
add sp, sp, #8
@ sp needed
pop {r4, lr}
bx lr
.L97:
.align 2
.L96:
.word drawRect4
.size drawBullet, .-drawBullet
.align 2
.global initBalls
.syntax unified
.arm
.fpu softvfp
.type initBalls, %function
initBalls:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, r7, r8, r9, r10, lr}
mov r8, #0
mov r9, #12
ldr r4, .L102
ldr r5, .L102+4
ldr r7, .L102+8
ldr r6, .L102+12
.L99:
str r9, [r4, #16]
str r9, [r4, #20]
mov lr, pc
bx r5
smull r3, r2, r7, r0
asr r3, r0, #31
rsb r3, r3, r2, asr #2
rsb r2, r3, r3, lsl #3
rsb r3, r3, r2, lsl #3
sub r0, r0, r3, lsl #1
str r0, [r4]
mov lr, pc
bx r5
mov r1, #1
mov r2, #2
smull r3, ip, r6, r0
asr r3, r0, #31
rsb r3, r3, ip, asr #6
add r3, r3, r3, lsl #6
sub r0, r0, r3, lsl r1
and r3, r8, r1
add r8, r8, r1
add r0, r0, #10
cmp r8, #5
stmib r4, {r0, r2}
str r2, [r4, #12]
str r1, [r4, #28]
str r3, [r4, #24]
add r4, r4, #32
bne .L99
pop {r4, r5, r6, r7, r8, r9, r10, lr}
bx lr
.L103:
.align 2
.L102:
.word balls
.word rand
.word 156180629
.word 2114445439
.size initBalls, .-initBalls
.align 2
.global initGame
.syntax unified
.arm
.fpu softvfp
.type initGame, %function
initGame:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, r7, r8, lr}
mov r4, #0
mov r8, #130
mov r7, #118
mov r6, #2
mov lr, #10
mov ip, #5
mvn r0, #3
mov r1, #20
mov r5, r4
mvn r2, #1
ldr r3, .L108
str r8, [r3]
str r7, [r3, #4]
str r6, [r3, #8]
str lr, [r3, #12]
str ip, [r3, #16]
strb r0, [r3, #20]
str r1, [r3, #24]
ldr r3, .L108+4
.L105:
add r4, r4, #1
rsb r1, r4, #0
cmp r4, #5
str r4, [r3, #16]
str r4, [r3, #20]
str r5, [r3, #4]
str r2, [r3, #8]
str r5, [r3, #12]
strb r2, [r3, #24]
str r5, [r3, #28]
str r1, [r3]
add r3, r3, #32
bne .L105
bl initBalls
ldr ip, .L108+8
mov r3, #256
str r4, [ip]
mov r2, #83886080
mov r0, #3
ldr r1, .L108+12
ldr r4, .L108+16
mov lr, pc
bx r4
mov lr, #31744
mov ip, #992
mov r0, #31
mvn r1, #32768
ldr r3, .L108+20
ldr r2, .L108+24
strh lr, [r3, #246] @ movhi
strh r5, [r3, #244] @ movhi
strh ip, [r3, #248] @ movhi
strh r0, [r3, #250] @ movhi
strh r1, [r3, #252] @ movhi
strh r2, [r3, #254] @ movhi
pop {r4, r5, r6, r7, r8, lr}
bx lr
.L109:
.align 2
.L108:
.word player
.word bullets
.word ballsRemaining
.word pumpkinPal
.word DMANow
.word 83886336
.word 15855
.size initGame, .-initGame
.align 2
.global updateBall
.syntax unified
.arm
.fpu softvfp
.type updateBall, %function
updateBall:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr r3, [r0, #28]
cmp r3, #0
bxeq lr
b updateBall.part.0
.size updateBall, .-updateBall
.align 2
.global drawBall
.syntax unified
.arm
.fpu softvfp
.type drawBall, %function
drawBall:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r2, [r0, #28]
cmp r2, #0
bxeq lr
mov r3, r0
push {r4, lr}
ldr r2, [r0, #24]
cmp r2, #0
ldr r1, [r3]
ldr r2, [r3, #20]
ldr r0, [r0, #4]
ldr r3, [r3, #16]
sub sp, sp, #8
bne .L122
mov ip, #251
ldr r4, .L123
str ip, [sp]
mov lr, pc
bx r4
add sp, sp, #8
@ sp needed
pop {r4, lr}
bx lr
.L122:
ldr ip, .L123+4
ldr r4, .L123+8
str ip, [sp]
mov lr, pc
bx r4
add sp, sp, #8
@ sp needed
pop {r4, lr}
bx lr
.L124:
.align 2
.L123:
.word drawRect4
.word pumpkinBitmap
.word drawImage4
.size drawBall, .-drawBall
.align 2
.global drawGame
.syntax unified
.arm
.fpu softvfp
.type drawGame, %function
drawGame:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr}
mov r0, #250
sub sp, sp, #8
ldr r3, .L134
mov lr, pc
bx r3
bl drawPlayer
mov r2, #253
mov r3, #3
str r2, [sp]
mov r1, #120
mov r2, #240
mov r0, #0
ldr r6, .L134+4
mov lr, pc
bx r6
ldr r4, .L134+8
add r5, r4, #160
.L127:
ldr r3, [r4, #28]
cmp r3, #0
bne .L133
.L126:
add r4, r4, #32
cmp r4, r5
bne .L127
ldr r0, .L134+12
bl drawBall
ldr r0, .L134+16
bl drawBall
ldr r0, .L134+20
bl drawBall
ldr r0, .L134+24
bl drawBall
ldr r0, .L134+28
add sp, sp, #8
@ sp needed
pop {r4, r5, r6, lr}
b drawBall
.L133:
ldrb r2, [r4, #24] @ zero_extendqisi2
ldr r3, [r4, #16]
str r2, [sp]
ldr r1, [r4]
ldr r2, [r4, #20]
ldr r0, [r4, #4]
mov lr, pc
bx r6
b .L126
.L135:
.align 2
.L134:
.word fillScreen4
.word drawRect4
.word bullets
.word balls
.word balls+32
.word balls+64
.word balls+96
.word balls+128
.size drawGame, .-drawGame
.comm ballsRemaining,4,4
.comm balls,160,4
.comm bullets,160,4
.comm player,32,4
.ident "GCC: (devkitARM release 53) 9.1.0"