-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank_001.asm
executable file
·12919 lines (11670 loc) · 143 KB
/
bank_001.asm
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
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; Disassembly of "DQM.gbc"
; This file was created with:
; mgbdis v1.4 - Game Boy ROM disassembler by Matt Currie and contributors.
; https://github.com/mattcurrie/mgbdis
SECTION "ROM Bank $001", ROMX[$4000], BANK[$1]
ld bc, $401d
db $d3
ld c, l
inc e
ld b, d
ld c, [hl]
ld c, b
ld b, l
ld c, b
or $46
add [hl]
ld b, [hl]
ld e, b
ld c, h
ld [hl], d
ld e, d
pop bc
ld c, e
ld l, l
ld e, l
ld a, $68
ret z
ld l, c
pop hl
ld l, c
ld hl, sp+$00
ld a, l
ld [$da7b], a
ld a, h
ld [$da7c], a
xor a
ld hl, $c827
ld bc, $0012
call $12c7
call $3331
xor a
ld [$c8b5], a
xor a
ld [$c88f], a
call Call_001_43e3
call $1c89
call Call_001_431a
ld hl, $8b00
ld de, $1202
call $098f
ld a, $fc
call $1688
call Call_001_4074
ld a, $07
ldh [$b5], a
ld a, $ff
ldh [$b6], a
ld a, $7f
ldh [rLYC], a
ld a, $63
ld [$c8a1], a
ld a, $01
ld [$c892], a
call $125d
ld a, $03
jp $11cb
Call_001_4074:
call Call_001_421c
call Call_001_42e4
call Call_001_4429
ld hl, $1702
rst $10
ld a, [$c8ab]
or a
call nz, Call_001_4c95
call Call_001_46f6
call Call_001_484e
ld hl, $0b02
rst $10
ld hl, $0b07
rst $10
call Call_001_4c10
ld a, [$c8a6]
push af
xor a
ld [$c8a6], a
ld hl, $0603
rst $10
pop af
ld [$c8a6], a
ld hl, $d7b6
ld a, l
ld [$d7b4], a
ld a, h
ld [$d7b5], a
xor a
ld [$d7ba], a
ld [$d7bb], a
ld [$d7b6], a
ldh a, [$8a]
ld [$d7b7], a
ldh a, [$8f]
add $00
ld [$d7b8], a
ld hl, $0200
rst $10
ld a, [$d7ba]
ldh [$8b], a
ldh a, [$92]
ldh [$a5], a
ldh a, [$93]
ldh [$a6], a
ldh a, [$95]
ldh [$a7], a
ldh a, [$96]
ldh [$a8], a
call $1e31
ld a, [$c968]
ld [$c96a], a
ld a, [$c969]
ld [$c96b], a
ld a, [$c969]
or a
jr nz, jr_001_4105
ld a, [$c968]
cp $5e
jr nz, jr_001_4105
ld hl, $5605
rst $10
jr jr_001_410b
jr_001_4105:
call $2518
call $25f1
jr_001_410b:
ld a, $01
ld [$c8ea], a
xor a
ld [$c8a8], a
xor a
ld [$c96c], a
xor a
ld [$c740], a
ld [$c741], a
ld a, $ff
ld [$c742], a
ldh a, [$b7]
ldh [$b9], a
ldh a, [$b8]
ldh [$ba], a
ldh a, [$bb]
ldh [$bd], a
ldh a, [$bc]
ldh [$be], a
ld hl, $010a
rst $10
ret
Jump_001_4139:
ld a, [$c88f]
cp $02
jp z, Jump_001_41dc
ld a, [$c850]
or a
ret nz
call Call_001_43e3
ld b, a
ld a, [$c81b]
cp b
jr z, jr_001_4155
ld hl, $c88e
inc [hl]
ret
jr_001_4155:
xor a
ldh [rBGP], a
ldh [rOBP0], a
ldh [rOBP1], a
ld hl, $9800
ld b, $00
jr_001_4161:
ld a, $e0
call $1ab9
call $1ab9
call $1ab9
call $1ab9
dec b
jr nz, jr_001_4161
call Call_001_4074
call $122f
ld a, [$c817]
ld l, a
ld h, $00
add hl, hl
add hl, hl
ld a, l
ld [$c85b], a
ld a, h
ld [$c85c], a
inc hl
ld a, l
ld [$c85d], a
ld a, h
ld [$c85e], a
inc hl
ld a, l
ld [$c85f], a
ld a, h
ld [$c860], a
inc hl
ld a, l
ld [$c861], a
ld a, h
ld [$c862], a
ld a, $b1
ld [$c777], a
ld a, [$c818]
ld [$c778], a
ld a, $ff
ld [$c774], a
ld hl, $0800
rst $10
call $1013
ld hl, $0802
rst $10
xor a
ld [$c842], a
ld [$c843], a
xor a
ld [$c846], a
ld [$c847], a
xor a
ld [$c848], a
ld [$c849], a
call Call_001_4dda
ld a, $02
ld [$c88f], a
ret
Jump_001_41dc:
xor a
ld [$c842], a
ld [$c843], a
xor a
ld [$c846], a
ld [$c847], a
xor a
ld [$c848], a
ld [$c849], a
call Call_001_4dda
xor a
ld [$c88f], a
ld hl, $c89b
ld a, $d2
ld [hl+], a
ld a, $d2
ld [hl+], a
ld a, $e2
ld [hl], a
ld hl, $c89e
ld a, [$c89b]
ld [hl+], a
ld a, [$c89c]
ld [hl+], a
ld a, [$c89d]
ld [hl], a
call $1660
ld a, $fd
call $1688
ret
Call_001_421c:
xor a
ld [$c8aa], a
xor a
ldh [$d3], a
ld a, $80
ldh [$d4], a
xor a
ld [$c915], a
ld [$c916], a
ld a, [$c8ea]
or a
ret nz
xor a
ld [$c93e], a
xor a
ld [$ca3f], a
xor a
ld [$c8ec], a
xor a
ld [$c8eb], a
xor a
ld [$d8d7], a
ld [$d8d8], a
ld a, $04
ld [$c8ee], a
ld hl, $0064
ld a, l
ld [$ca3b], a
ld a, h
ld [$ca3c], a
ld hl, $0014
ld a, l
ld [$ca3d], a
ld a, h
ld [$ca3e], a
ld hl, $d92a
ld bc, $00c0
ld a, $00
call $12c7
ld a, [$c969]
or a
jr nz, jr_001_427d
ld a, [$c968]
cp $08
jr z, jr_001_4291
jr_001_427d:
ld a, $d3
ld [$ca42], a
ld a, $d4
ld [$ca43], a
ld a, $d5
ld [$ca44], a
ld a, $d6
ld [$ca45], a
jr_001_4291:
ld a, [$c899]
ld [$ca4a], a
ld a, [$c8ab]
or a
ret nz
ld a, $00
ld [$ca8d], a
ld a, $ff
ld [$ca8e], a
ld a, $ff
ld [$ca8f], a
ld a, $ff
ld [$ca90], a
ld a, $00
ld [$ca4b], a
ld a, $00
ld [$ca4c], a
ld a, $00
ld [$ca4d], a
ld hl, $ca51
ld bc, $0014
ld a, $ff
call $12c7
ld hl, $ca65
ld bc, $0028
ld a, $ff
call $12c7
ld hl, $cac1
ld b, $14
ld de, $0095
jr_001_42dd:
ld [hl], $00
add hl, de
dec b
jr nz, jr_001_42dd
ret
Call_001_42e4:
ld a, [$c88e]
or a
jr nz, jr_001_42f6
ld a, [$c88f]
or a
jr z, jr_001_42f6
ld a, [$d9e9]
ld [$d988], a
jr_001_42f6:
xor a
ld [$d9e9], a
ld hl, $0b00
rst $10
ld a, [$c8b5]
ld b, a
push bc
call Call_001_432d
pop bc
cp b
call nz, $1ae1
ld a, [$c88f]
or a
ret nz
ld de, $2e00
ld hl, $8d00
call $14cf
ret
Call_001_431a:
ld hl, $2add
ld a, [hl]
ld [$c817], a
ld hl, $2ade
ld a, [hl]
ld [$c818], a
ld hl, $0801
rst $10
ret
Call_001_432d:
ld a, [$c969]
or a
jr nz, jr_001_4358
ld a, [$c968]
cp $50
jr c, jr_001_4346
cp $52
jr z, jr_001_4346
cp $5d
jr c, jr_001_4358
cp $61
jr nc, jr_001_4358
jr_001_4346:
ld hl, $4373
ld a, [$c968]
add l
ld l, a
ld a, $00
adc h
ld h, a
ld b, [hl]
ld a, b
cp $09
ret nz
ret
jr_001_4358:
ld a, [$c939]
ld b, a
ld a, [$c93a]
sub $02
cp b
ld a, $34
ret nz
ld hl, $4373
ld a, [$c93b]
add l
ld l, a
ld a, $00
adc h
ld h, a
ld a, [hl]
ret
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
ld e, $1e
ld sp, $0931
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
ld e, $1e
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
sbc l
inc [hl]
inc c
inc c
jr jr_001_43bd
inc c
ld l, $18
rrca
jr @+$14
ld l, $1b
ld [de], a
dec de
dec de
dec de
dec de
dec de
dec de
ld [de], a
dec de
inc c
rrca
ld [de], a
ld [de], a
jr_001_43bd:
dec d
dec d
jr jr_001_43dc
dec de
dec de
inc [hl]
inc [hl]
ld h, c
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
ld h, c
ld [bc], a
ld [bc], a
dec de
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
jr_001_43dc:
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
inc [hl]
Call_001_43e3:
ld a, [$c968]
ldh [$d5], a
ld a, [$c969]
ldh [$d6], a
ld a, [$c96c]
or a
jr z, jr_001_43fd
ld a, [$c96d]
ldh [$d5], a
ld a, [$c96e]
ldh [$d6], a
jr_001_43fd:
ldh a, [$d6]
or a
jr z, jr_001_4405
ld a, $00
ret
jr_001_4405:
ldh a, [$d5]
cp $5e
jr z, jr_001_4425
cp $5d
jr nz, jr_001_4412
ld a, $01
ret
jr_001_4412:
ldh a, [$d5]
cp $2f
jr nz, jr_001_441b
ld a, $02
ret
jr_001_441b:
ldh a, [$d5]
cp $30
ld a, $03
ret c
ld a, $00
ret
jr_001_4425:
ld a, [$c81b]
ret
Call_001_4429:
ld de, $2f00
ld hl, $8000
call $1577
ld de, $2e1d
ld hl, $8180
call $1577
xor a
ldh [$a1], a
ldh [$a2], a
ldh [$a3], a
ldh [$a4], a
ldh [$91], a
ldh [$94], a
ld a, [$c96c]
or a
jr z, jr_001_4464
ld a, [$c96f]
ldh [$92], a
ld a, [$c970]
ldh [$93], a
ld a, [$c971]
ldh [$95], a
ld a, [$c972]
ldh [$96], a
jr jr_001_4498
jr_001_4464:
ld a, [$c8ea]
or a
jp nz, Jump_001_44ba
ld hl, $ff8a
xor a
ld [hl+], a
ld [hl+], a
ld [hl+], a
ld [hl], a
ldh [$8f], a
ldh [$8e], a
ldh [$90], a
ld [$d7bd], a
ld a, [$c968]
ld l, a
ld h, $00
add hl, hl
add hl, hl
ld a, l
add $06
ld l, a
ld a, h
adc $45
ld h, a
ld a, [hl+]
ldh [$92], a
ld a, [hl+]
ldh [$93], a
ld a, [hl+]
ldh [$95], a
ld a, [hl]
ldh [$96], a
jr_001_4498:
ld b, $31
ld hl, $c973
jr_001_449d:
ldh a, [$92]
ld [hl+], a
ldh a, [$95]
ld [hl+], a
ldh a, [$93]
swap a
ld c, a
ldh a, [$96]
or c
ld [hl+], a
ldh a, [$8b]
ld c, a
ldh a, [$8d]
or c
ld [hl+], a
dec b
jr nz, jr_001_449d
xor a
ld [$ca37], a
Jump_001_44ba:
ldh a, [$92]
ldh [$a5], a
ldh a, [$93]
ldh [$a6], a
ldh a, [$95]
ldh [$a7], a
ldh a, [$96]
ldh [$a8], a
call $1e31
ldh a, [$92]
ld l, a
ldh a, [$93]
ld h, a
swap h
swap l
ld a, h
and $f0
ld h, a
ld a, l
and $0f
or h
ldh [$97], a
ldh a, [$95]
ld l, a
ldh a, [$96]
ld h, a
swap h
swap l
ld a, h
and $f0
ld h, a
ld a, l
and $0f
or h
ldh [$98], a
ldh a, [$92]
ldh [$99], a
ldh a, [$93]
ldh [$9a], a
ldh a, [$95]
ldh [$9b], a
ldh a, [$96]
ldh [$9c], a
ret
ld hl, sp+$00
ret c
nop
add sp, $00
cp b
nop
ld c, b
nop
jr c, jr_001_4512
jr_001_4512:
add sp, $00
ret z
nop
add sp, $00
xor b
nop
ld c, b
nop
jr c, jr_001_451e
jr_001_451e:
add sp, $00
jr c, jr_001_4522
jr_001_4522:
add sp, $00
jr c, jr_001_4526
jr_001_4526:
ld c, b
nop
jr c, jr_001_452a
jr_001_452a:
add sp, $00
ld c, b
nop
ld c, b
nop
jr c, jr_001_4532
jr_001_4532:
ld c, b
nop
jr c, jr_001_4536
jr_001_4536:
ld c, b
nop
ld c, b
nop
ld c, b
nop
jr c, jr_001_453e
jr_001_453e:
ld c, b
nop
jr c, jr_001_4542
jr_001_4542:
ld c, b
nop
jr c, jr_001_4546
jr_001_4546:
ld c, b
nop
jr c, jr_001_454a
jr_001_454a:
ld c, b
nop
jr c, jr_001_454e
jr_001_454e:
ld c, b
nop
jr c, jr_001_4552
jr_001_4552:
ld c, b
nop
jr c, jr_001_4556
jr_001_4556:
ld c, b
nop
jr c, jr_001_455a
jr_001_455a:
ld c, b
nop
jr c, jr_001_455e
jr_001_455e:
jr c, jr_001_4560
jr_001_4560:
jr c, jr_001_4562
jr_001_4562:
ld c, b
nop
jr c, jr_001_4566
jr_001_4566:
ld c, b
nop
jr c, jr_001_456a
jr_001_456a:
ld c, b
nop
ld e, b
nop
ld e, b
nop
ld l, b
nop
ld c, b
nop
jr c, jr_001_4576
jr_001_4576:
ld c, b
nop
jr c, jr_001_457a
jr_001_457a:
ld c, b
nop
jr c, jr_001_457e
jr_001_457e:
ld c, b
nop
jr c, jr_001_4582
jr_001_4582:
ld c, b
nop
jr c, jr_001_4586
jr_001_4586:
ld c, b
nop
jr c, jr_001_458a
jr_001_458a:
ld c, b
nop
jr c, jr_001_458e
jr_001_458e:
ld c, b
nop
jr c, jr_001_4592
jr_001_4592:
ld c, b
nop
jr c, jr_001_4596
jr_001_4596:
ld c, b
nop
jr c, jr_001_459a
jr_001_459a:
ld c, b
nop
jr c, jr_001_459e
jr_001_459e:
ld c, b
nop
jr c, jr_001_45a2
jr_001_45a2:
ld c, b
nop
jr c, jr_001_45a6
jr_001_45a6:
ld c, b
nop
jr c, jr_001_45aa
jr_001_45aa:
ld c, b
nop
jr c, jr_001_45ae
jr_001_45ae:
ld c, b
nop
jr c, jr_001_45b2
jr_001_45b2:
ld c, b