-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbank_055.asm
14169 lines (12922 loc) · 171 KB
/
bank_055.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 "crystalkaizo.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 $055", ROMX[$4000], BANK[$55]
db $ec
Jump_055_4001:
add hl, sp
rlca
inc c
inc c
inc sp
ccf
ld b, b
ld h, a
ld b, b
ld b, a
ld b, e
add b
rst $08
ld b, e
ld b, b
ld a, a
dec c
inc sp
ccf
dec c
dec c
ld b, $07
ld [$080c], sp
ld [$1910], sp
db $10
rra
ld b, e
ld [$030f], sp
ld b, $07
ld bc, $6701
ld [bc], a
ld bc, $0007
ld b, h
ld [$010f], sp
rlca
rlca
ld [hl], d
ld c, $01
nop
ld [bc], a
inc bc
ld [bc], a
ld [bc], a
inc b
dec b
inc b
ld b, $04
dec c
inc c
ld [hl], $34
ld b, e
ld b, a
ld h, h
ld b, e
add a
db $fc
add hl, de
ld b, e
ld a, [hl]
jp $f3fe
cp [hl]
rst $38
ld c, $d1
ld de, $91d1
ld sp, hl
adc c
ld a, h
ld e, h
di
jp $c07f
ccf
ldh [$1f], a
db $fc
dec bc
ei
or d
rst $18
inc b
add b
pop af
ld [hl], c
ld a, $0e
ld b, h
rst $38
nop
ld [bc], a
ldh [rNR31], a
inc e
ld b, l
rlca
inc b
ld b, e
rrca
ld [$330a], sp
inc a
ld l, e
ret nz
Jump_055_407f:
ld b, l
nop
dec hl
nop
ld e, a
nop
cp a
add h
add e
nop
ld a, a
add h
add e
ld d, h
rst $38
nop
ld bc, $fd80
ld b, e
add b
ld hl, sp+$0e
ld b, b
ld hl, sp+$40
db $fc
ret nz
ld a, h
ld b, b
ld a, $20
ccf
jr nz, jr_055_40b9
db $10
inc de
db $10
ld h, c
inc de
inc b
inc e
ld [bc], a
ld [hl+], a
ld b, c
ld b, c
add c
add c
ld hl, $f201
ld [bc], a
db $fc
inc c
ldh a, [rNR10]
ldh [rNR41], a
jr_055_40b9:
ldh [$60], a
ld b, e
ldh [rNR41], a
dec c
jp $cc43
ld c, a
ret nc
ld e, c
ret nc
ret nc
ldh [$30], a
ldh [$39], a
ldh [$3f], a
ld b, e
ldh a, [$1f]
inc bc
db $fc
rrca
rst $38
inc bc
ld b, l
cp $02
ld bc, $03fc
ld b, [hl]
rst $38
ld bc, $0005
rst $38
rlca
rst $38
ld [$a8fc], sp
pop hl
push bc
push af
ld b, e
ld a, a
nop
ld b, $fb
nop
di
nop
pop af
nop
ld sp, hl
ld l, [hl]
ldh [rNR44], a
inc bc
inc bc
inc b
ld b, $04
inc b
ld [$080c], sp
ld c, $08
rrca
add h
add a
ld h, h
rst $20
inc de
di
inc de
ld a, [c]
dec c
db $fc
dec de
ld hl, sp+$13
pop hl
ld [hl], $c3
ld a, $e2
ld a, h
or $9c
sub a
inc e
rla
ld b, e
ld c, $0b
inc bc
rrca
add hl, bc
rrca
ld [$1f43], sp
ld de, $fe04
ld [c], a
adc $82
ld e, $a4
ld bc, $0517
ld hl, sp+$18
ldh [$60], a
ldh [$a0], a
and l
nop
jp c, $f843
ld [$fc43], sp
inc b
ld b, e
cp $02
ld l, e
nop
ldh [$c3], a
and d
ld b, $7c
inc b
inc a
ld [bc], a
jr_055_414c:
ld a, $02
ld a, [hl]
push bc
sbc d
inc de
jr jr_055_414c
ldh [$e0], a
add b
add b
ldh a, [rSVBK]
adc h
db $fc
ld [bc], a
ld a, $02
ld e, $01
rra
ld bc, HeaderManufacturerCode
rst $38
ld b, e
ld [bc], a
cp $03
adc h
db $fc
ldh a, [$f0]
db $ec
dec h
rst $38
db $ec
dec l
ld [de], a
inc c
ld e, $27
ld hl, $4043
ld b, c
add d
pop bc
and [hl]
pop bc
cp [hl]
ld h, e
jr_055_4181:
sbc h
ld a, a
ld b, b
ccf
ld hl, $240c
ld e, $10
inc de
dec e
ld c, $09
rrca
ld [$090e], sp
ld bc, $070f
rlca
ld b, $07
rlca
inc b
inc bc
ld b, e
ld [bc], a
ld bc, $0102
nop
ld bc, $25ec
ld bc, $0101
res 0, b
inc de
add b
add c
add b
ld b, d
jp nz, $c442
ld b, h
add b
ld c, b
ld [$0888], sp
ld [$080a], sp
ld bc, $0604
inc b
add h
pop de
ld [bc], a
add c
add b
add b
inc hl
ret nz
dec c
ldh a, [$30]
db $fc
inc e
db $db
ccf
cp a
ld a, e
rst $30
ld sp, hl
rst $38
pop af
ld e, l
db $e3
sub c
sla e
ld [bc], a
nop
nop
inc hl
inc b
ld d, $05
ld [bc], a
ld [bc], a
inc c
inc e
jr c, @+$7a
ld [hl], b
ret z
jr z, jr_055_41f9
db $fc
ret nc
jr_055_41eb:
adc $f0
db $76
ld l, b
ld e, $18
inc [hl]
inc [hl]
ld b, b
ret nz
ld h, e
ld [bc], a
ld a, [bc]
nop
jr_055_41f9:
dec d
add a
db $ed
inc b
nop
ld d, b
jr nz, jr_055_4181
ld b, b
and e
nop
add e
dec d
ret nz
add b
ld hl, $3f40
ld sp, $2f3f
ccf
jr nz, @+$01
ret nz
adc a
ldh a, [$57]
ld hl, sp+$6f
cp h
db $fd
sbc [hl]
rst $38
sbc [hl]
ld l, e
inc bc
inc e
inc a
ld b, e
jp $e283
dec b
ld [bc], a
ld bc, $0f17
jr nz, jr_055_41eb
or a
nop
ld e, h
ld [bc], a
ld bc, $0200
add e
db $dd
sub h
sbc [hl]
add hl, bc
xor b
nop
push af
nop
rst $38
add b
rst $38
ld h, b
rst $38
jr_055_4240:
rra
ld b, l
rst $38
nop
nop
rst $38
ld l, d
rlca
ld b, $0e
ld de, $4031
ld b, b
add b
add b
xor b
call nz, $001e
dec b
nop
dec bc
nop
rlca
nop
dec bc
ld bc, $0307
ld c, $07
ld d, h
ld c, $ac
ld c, $5e
rrca
rst $30
rrca
ld a, a
rlca
ld a, a
inc bc
cp a
ld bc, $007f
rst $38
nop
ld b, e
ld a, a
nop
ld [bc], a
scf
nop
ld a, [hl+]
call nz, $f900
add hl, de
dec b
nop
ld a, [bc]
nop
cpl
nop
ld d, a
nop
cp a
nop
ld l, a
inc d
db $fd
dec de
rst $18
ldh [rIE], a
nop
db $fd
inc bc
rst $38
dec b
rst $38
ld bc, $02fe
xor a
nop
call nz, $2023
inc h
db $10
dec b
ld h, b
ld [hl], b
db $10
ldh a, [$08]
ld hl, sp+$43
ld [$e0f0], sp
ld hl, $b0d0
ldh a, [$78]
inc c
ld c, $1e
ld [bc], a
rlca
rst $38
rra
cp $1e
ld l, b
sbc h
or b
ldh a, [$e0]
ret nc
ret nz
jr nz, jr_055_4240
ld b, b
ldh a, [$30]
xor b
ld [$04d4], sp
xor h
inc b
sub $02
ld a, [$0244]
cp $0f
call c, $fe26
dec d
rst $28
add hl, de
rst $38
ld hl, $c2bc
ld hl, sp+$04
ld hl, sp+$18
ret nz
ldh [$65], a
rst $38
db $ec
ld [hl], l
rlca
rlca
rlca
dec c
dec bc
rrca
ld de, $161b
ld b, l
rra
db $10
add hl, bc
rrca
ld [$090e], sp
ld b, $05
inc bc
ld [bc], a
ld bc, $7701
add hl, bc
ld bc, $0601
rlca
ld [$120f], sp
jr jr_055_431b
db $10
ld b, a
ccf
jr nz, @-$1e
dec hl
rra
db $10
rla
jr jr_055_431d
rrca
inc bc
inc bc
jr jr_055_432e
inc a
inc a
ld h, $3e
ld [de], a
jr_055_431b:
ld e, $0b
jr_055_431d:
rrca
rlca
ld c, $09
db $10
rla
jr z, jr_055_43a4
ld c, b
ccf
ld b, d
db $fd
add a
ld a, a
add b
xor a
nop
jr_055_432e:
ld e, a
nop
or b
nop
ld b, b
nop
add b
nop
adc [hl]
nop
ld b, l
rra
nop
dec bc
rrca
add b
add a
add b
ret nz
ret nz
jr nz, jr_055_4364
Call_055_4344:
jr nc, jr_055_437e
add hl, sp
daa
ld b, e
ld e, $12
dec d
dec c
dec c
ld bc, $0301
ld [bc], a
dec b
ld b, $08
rrca
jr c, jr_055_438f
sub $c1
dec bc
ldh [rTAC], a
ld hl, sp-$7d
ld a, h
ld b, e
inc a
ld b, a
pop hl
jr_055_4364:
ld e, $1c
jp $833c
ld a, l
ld b, $fe
ld hl, sp-$08
jr nc, jr_055_43a0
ld a, b
ld a, b
ld c, h
ld a, h
inc h
jr_055_4375:
inc a
db $e4
db $fc
add sp, $38
db $fc
inc [hl]
cp [hl]
ld b, d
jr_055_437e:
cp $42
rst $38
ld bc, $44fe
ld bc, $04ff
cp $01
rst $38
nop
ccf
add l
reti
nop
jr_055_438f:
nop
jr_055_4390:
ld b, l
adc a
nop
jr_055_4393:
ld b, e
rra
ld bc, $3a15
jr_055_4398:
ld b, $e6
ld a, [de]
rst $38
pop af
sbc a
ld sp, hl
sbc e
jr_055_43a0:
db $fd
ld d, $f6
db $10
jr_055_43a4:
ldh a, [$c8]
jr c, jr_055_4390
jr jr_055_4422
adc b
jr c, jr_055_4375
ld b, e
jr jr_055_4398
ld b, e
sub b
ld [hl], b
ld bc, $30d0
ld b, e
ldh [rNR41], a
ld bc, $40c0
cp e
nop
adc d
ld h, c
ld bc, $e0e0
and e
nop
add h
inc bc
ld hl, sp+$08
jr c, jr_055_4393
and e
jr_055_43cc:
nop
add d
ld bc, $10f0
add e
or e
add e
or c
db $ec
sbc l
dec c
inc bc
inc bc
ccf
inc a
ld a, a
ld b, b
ld e, a
ld h, b
ld a, a
ld b, b
ccf
Jump_055_43e3:
jr nc, jr_055_4404
db $10
rst $00
ld bc, $6303
ld [$0303], sp
rlca
rlca
dec b
rlca
add hl, bc
rrca
add hl, bc
adc d
nop
ret
dec b
rst $38
add a
ld sp, hl
rlca
xor a
ld [bc], a
sub e
nop
jp c, Jump_055_4001
ld b, b
jr_055_4404:
add a
nop
ldh a, [$0d]
rra
inc de
dec c
dec c
inc bc
ld [bc], a
inc b
rlca
ld [$f40f], sp
di
ld a, [bc]
pop hl
add l
ld bc, $630a
dec b
inc c
inc c
sbc [hl]
sbc [hl]
sub d
sbc [hl]
adc l
jr_055_4422:
ld bc, $4726
rst $38
nop
sbc e
ld bc, $033c
dec de
db $fd
ld d, $f6
jp $a201
adc l
ld bc, $0162
ret nc
jr nc, jr_055_43cc
ld bc, $05a4
add b
add b
ldh [$60], a
db $fc
inc e
and a
ld [bc], a
ld c, [hl]
adc c
ld bc, $05a2
ld a, a
ld c, d
ccf
ld b, l
rst $38
add b
adc c
nop
sub $ff
db $ec
dec h
inc bc
jr nc, jr_055_44d0
ld b, $87
dec h
add b
dec b
nop
ld a, b
ld b, b
ld b, [hl]
ld b, b
ld b, c
inc hl
jr nz, jr_055_4489
db $10
ld bc, $0808
inc hl
inc b
inc bc
ld [bc], a
ld [bc], a
ld bc, $ec01
ld b, c
dec b
add b
ret nz
jr nz, jr_055_44a8
ld [$840c], sp
rrc b
add b
nop
ld b, b
ld b, b
jr nz, jr_055_4483
jr_055_4483:
stop
db $10
and h
add e
inc e
jr_055_4489:
inc b
jr nz, jr_055_4490
ld d, h
ld [bc], a
xor b