-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank_023.asm
executable file
·14877 lines (13885 loc) · 159 KB
/
bank_023.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 $023", ROMX[$4000], BANK[$23]
inc hl
dec a
ld b, b
ret
ld b, l
db $eb
ld b, [hl]
rrca
ld c, b
ld l, d
ld c, d
inc l
ld c, e
ldh a, [rWX]
rrca
ld d, d
jr nc, @+$55
ld c, a
ld d, h
ld l, h
ld d, l
sbc a
ld e, d
xor h
ld e, e
cp e
ld e, h
ld a, [de]
ld e, a
ld e, c
ld h, b
and d
ld h, c
ld e, h
ld h, a
ld l, d
ld l, b
ld a, h
ld l, c
ld h, $6f
inc hl
ld [hl], b
ld c, b
ld [hl], c
and [hl]
ld [hl], c
push bc
ld [hl], c
inc bc
ld [hl], l
cp d
ld [hl], l
ld c, b
db $76
ret
db $76
sub d
ld [hl], a
nop
ld [$2041], sp
inc a
jr nz, jr_023_4074
rst $38
rst $38
rrca
call z, $1b15
rst $38
di
ld d, $1a
inc de
dec e
jr nz, @+$3a
ld b, c
ld [bc], a
nop
jp nz, $8273
add d
rst $38
rst $38
ld h, $3a
db $ec
db $f4
jr nz, jr_023_409f
ld b, c
ld [bc], a
nop
or h
call nc, $ecdc
rst $18
rst $20
ld l, $32
scf
add hl, sp
ld b, c
jr nz, jr_023_4073
ld [hl], d
ld d, e
jr_023_4073:
ld e, d
jr_023_4074:
ld l, e
rst $28
rst $30
ld h, $3a
di
db $fd
ld b, c
jr nz, jr_023_4080
ld c, $ca
jr_023_4080:
ld a, [de]
ld d, $f7
rst $28
ld h, l
ld e, l
rst $08
cp a
ld b, c
jr nz, jr_023_408d
dec c
dec bc
jr_023_408d:
dec de
rla
ei
rst $20
ld [hl], h
ld c, h
db $ec
sbc h
ld b, c
jr nz, @+$04
rlca
and $15
sub l
rst $38
rst $38
ld h, h
jr_023_409f:
ld e, h
scf
cpl
ld b, c
Jump_023_40a3:
jr nz, jr_023_40a7
ld a, [c]
inc sp
jr_023_40a7:
xor d
jp c, $cfff
ld l, b
ld e, [hl]
ret z
cp b
jp c, $eaba
ld a, [$2b3a]
jr c, jr_023_40e0
inc sp
ld h, $31
inc h
dec [hl]
jr nz, jr_023_40fa
add hl, hl
dec l
ld l, $2b
cpl
cpl
db $eb
rrca
set 4, [hl]
ld [hl-], a
add $12
sub $02
ld e, $ca
and b
ld h, b
ldh [$e3], a
ret nz
rst $08
ld b, b
ld c, a
add b
sbc a
add b
sbc a
add b
sbc e
add b
adc [hl]
nop
jr_023_40e0:
ldh a, [rP1]
db $fc
nop
rst $38
ld b, c
or h
ld bc, $0077
db $dd
nop
ld [$0f00], a
nop
ccf
ld b, c
or h
inc bc
rst $30
nop
cp l
nop
ld d, a
dec b
jr_023_40fa:
ld b, $07
rst $00
inc bc
di
ld [bc], a
ld a, [c]
ld bc, $01f9
ld a, c
ld bc, $01d9
ld [hl], c
or h
ld [hl], h
call nc, $f4f4
rst $10
jr_023_410f:
ldh a, [$d3]
ld h, a
ld c, h
ld h, e
ld c, b
ld l, e
ld b, b
jr_023_4117:
ld a, b
ld d, e
ld e, e
ld e, l
ld d, [hl]
ld e, [hl]
ld e, h
call nc, $941c
call z, $8c64
inc h
xor h
inc b
inc a
sub h
ret
adc $fc
cp l
cp h
jp nz, Jump_023_6063
inc e
dec de
ld [hl], a
ld l, a
db $db
cp h
rst $30
rst $28
sub a
ld a, e
and $11
dec sp
ld b, h
rst $38
nop
rra
ldh [$f3], a
db $fc
db $ec
rra
rst $30
ei
rla
jr jr_023_4117
call z, Call_023_7fb8
and $1f
rst $18
jr c, jr_023_410f
ld h, a
ld l, h
call c, $b0d0
cp a
ret nz
cp $bb
sbc $be
ld l, [hl]
sbc $b5
ld a, a
set 1, l
dec bc
ld [$0707], sp
db $fd
inc bc
ld a, a
db $dd
ld a, e
ld a, l
db $76
ld a, e
xor l
cp $d3
or e
ret nc
db $10
ldh [$e0], a
add sp, $18
jr_023_417b:
db $d3
inc sp
dec e
cp $67
ld hl, sp-$05
inc e
db $dd
and $36
dec sp
dec bc
dec c
jp hl
sbc $67
adc b
call c, $ff22
nop
ld hl, sp+$07
rst $08
ccf
scf
ld hl, sp-$11
rst $18
sub e
ld [hl], e
ccf
cp l
dec a
ld b, e
add $06
jr c, jr_023_417b
rst $28
rst $30
db $db
dec a
rst $28
rst $30
jr c, jr_023_41d8
ld a, [hl-]
ld l, $38
inc l
ld a, [hl+]
ld a, [hl-]
dec sp
dec sp
ld d, [hl]
ld l, a
cp a
ret nz
cp e
rst $38
ld c, $da
ld l, $3b
ld c, $1b
ld a, [hl+]
ld a, $ef
rst $28
or l
ld a, e
cp $01
xor $ff
add b
sub l
add b
adc d
ret nz
call nz, $c1c0
ld h, b
ldh [$7f], a
ld a, a
ldh a, [$f0]
ret nz
jr_023_41d8:
rst $00
nop
ld d, b
nop
add b
nop
jr nz, @+$43
db $fc
ldh a, [$80]
add b
ld [hl], b
ld [hl], b
rrca
adc a
nop
ld a, [bc]
nop
ld bc, $0400
ld b, c
db $fc
ldh a, [rSB]
ld bc, $0e0e
ldh a, [$f1]
ld bc, $01a9
ld d, c
inc bc
inc hl
inc bc
add e
ld b, $07
cp $fe
rrca
rrca
inc bc
db $e3
ld [hl], b
ld e, e
ld [hl], h
call c, $d870
ld d, h
ld a, h
rst $30
rst $30
xor l
sbc $7f
add b
ld [hl], a
rst $38
inc e
or h
ld e, h
ld [hl], h
inc e
inc [hl]
ld d, h
ld e, h
call c, Call_023_6adc
or $fd
inc bc
db $dd
rst $38
db $fd
db $e4
rst $18
call nz, $c6dd
call $cad4
db $d3
and d
cp e
and d
cp e
ld [c], a
ld [$13df], a
db $fd
ld de, $31dd
reti
dec d
xor c
ld h, l
and e
ld l, a
inc hl
rst $28
inc hl
xor e
ei
ret z
cp a
adc b
cp e
adc h
sbc e
xor b
jr_023_424f:
sub l
Call_023_4250:
and [hl]
push bc
or $c4
rst $30
call nz, $bfd5
daa
ei
inc hl
cp e
ld h, e
or e
dec hl
ld d, e
bit 0, l
db $dd
ld b, l
db $dd
ld b, a
ld d, a
rst $08
jr_023_4268:
jr nz, @+$0b
rst $20
ld c, $e7
jr jr_023_428e
db $e3
ccf
call $977d
rst $30
cp h
rst $38
ccf
rst $38
ret nz
jr_023_427a:
rst $38
rra
rst $38
push af
push af
ld e, a
ld e, a
ldh [rIE], a
nop
ldh [rP1], a
nop
rst $38
db $fc
inc bc
rst $38
ld hl, sp-$01
ld d, a
jr_023_428e:
ld d, a
db $fd
db $fd
rlca
rst $38
nop
rlca
nop
nop
jr_023_4297:
adc a
ld h, b
adc b
rst $20
ld l, b
rst $20
jr jr_023_4297
call nz, Call_023_72fc
ld a, [hl]
reti
rst $18
dec [hl]
rst $30
rst $38
rst $38
add b
rst $38
rst $38
rst $38
sub h
push de
sbc h
db $dd
rst $38
rst $38
add b
ld b, c
add d
jr nz, @+$01
nop
rst $38
rst $38
rst $38
jr z, jr_023_4268
jr c, jr_023_427a
rst $38
rst $38
nop
ld b, c
sub d
jr nz, @+$01
add c
ld sp, hl
add c
Jump_023_42ca:
pop bc
ld b, c
add b
jr nz, jr_023_424f
add b
xor d
xor d
ld b, c
adc [hl]
jr nz, jr_023_42d8
ld a, [c]
ld [bc], a
jr_023_42d8:
add d
ld b, c
sub b
jr nz, jr_023_42dd
jr_023_42dd:
nop
jr_023_42de:
ld b, c
xor h
ld [hl+], a
ld b, c
sub d
jr_023_42e3:
jr nz, @+$16
ld d, l
inc e
ld e, l
ld b, c
sbc d
inc h
ld bc, $ffff
rst $38
add hl, hl
xor e
jr_023_42f1:
add hl, sp
cp e
rst $38
rst $38
ld bc, $d241
jr nz, jr_023_433b
sub c
ld hl, $5555
ld b, c
or [hl]
ld [hl+], a
ld b, c
sbc $2e
sbc l
sub l
adc b
adc b
add b
sbc a
add b
cp a
cp a
add b
add b
cp a
ld b, c
sub b
jr nz, jr_023_42f1
ld d, l
adc c
adc c
ld bc, $01f9
db $fd
db $fd
ld bc, $fd01
ld b, c
sub b
jr nz, jr_023_42de
xor d
sub c
sub c
ld b, c
inc b
jr c, jr_023_42e3
xor c
ld de, $4111
inc d
jr c, jr_023_4389
call c, $d850
pop af
ld sp, hl
ld h, e
ld [hl], e
db $e3
di
rlca
jr_023_433b:
rst $30
rlca
rlca
rst $38
rst $38
ccf
ccf
rst $38
rst $38
ldh a, [$f0]
rst $08
rst $08
sbc e
sbc h
sub b
sub e
jr jr_023_4366
rst $38
rst $38
db $fc
db $fc
rst $38
rst $38
rrca
rrca
di
di
reti
add hl, sp
add hl, bc
ret
ld b, c
ld e, h
jr nc, jr_023_437e
ccf
ld c, $1f
adc l
sbc l
push bc
jr_023_4366:
call $cfc7
ldh [$ef], a
ldh [$e0], a
rst $38
rst $38
adc b
rst $28
adc b
call z, $a041
inc h
ld b, c
add b
jr nc, jr_023_438a
ld e, $10
jr @+$01
jr_023_437e:
rst $38
ld [bc], a
db $e3
ld b, c
or h
jr nz, jr_023_438d
adc [hl]
ld [$ff0c], sp
jr_023_4389:
rst $38
jr_023_438a:
ld [bc], a
di
ld [bc], a
jr_023_438d:
add e
ld b, c
or [hl]
ld [hl+], a
ld b, c
and $20
rst $38
rst $38
dec b
push hl
dec b
dec b
ld b, c
ret nc
jr nz, @+$03
ld bc, $e641
jr nz, jr_023_43b3
sbc $10
sbc b
ld b, c
and b
inc [hl]
db $10
rst $18
db $10
sbc b
ld hl, $213d
ld sp, $ffff
jr_023_43b3:
dec b
rst $00
ld b, c
or h
jr nc, jr_023_43ca
dec e
ld de, $ff19
rst $38
add a
or a
add e
cp e
ret nz
sbc $f0
or $ff
rst $38
add h
or [hl]
jr_023_43ca:
ld b, c
adc [hl]
jr nz, @-$1d
db $ed
pop bc
db $dd
ld bc, $0779
ld h, a
rst $38
rst $38
ld hl, $ff6d
rst $38
rst $08
and b
adc b
rst $20
adc b
rst $20
add b
add b
ld hl, sp-$7a
ret nz
cp [hl]
ret nz
cp [hl]
add b
add b
rst $08
jr nz, jr_023_43f6
rst $20
ld [$00e7], sp
nop
db $fc
ld [bc], a
add b
jr_023_43f6:
ld a, [hl]
add b
ld a, [hl]
nop
nop
rst $08
ld hl, $e709
add hl, bc
rst $20
ld bc, $ff01
ld bc, $7f81
add c
ld a, a
ld bc, $7f01
ld a, a
rst $28
add b
ret z
and a
add b
add b
ld sp, hl
add h
pop bc
cp h
pop bc
cp h
ld b, c
adc h
jr nz, jr_023_445e
db $10
ld b, b
nop
nop
ld sp, hl
inc b
ld bc, $01fc
db $fc
nop
nop
cp $fe
call $4123
inc h
ld b, b
jr_023_4430:
di
add hl, bc