-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.s
More file actions
867 lines (867 loc) · 13.2 KB
/
main.s
File metadata and controls
867 lines (867 loc) · 13.2 KB
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
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
.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 "main.c"
.text
.align 2
.global initialize
.arch armv4t
.syntax unified
.arm
.fpu softvfp
.type initialize, %function
initialize:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr}
mov r2, #4608
mov r5, #67108864
ldr r4, .L4
strh r2, [r5] @ movhi
mov r3, #256
mov r2, #83886080
mov r0, #3
ldr r1, .L4+4
mov lr, pc
bx r4
mov r3, #7936
ldr r2, .L4+8
strh r3, [r5, #8] @ movhi
mov r0, #3
strh r2, [r5, #10] @ movhi
mov r3, #80
mov r2, #100663296
ldr r1, .L4+12
mov lr, pc
bx r4
mov r3, #4096
mov r0, #3
ldr r2, .L4+16
ldr r1, .L4+20
mov lr, pc
bx r4
mov r3, #2240
mov r0, #3
ldr r2, .L4+24
ldr r1, .L4+28
mov lr, pc
bx r4
ldr r2, .L4+32
mov r0, #3
ldr r1, .L4+36
mov r3, #1024
mov lr, pc
bx r4
ldr r3, .L4+40
mov lr, pc
bx r3
ldr r3, .L4+44
mov lr, pc
bx r3
ldr r2, .L4+48
ldr r3, .L4+52
ldrh r2, [r2, #48]
pop {r4, r5, r6, lr}
strh r2, [r3] @ movhi
bx lr
.L5:
.align 2
.L4:
.word DMANow
.word startscreenPal
.word 7684
.word backgroundTiles
.word 100726784
.word backgroundMap
.word 100679680
.word startscreenTiles
.word 100724736
.word startscreenMap
.word setupSounds
.word setupInterrupts
.word 67109120
.word buttons
.size initialize, .-initialize
.align 2
.global goToStart
.syntax unified
.arm
.fpu softvfp
.type goToStart, %function
goToStart:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r3, .L8
mov lr, pc
bx r3
ldr r4, .L8+4
mov r3, #256
mov r2, #83886080
mov r0, #3
ldr r1, .L8+8
mov lr, pc
bx r4
mov r3, #67108864
mov r1, #4608
ldr r2, .L8+12
strh r1, [r3] @ movhi
strh r2, [r3, #10] @ movhi
mov r0, #3
mov r3, #2240
ldr r2, .L8+16
ldr r1, .L8+20
mov lr, pc
bx r4
mov r0, #3
ldr r2, .L8+24
ldr r1, .L8+28
mov r3, #1024
mov lr, pc
bx r4
ldr r3, .L8+32
mov lr, pc
bx r3
mov r3, #512
mov r2, #117440512
ldr r1, .L8+36
mov r0, #3
mov lr, pc
bx r4
mov r3, #0
ldr r1, .L8+40
ldr r2, .L8+44
str r3, [r1]
str r3, [r2]
pop {r4, lr}
bx lr
.L9:
.align 2
.L8:
.word hideSprites
.word DMANow
.word startscreenPal
.word 7684
.word 100679680
.word startscreenTiles
.word 100724736
.word startscreenMap
.word waitForVBlank
.word shadowOAM
.word state
.word seed
.size goToStart, .-goToStart
.align 2
.global goToGame
.syntax unified
.arm
.fpu softvfp
.type goToGame, %function
goToGame:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r3, .L12
mov lr, pc
bx r3
ldr r3, .L12+4
mov lr, pc
bx r3
ldr r4, .L12+8
mov r3, #512
mov r2, #117440512
mov r0, #3
ldr r1, .L12+12
mov lr, pc
bx r4
mov r3, #256
mov r2, #83886080
mov r0, #3
ldr r1, .L12+16
mov lr, pc
bx r4
mov r1, #67108864
mov r0, #4352
mov r2, #1
ldr r3, .L12+20
strh r0, [r1] @ movhi
pop {r4, lr}
str r2, [r3]
bx lr
.L13:
.align 2
.L12:
.word hideSprites
.word waitForVBlank
.word DMANow
.word shadowOAM
.word backgroundPal
.word state
.size goToGame, .-goToGame
.align 2
.global goToPause
.syntax unified
.arm
.fpu softvfp
.type goToPause, %function
goToPause:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r3, .L16
ldr r4, .L16+4
mov lr, pc
bx r3
mov r3, #256
mov r2, #83886080
mov r0, #3
ldr r1, .L16+8
mov lr, pc
bx r4
mov r3, #67108864
mov r1, #5632
ldr r0, .L16+12
ldr r2, .L16+16
strh r0, [r3, #10] @ movhi
strh r1, [r3] @ movhi
strh r2, [r3, #12] @ movhi
mov r0, #3
mov r3, #1552
ldr r2, .L16+20
ldr r1, .L16+24
mov lr, pc
bx r4
mov r3, #1024
mov r0, #3
ldr r2, .L16+28
ldr r1, .L16+32
mov lr, pc
bx r4
mov r3, #2256
mov r0, #3
ldr r2, .L16+36
ldr r1, .L16+40
mov lr, pc
bx r4
mov r0, #3
ldr r2, .L16+44
ldr r1, .L16+48
mov r3, #1024
mov lr, pc
bx r4
ldr r3, .L16+52
mov lr, pc
bx r3
mov r3, #512
mov r2, #117440512
mov r0, #3
ldr r1, .L16+56
mov lr, pc
bx r4
mov r2, #2
ldr r3, .L16+60
pop {r4, lr}
str r2, [r3]
bx lr
.L17:
.align 2
.L16:
.word hideSprites
.word DMANow
.word bottompausePal
.word 7684
.word 7432
.word 100679680
.word bottompauseTiles
.word 100724736
.word bottompauseMap
.word 100696064
.word toppauseTiles
.word 100722688
.word toppauseMap
.word waitForVBlank
.word shadowOAM
.word state
.size goToPause, .-goToPause
.align 2
.global pause
.syntax unified
.arm
.fpu softvfp
.type pause, %function
pause:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr}
mov r4, #67108864
ldr r3, .L30
mov lr, pc
bx r3
ldr r0, .L30+4
ldr r2, [r0]
lsl r1, r2, #16
lsr r1, r1, #16
rsb r3, r1, #120
lsl r3, r3, #16
lsr r3, r3, #16
strh r1, [r4, #20] @ movhi
strh r3, [r4, #24] @ movhi
ldr r1, .L30+8
ldrh r3, [r1]
add r2, r2, #1
tst r3, #1
str r2, [r0]
beq .L19
ldr r2, .L30+12
ldrh r2, [r2]
ands r5, r2, #1
beq .L28
.L19:
tst r3, #8
beq .L18
ldr r3, .L30+12
ldrh r3, [r3]
ands r3, r3, #8
beq .L29
.L18:
pop {r4, r5, r6, lr}
bx lr
.L28:
ldr r3, .L30+16
mov lr, pc
bx r3
strh r5, [r4, #20] @ movhi
pop {r4, r5, r6, lr}
b goToGame
.L29:
mov r2, #67108864
pop {r4, r5, r6, lr}
strh r3, [r2, #20] @ movhi
b goToStart
.L31:
.align 2
.L30:
.word waitForVBlank
.word pOff
.word oldButtons
.word buttons
.word unpauseSound
.size pause, .-pause
.align 2
.global goToWin
.syntax unified
.arm
.fpu softvfp
.type goToWin, %function
goToWin:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r3, .L34
mov lr, pc
bx r3
ldr r4, .L34+4
mov r3, #256
mov r2, #83886080
mov r0, #3
ldr r1, .L34+8
mov lr, pc
bx r4
mov r3, #67108864
mov r1, #4608
ldr r2, .L34+12
strh r1, [r3] @ movhi
strh r2, [r3, #10] @ movhi
mov r0, #3
mov r3, #1600
ldr r2, .L34+16
ldr r1, .L34+20
mov lr, pc
bx r4
mov r0, #3
ldr r2, .L34+24
ldr r1, .L34+28
mov r3, #1024
mov lr, pc
bx r4
ldr r3, .L34+32
mov lr, pc
bx r3
mov r3, #512
mov r2, #117440512
mov r0, #3
ldr r1, .L34+36
mov lr, pc
bx r4
mov r2, #3
ldr r3, .L34+40
pop {r4, lr}
str r2, [r3]
bx lr
.L35:
.align 2
.L34:
.word hideSprites
.word DMANow
.word bottompausePal
.word 7684
.word 100679680
.word winscreenTiles
.word 100724736
.word winscreenMap
.word waitForVBlank
.word shadowOAM
.word state
.size goToWin, .-goToWin
.align 2
.global win
.syntax unified
.arm
.fpu softvfp
.type win, %function
win:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r3, .L43
push {r4, lr}
mov lr, pc
bx r3
ldr r3, .L43+4
ldrh r3, [r3]
tst r3, #8
beq .L36
ldr r3, .L43+8
ldrh r3, [r3]
tst r3, #8
beq .L42
.L36:
pop {r4, lr}
bx lr
.L42:
pop {r4, lr}
b goToStart
.L44:
.align 2
.L43:
.word waitForVBlank
.word oldButtons
.word buttons
.size win, .-win
.align 2
.global goToLose
.syntax unified
.arm
.fpu softvfp
.type goToLose, %function
goToLose:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r3, .L47
mov lr, pc
bx r3
ldr r4, .L47+4
mov r3, #256
mov r2, #83886080
mov r0, #3
ldr r1, .L47+8
mov lr, pc
bx r4
mov r3, #67108864
mov r1, #4608
ldr r2, .L47+12
strh r1, [r3] @ movhi
strh r2, [r3, #10] @ movhi
mov r0, #3
mov r3, #2128
ldr r2, .L47+16
ldr r1, .L47+20
mov lr, pc
bx r4
mov r0, #3
ldr r2, .L47+24
ldr r1, .L47+28
mov r3, #1024
mov lr, pc
bx r4
ldr r3, .L47+32
mov lr, pc
bx r3
mov r3, #512
mov r2, #117440512
mov r0, #3
ldr r1, .L47+36
mov lr, pc
bx r4
mov r2, #4
ldr r3, .L47+40
pop {r4, lr}
str r2, [r3]
bx lr
.L48:
.align 2
.L47:
.word hideSprites
.word DMANow
.word bottompausePal
.word 7684
.word 100679680
.word losescreenTiles
.word 100724736
.word losescreenMap
.word waitForVBlank
.word shadowOAM
.word state
.size goToLose, .-goToLose
.align 2
.global game
.syntax unified
.arm
.fpu softvfp
.type game, %function
game:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r3, .L60
mov lr, pc
bx r3
ldr r3, .L60+4
mov lr, pc
bx r3
mov r2, #67108864
ldr r3, .L60+8
ldrh r1, [r3]
ldr r3, .L60+12
strh r1, [r2, #16] @ movhi
ldrh r3, [r3]
tst r3, #8
beq .L50
ldr r3, .L60+16
ldrh r3, [r3]
tst r3, #8
beq .L57
.L50:
ldr r4, .L60+20
ldr r3, [r4]
cmp r3, #1
beq .L58
.L51:
cmn r3, #1
beq .L59
pop {r4, lr}
bx lr
.L59:
ldr r3, .L60+24
mov lr, pc
bx r3
mov r2, #0
ldr r1, .L60+28
ldr r0, .L60+32
ldr r3, .L60+36
mov lr, pc
bx r3
pop {r4, lr}
b goToLose
.L58:
bl goToWin
ldr r3, [r4]
b .L51
.L57:
ldr r3, .L60+40
mov lr, pc
bx r3
bl goToPause
b .L50
.L61:
.align 2
.L60:
.word updateGame
.word drawGame
.word hOff
.word oldButtons
.word buttons
.word gmState
.word stopSound
.word 55831
.word loseSound
.word playSoundB
.word pauseSound
.size game, .-game
.align 2
.global lose
.syntax unified
.arm
.fpu softvfp
.type lose, %function
lose:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
b win
.size lose, .-lose
.align 2
.global goToInstruct
.syntax unified
.arm
.fpu softvfp
.type goToInstruct, %function
goToInstruct:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r3, .L65
mov lr, pc
bx r3
ldr r4, .L65+4
mov r3, #256
mov r2, #83886080
mov r0, #3
ldr r1, .L65+8
mov lr, pc
bx r4
mov r3, #67108864
mov r1, #4608
ldr r2, .L65+12
strh r1, [r3] @ movhi
strh r2, [r3, #10] @ movhi
mov r0, #3
ldr r3, .L65+16
ldr r2, .L65+20
ldr r1, .L65+24
mov lr, pc
bx r4
mov r0, #3
ldr r2, .L65+28
ldr r1, .L65+32
mov r3, #1024
mov lr, pc
bx r4
ldr r3, .L65+36
mov lr, pc
bx r3
mov r3, #512
mov r2, #117440512
mov r0, #3
ldr r1, .L65+40
mov lr, pc
bx r4
mov r2, #5
ldr r3, .L65+44
pop {r4, lr}
str r2, [r3]
bx lr
.L66:
.align 2
.L65:
.word hideSprites
.word DMANow
.word bottompausePal
.word 7684
.word 4720
.word 100679680
.word instructscreenTiles
.word 100724736
.word instructscreenMap
.word waitForVBlank
.word shadowOAM
.word state
.size goToInstruct, .-goToInstruct
.align 2
.global start
.syntax unified
.arm
.fpu softvfp
.type start, %function
start:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr}
ldr r4, .L79
ldr r3, .L79+4
mov lr, pc
bx r3
ldr r3, [r4]
ldr r2, .L79+8
add r3, r3, #1
ldr r5, .L79+12
str r3, [r4]
ldr r6, .L79+16
mov lr, pc
bx r2
mov r3, #512
mov r2, #117440512
mov r0, #3
ldr r1, .L79+20
mov lr, pc
bx r6
ldrh r3, [r5]
tst r3, #8
beq .L68
ldr r2, .L79+24
ldrh r2, [r2]
tst r2, #8
beq .L77
.L68:
tst r3, #1
beq .L67
ldr r3, .L79+24
ldrh r3, [r3]
tst r3, #1
beq .L78
.L67:
pop {r4, r5, r6, lr}
bx lr
.L78:
pop {r4, r5, r6, lr}
b goToInstruct
.L77:
ldr r3, .L79+28
mov lr, pc
bx r3
mov r2, #1
ldr r1, .L79+32
ldr r0, .L79+36
ldr r3, .L79+40
mov lr, pc
bx r3
ldr r0, [r4]
ldr r3, .L79+44
mov lr, pc
bx r3
ldr r3, .L79+48
mov lr, pc
bx r3
bl goToGame
ldrh r3, [r5]
b .L68
.L80:
.align 2
.L79:
.word seed
.word hideSprites
.word waitForVBlank
.word oldButtons
.word DMANow
.word shadowOAM
.word buttons
.word stopSound
.word 859195
.word gameSong
.word playSoundA
.word srand
.word initGame
.size start, .-start
.section .text.startup,"ax",%progbits
.align 2
.global main
.syntax unified
.arm
.fpu softvfp
.type main, %function
main:
@ Function supports interworking.
@ Volatile: function does not return.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r7, fp, lr}
ldr r3, .L92
mov lr, pc
bx r3
ldr r6, .L92+4
ldr fp, .L92+8
ldr r5, .L92+12
ldr r10, .L92+16
ldr r9, .L92+20
ldr r8, .L92+24
ldr r7, .L92+28
ldr r4, .L92+32
.L82:
ldr r2, [r6]
ldrh r3, [fp]
.L83:
strh r3, [r5] @ movhi
ldrh r3, [r4, #48]
strh r3, [fp] @ movhi
cmp r2, #5
ldrls pc, [pc, r2, asl #2]
b .L83
.L85:
.word .L88
.word .L87
.word .L86
.word .L84
.word .L84
.word .L84
.L84:
mov lr, pc
bx r7
b .L82
.L86:
mov lr, pc
bx r8
b .L82
.L87:
mov lr, pc
bx r9
b .L82
.L88:
mov lr, pc
bx r10
b .L82
.L93:
.align 2
.L92:
.word initialize
.word state
.word buttons
.word oldButtons
.word start
.word game
.word pause
.word win
.word 67109120
.size main, .-main
.text
.align 2
.global instruct
.syntax unified
.arm
.fpu softvfp
.type instruct, %function
instruct:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
b win
.size instruct, .-instruct
.comm seed,4,4
.comm state,4,4
.comm pOff,4,4
.comm vOff,4,4
.comm hOff,4,4
.comm oldButtons,2,2
.comm buttons,2,2
.comm soundB,32,4
.comm soundA,32,4
.ident "GCC: (devkitARM release 53) 9.1.0"