-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbank_01f.asm
14186 lines (12501 loc) · 170 KB
/
bank_01f.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 "bluekaizo.gb"
; 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 $01f", ROMX[$4000], BANK[$1f]
rst $38
rst $38
rst $38
rlca
db $fd
ld b, d
rlca
ld bc, $0743
dec b
ld b, e
rlca
add hl, bc
ld b, e
rlca
dec c
ld b, e
rlca
jr nz, jr_01f_4058
rlca
inc h
ld b, e
rlca
dec hl
ld b, e
rlca
cpl
ld b, e
rlca
inc sp
ld b, e
rlca
scf
ld b, e
rlca
dec sp
ld b, e
rlca
ccf
ld b, e
rlca
ld b, e
ld b, e
rlca
ld b, a
ld b, e
rlca
ld c, [hl]
ld b, e
rlca
ld d, l
ld b, e
rlca
ld e, c
ld b, e
rlca
ld e, l
ld b, e
add h
db $fc
ld c, c
dec b
Jump_01f_4040:
dec bc
ld c, d
rlca
ld a, [de]
ld c, d
add h
inc c
ld c, h
dec b
rra
ld c, h
rlca
ld [hl-], a
ld c, h
add h
add c
ld c, e
dec b
sub b
ld c, e
rlca
sbc [hl]
ld c, e
add h
jr_01f_4058:
dec de
ld c, c
dec b
ld a, [hl-]
ld c, c
rlca
ld e, c
ld c, c
add h
jp z, $054c
jp hl
ld c, h
rlca
ld [$844d], sp
xor d
ld c, d
dec b
cp l
ld c, d
rlca
rst $08
ld c, d
add h
ld d, h
ld c, d
dec b
ld l, [hl]
ld c, d
rlca
ld l, a
ld c, d
add h
add d
ld c, d
dec b
sub c
ld c, d
rlca
and b
ld c, d
add h
sbc d
ld c, h
dec b
xor l
ld c, h
rlca
ret nz
ld c, h
add h
and h
ld b, a
dec b
pop bc
ld b, a
rlca
ld [c], a
ld b, a
add h
ccf
ld c, h
dec b
ld e, [hl]
ld c, h
rlca
add c
ld c, h
add h
ret nc
Call_01f_40a1:
ld c, d
dec b
ei
ld c, d
rlca
ld a, [de]
ld c, e
add h
inc sp
ld c, e
dec b
ld e, d
ld c, e
rlca
add b
ld c, e
add h
sbc a
ld c, e
dec b
cp [hl]
ld c, e
rlca
db $ed
ld c, e
add h
inc h
ld c, d
dec b
scf
ld c, d
rlca
ld c, d
ld c, d
Call_01f_40c3:
add h
ld h, [hl]
ld c, c
Call_01f_40c6:
dec b
add c
ld c, c
rlca
sbc h
ld c, c
add h
xor h
ld c, c
dec b
rst $08
ld c, c
rlca
ld a, [c]
ld c, c
add h
adc b
ld c, b
dec b
and a
ld c, b
rlca
jp z, $8448
and b
ld c, l
dec b
or e
ld c, l
Jump_01f_40e4:
rlca
Jump_01f_40e5:
add $4d
Jump_01f_40e7:
add h
db $d3
ld c, l
dec b
xor $4d
rlca
add hl, bc
ld c, [hl]
add h
inc e
ld c, [hl]
dec b
dec hl
ld c, [hl]
rlca
ld a, [hl-]
ld c, [hl]
add h
xor d
ld c, [hl]
dec b
push bc
ld c, [hl]
rlca
ldh [$4e], a
add h
dec a
ld c, l
dec b
ld c, h
ld c, l
rlca
ld e, e
ld c, l
add h
di
ld c, [hl]
dec b
ld b, $4f
rlca
add hl, de
ld c, a
add h
inc bc
ld d, b
dec b
ld h, $50
rlca
ld c, c
ld d, b
add h
dec de
ld c, l
dec b
ld a, [hl+]
ld c, l
rlca
inc a
ld c, l
add h
ld [hl], h
ld c, a
dec b
adc a
ld c, a
rlca
xor d
ld c, a
add h
ld h, l
ld c, l
dec b
ld a, h
ld c, l
rlca
sub e
ld c, l
add h
ld h, $4f
dec b
ld c, c
ld c, a
rlca
ld h, h
ld c, a
add h
cp l
ld c, a
dec b
ret c
ld c, a
rlca
di
ld c, a
add h
ld b, h
ld c, [hl]
dec b
ld h, a
ld c, [hl]
rlca
adc [hl]
ld c, [hl]
add h
ld e, h
ld d, b
dec b
ld l, a
ld d, b
rlca
add d
ld d, b
add h
adc a
ld d, b
dec b
and d
ld d, b
rlca
or l
ld d, b
add h
jp nz, $0550
push hl
ld d, b
rlca
rlca
ld d, c
add h
ld [$0551], sp
dec de
ld d, c
rlca
ld l, $51
add h
ei
ld b, a
dec b
ld [de], a
ld c, b
rlca
dec h
ld c, b
add h
ld [hl-], a
ld c, b
dec b
ld d, l
ld c, b
rlca
ld a, b
ld c, b
add h
ldh [rOBP0], a
dec b
rst $30
ld c, b
rlca
ld c, $49
add h
ld d, b
ld l, b
dec b
ld h, a
ld l, b
ld b, $77
ld l, b
add h
jr z, jr_01f_420c
dec b
ld b, a
ld l, [hl]
ld b, $5f
ld l, [hl]
Call_01f_41a4:
inc b
di
ld b, e
inc b
sub b
ld b, h
inc b
or d
ld b, h
rlca
jp $0443
ld c, e
Call_01f_41b2:
ld b, h
add h
jp c, $056d
di
ld l, l
ld b, $09
ld l, [hl]
add h
ld [hl], h
ld l, [hl]
dec b
sub e
Call_01f_41c1:
ld l, [hl]
ld b, $af
ld l, [hl]
inc b
sbc a
ld b, h
inc b
rst $00
ld b, h
inc b
sub $44
inc b
dec b
ld b, l
inc b
jr jr_01f_4219
inc b
dec hl
ld b, l
inc b
ld b, [hl]
ld b, l
inc b
ld e, l
ld b, l
inc b
ld [hl], d
ld b, l
inc b
adc l
ld b, l
inc b
xor b
ld b, l
inc b
or e
ld b, l
rlca
cp [hl]
ld b, l
rlca
bit 0, l
ld b, h
db $fc
ld b, l
dec b
inc de
ld b, [hl]
inc b
ld h, $46
rlca
ld sp, $4446
ld c, d
ld b, [hl]
dec b
ld l, c
ld b, [hl]
inc b
adc b
ld b, [hl]
rlca
jp z, $0743
jp c, Jump_01f_4443
pop hl
jr_01f_420c:
ld b, e
dec b
add sp, $43
ld b, h
inc b
ld b, h
dec b
dec bc
ld b, h
ld b, h
ld d, $44
jr_01f_4219:
dec b
ld hl, $0444
jr nc, @+$46
rlca
dec sp
ld b, h
ld b, h
ld e, [hl]
ld b, h
dec b
ld [hl], l
ld b, h
rlca
and l
ld b, [hl]
inc b
cp [hl]
ld b, [hl]
inc b
ret
ld b, [hl]
rlca
call nc, $0746
sbc $46
rlca
push hl
ld b, [hl]
inc b
push af
ld b, [hl]
inc b
inc b
ld b, a
ld b, h
rrca
ld b, a
dec b
ld e, $47
inc b
dec l
ld b, a
ret nz
ret nz
ld h, h
ld bc, $6578
ld [bc], a
ld b, e
ld h, [hl]
inc bc
db $eb
ld h, [hl]
add b
rra
ld a, h
ld bc, $7d5f
ld [bc], a
jp nz, $807e
xor a
ld a, e
ld bc, $7bda
ld [bc], a
db $fc
ld a, e
add b
cp c
ld l, [hl]
ld bc, $6f05
ld [bc], a
ld d, d
ld l, a
ld b, b
ld a, l
ld a, e
ld bc, $7b9a
ret nz
cp e
ld e, e
ld bc, $5c6c
ld [bc], a
inc d
ld e, l
inc bc
ld l, b
ld e, [hl]
add b
add hl, de
ld a, d
ld bc, $7a9c
ld [bc], a
ld a, [$807a]
jr_01f_428c:
dec bc
ld h, d
ld bc, $62df
ld [bc], a
adc e
ld h, e
ret nz
ld b, h
ld a, b
ld bc, $78bc
ld [bc], a
dec e
ld a, c
inc bc
ld e, e
ld a, c
ret nz
pop de
ld e, [hl]
ld bc, $5fde
ld [bc], a
call c, $0360
adc d
ld h, c
ret nz
add a
jr_01f_42ae:
ld l, b
ld bc, $68d8
ld [bc], a
jr_01f_42b3:
dec sp
jr_01f_42b4:
ld l, c
inc bc
call c, $c069
pop af
ld l, c
jr_01f_42bb:
ld bc, $6b68
ld [bc], a
ld a, d
ld l, h
inc bc
db $e4
ld l, h
ret nz
rrca
ld l, l
ld bc, $6d40
ld [bc], a
ld a, [hl]
ld l, l
inc bc
or b
ld l, l
add b
ld c, d
ld [hl], b
ld bc, $70e3
ld [bc], a
sbc d
ld [hl], c
add b
ld b, e
ld [hl], d
ld bc, $7409
ld [bc], a
cp [hl]
ld [hl], l
add b
jr_01f_42e3:
sbc l
db $76
ld bc, $76ba
jr_01f_42e8:
ld [bc], a
and $76
add b
ld sp, hl
db $76
ld bc, $771c
ld [bc], a
ld c, e
ld [hl], a
add b
ld a, e
ld [hl], a
ld bc, $77a2
ld [bc], a
jp nc, $2077
pop bc
inc sp
rst $38
jr nz, jr_01f_42b4
inc sp
rst $38
jr nz, @-$5d
inc sp
rst $38
jr nz, jr_01f_428c
inc sp
rst $38
daa
add h
scf
ld h, $84
ld [hl], $25
add e
dec [hl]
inc h
add e
inc [hl]
inc hl
add d
inc sp
ld [hl+], a
add c
ld [hl-], a
rst $38
jr nz, jr_01f_4373
ld a, [hl+]
rst $38
ld hl, $2b41
jr nz, @+$63
ld a, [hl+]
rst $38
jr nz, jr_01f_42ae
db $10
rst $38
jr nz, jr_01f_42b3
inc hl
rst $38
jr nz, @-$7c
dec h
rst $38
jr nz, jr_01f_42bb
ld h, $ff
jr nz, @-$5d
db $10
rst $38
jr nz, jr_01f_42e3
ld de, $20ff
and d
ld d, b
rst $38
Jump_01f_4347:
jr nz, @-$5d
jr jr_01f_436b
ld sp, $ff33
ld [hl+], a
sub c
jr z, jr_01f_4372
ld [hl], c
jr @+$01
jr nz, jr_01f_42e8
ld [hl+], a
rst $38
jr nz, jr_01f_43cc
ld [hl+], a
rst $38
jr nz, jr_01f_43c0
ld [hl+], a
rst $38
ld [hl], e
ld b, e
add e
ld b, e
sub e
ld b, e
Jump_01f_4367:
and e
ld b, e
or e
ld b, e
jr_01f_436b:
jp $c343
ld b, e
jp $c343
jr_01f_4372:
ld b, e
jr_01f_4373:
ld [bc], a
ld b, [hl]
adc d
adc $ff
cp $ed
call c, $a9cb
add a
ld h, l
ld b, h
inc sp
ld [hl+], a
ld de, $4602
adc d
adc $ef
rst $38
cp $ee
db $dd
res 5, c
add a
ld h, l
ld b, e
ld [hl+], a
ld de, $6913
cp l
xor $ee
rst $38
rst $38
db $ed
sbc $ff
rst $38
xor $ee
db $db
jr_01f_43a1:
sub [hl]
ld sp, $4602
adc d
call $feef
jr_01f_43a9:
sbc $ff
xor $dc
cp d
sbc b
db $76
jr_01f_43b0:
ld d, h
ld [hl-], a
db $10
ld bc, $4523
ld h, a
adc d
call $f7ee
ld a, a
xor $dc
xor b
db $76
Call_01f_43c0:
jr_01f_43c0:
ld d, h
ld [hl-], a
Call_01f_43c2:
db $10
Jump_01f_43c3:
ld hl, $33e2
jr_01f_43c6:
jr z, jr_01f_43a9
ld [hl+], a
jr_01f_43c9:
rst $38
ld [hl+], a
rst $30
jr_01f_43cc:
inc h
ld [hl+], a
rst $30
inc [hl]
inc h
rst $30
ld b, h
jr z, jr_01f_43c9
ld d, l
Jump_01f_43d6:
jr z, jr_01f_43c9
ld b, h
rst $38
add hl, hl
pop af
ld b, h
jr z, jr_01f_43b0
ld b, e
jr_01f_43e0:
rst $38
jr_01f_43e1:
db $ec
ld [bc], a
Jump_01f_43e3:
jr z, jr_01f_43c6
ld b, b
rlca
rst $38
jr_01f_43e8:
db $ec
ld [bc], a
ld [hl+], a
ld [$0000], sp
jr z, jr_01f_43a1
ld b, c
rlca
rst $38
db $ec
ld [bc], a
db $10
ld a, [hl-]
inc h
ld a, [c]
nop
ld [bc], a
db $10
ld [hl+], a
jr z, jr_01f_43e1