-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank_01c.asm
executable file
·14954 lines (13088 loc) · 163 KB
/
bank_01c.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 $01c", ROMX[$4000], BANK[$1c]
inc e
nop
nop
add l
ld b, b
ld a, [de]
ld bc, $4085
inc [hl]
nop
add l
ld b, b
ld c, [hl]
ld bc, $4085
ld l, b
ld [bc], a
add l
ld b, b
add d
inc bc
add l
ld b, b
inc [hl]
nop
adc d
ld b, b
ld c, [hl]
ld bc, $42fb
ld l, b
ld [bc], a
adc d
ld b, l
inc [hl]
nop
inc de
ld c, b
ld c, [hl]
ld bc, $4af3
ld l, b
ld [bc], a
inc de
ld c, l
inc [hl]
nop
ld e, h
ld d, b
ld c, [hl]
ld bc, $52cf
ld l, b
ld [bc], a
jr c, jr_01c_4093
inc [hl]
nop
ld l, $58
ld c, [hl]
ld bc, $5923
ld l, b
ld [bc], a
add sp, $59
inc [hl]
nop
ld [hl], $5b
ld c, [hl]
ld bc, $5c95
ld l, b
ld [bc], a
ld e, d
ld e, [hl]
inc [hl]
nop
ld [hl-], a
ld h, b
ld c, [hl]
ld bc, $6139
ld l, b
ld [bc], a
jr_01c_405f:
jr jr_01c_40c4
inc [hl]
nop
inc h
jr_01c_4064:
ld h, h
ld c, [hl]
ld bc, $65e5
ld l, b
ld [bc], a
sbc [hl]
jr_01c_406c:
ld h, a
inc [hl]
nop
jr_01c_406f:
inc h
ld l, d
ld c, [hl]
ld bc, $6b8b
ld l, b
ld [bc], a
inc e
ld l, l
inc [hl]
nop
call nc, Call_01c_4e6e
ld bc, $7115
ld l, b
ld [bc], a
jr nc, jr_01c_40f8
nop
nop
nop
nop
rst $38
inc b
nop
inc c
nop
pop bc
dec [hl]
ld a, [hl+]
jr_01c_4091:
ld [de], a
ld a, [hl+]
jr_01c_4093:
ld b, $c1
ld e, a
add hl, hl
jr @+$32
jr @+$37
jr @+$37
jr jr_01c_405f
rst $38
dec [hl]
jr jr_01c_4064
ld h, b
dec [hl]
jr @-$3e
jr_01c_40a7:
cp $35
jr jr_01c_406c
ld h, b
dec [hl]
jr jr_01c_406f
jr_01c_40af:
cp $2a
ld e, $a0
rlca
pop bc
ld a, a
ld a, [hl+]
ld b, $a0
inc c
pop bc
jr nz, @+$2b
inc c
and b
dec b
add hl, hl
inc c
and b
jr_01c_40c3:
inc c
jr_01c_40c4:
pop bc
jr nc, jr_01c_40ef
inc c
jr z, jr_01c_40d6
dec hl
inc c
jr_01c_40cc:
pop bc
ld c, d
add hl, hl
jr jr_01c_4091
cp $25
inc h
and b
dec b
jr_01c_40d6:
pop bc
ld d, b
dec h
inc c
and b
inc c
pop bc
ld b, b
jr nz, @+$14
jr nz, jr_01c_40e8
pop bc
ld e, a
ld hl, $c118
ld h, b
jr_01c_40e8:
ld hl, $2218
jr jr_01c_4111
jr jr_01c_40af
jr_01c_40ef:
cp $25
jr nc, jr_01c_4093
ld [$7fc1], sp
dec h
inc c
jr_01c_40f8:
and b
jr_01c_40f9:
inc c
pop bc
jr nc, jr_01c_4122
inc c
daa
inc c
add hl, hl
jr_01c_4101:
inc c
ret nz
cp $32
jr nc, jr_01c_40a7
ld [$7fc1], sp
ld [hl-], a
inc c
and b
inc c
pop bc
jr nc, @+$2d
jr_01c_4111:
inc c
dec hl
inc c
ld [hl-], a
inc c
pop bc
ld c, d
ld [hl-], a
jr jr_01c_414b
jr jr_01c_4147
jr jr_01c_4149
jr jr_01c_40c3
nop
jr_01c_4122:
and e
ld b, $c3
jr nc, @+$33
jr jr_01c_40cc
nop
pop bc
ld [hl], b
jr_01c_412c:
ld sp, $a324
ld b, $c3
jr nz, @+$33
inc c
ld sp, $310c
inc c
call nz, $3268
jr nc, @+$2b
jr @+$2b
jr @-$3b
jr nc, jr_01c_4175
jr jr_01c_40e8
nop
pop bc
jr_01c_4147:
ld [hl], b
ld [hl-], a
jr_01c_4149:
inc h
and e
jr_01c_414b:
ld b, $c3
jr nz, jr_01c_417a
inc c
dec hl
inc c
dec hl
inc c
ret nz
cp $2a
jr nc, jr_01c_40f9
ld b, $c1
ld a, a
and e
nop
ld a, [hl+]
jr jr_01c_4101
inc c
call nz, $a330
ld b, $2a
jr jr_01c_412c
jr nc, jr_01c_41a1
jr @-$5b
nop
pop bc
ld [hl], b
ld [hl], $24
and e
ld b, $c3
jr_01c_4175:
jr nz, @+$38
inc c
scf
inc c
jr_01c_417a:
add hl, sp
inc c
jp $3a30
jr @-$5b
nop
pop bc
ld [hl], b
ld a, [hl-]
jr_01c_4185:
inc h
and e
ld b, $c3
jr_01c_4189:
jr nz, jr_01c_41b5
inc c
jr nc, jr_01c_419a
jr_01c_418e:
ld [hl-], a
inc c
call nz, $3268
jr nc, jr_01c_41c9
jr nc, jr_01c_41c0
ld c, b
and b
jr_01c_4199:
inc c
jr_01c_419a:
and e
cp $c1
dec [hl]
ld a, [hl+]
ld [de], a
ld a, [hl+]
jr_01c_41a1:
ld b, $c1
ld e, a
and b
dec bc
add hl, hl
jr jr_01c_4149
inc c
jr nc, jr_01c_41c4
jr nc, jr_01c_41c6
dec [hl]
jr jr_01c_41e6
jr jr_01c_41ec
jr jr_01c_41e7
jr_01c_41b5:
jr jr_01c_41ec
jr jr_01c_41e3
jr @+$2b
jr @-$3e
rst $38
jr_01c_41be:
jr z, jr_01c_41d8
jr_01c_41c0:
pop bc
ld h, b
jr z, @+$1a
jr_01c_41c4:
pop bc
ld c, d
jr_01c_41c6:
add hl, hl
jr jr_01c_4189
jr_01c_41c9:
rst $38
dec h
jr jr_01c_418e
ld h, b
dec h
jr @-$3d
ld e, a
jr nz, jr_01c_41e6
jr nz, @+$08
pop bc
ld h, b
jr_01c_41d8:
ld hl, $2118
jr jr_01c_41ff
jr jr_01c_4203
jr jr_01c_41a1
jr_01c_41e1:
cp $25
jr_01c_41e3:
jr nc, jr_01c_4185
ld a, [bc]
jr_01c_41e6:
pop bc
jr_01c_41e7:
ld a, a
dec h
jr_01c_41e9:
inc c
and b
dec c
jr_01c_41ec:
pop bc
jr nc, jr_01c_4214
inc c
daa
inc c
add hl, hl
inc c
ret nz
cp $2b
jr_01c_41f7:
jr nc, jr_01c_4199
ld a, [bc]
pop bc
ld a, a
dec hl
jr_01c_41fd:
inc c
and b
jr_01c_41ff:
dec c
pop bc
jr nc, @+$2d
jr_01c_4203:
inc c
dec hl
inc c
jr_01c_4206:
ld [hl-], a
inc c
pop bc
ld e, a
ld [hl-], a
jr jr_01c_423d
jr jr_01c_4239
jr jr_01c_423b
jr jr_01c_41b5
nop
jr_01c_4214:
and e
ld b, $c3
jr nc, jr_01c_424a
jr jr_01c_41be
nop
pop bc
ld [hl], b
ld sp, $a324
ld b, $c3
jr nz, @+$33
inc c
ld sp, $310c
inc c
call nz, $3268
jr nc, jr_01c_4258
jr jr_01c_4263
jr jr_01c_41f7
ld b, b
daa
jr @+$2d
jr jr_01c_426b
jr_01c_4239:
jr jr_01c_4266
jr_01c_423b:
jr jr_01c_41fd
jr_01c_423d:
cp $2a
jr nc, jr_01c_41e1
ld b, $c1
ld a, a
and e
nop
ld a, [hl+]
jr jr_01c_41e9
inc c
jr_01c_424a:
and e
ld b, $c4
ld l, b
ld a, [hl+]
jr jr_01c_4287
jr jr_01c_4285
jr @-$3b
jr nz, jr_01c_4280
inc c
jr_01c_4258:
ld [hl], $0c
scf
inc c
add hl, sp
inc c
jp $3a30
jr jr_01c_4206
jr_01c_4263:
nop
pop bc
ld [hl], b
jr_01c_4266:
ld a, [hl-]
inc h
and e
ld b, $c3
jr_01c_426b:
jr nz, jr_01c_4297
inc c
jr nc, jr_01c_427c
ld [hl-], a
inc c
call nz, $3268
jr nc, jr_01c_42ab
jr nc, jr_01c_42a2
ld c, a
rra
ld [bc], a
jr_01c_427c:
xor a
rlca
and b
ld a, [bc]
jr_01c_4280:
rra
add hl, de
ld [hl], $0c
add hl, hl
jr_01c_4285:
inc c
ld a, [hl+]
jr_01c_4287:
inc c
jr nc, jr_01c_4296
ld [hl-], a
jr nc, @-$3b
jr nc, jr_01c_42b9
ld sp, $00a3
pop bc
jr nz, @+$2c
add hl, de
jr_01c_4296:
and b
jr_01c_4297:
rrca
and e
ld b, $c4
cpl
dec h
ld a, [de]
call nz, $2730
ld a, [de]
jr_01c_42a2:
call nz, $3034
dec de
pop bc
jr nc, jr_01c_42db
inc c
and d
jr_01c_42ab:
ld [bc], a
and b
ld a, [bc]
ld a, [de]
inc c
jr_01c_42b0:
ld a, [de]
inc c
ld [hl+], a
inc c
ld [hl+], a
inc c
dec h
inc c
dec h
jr_01c_42b9:
inc c
ld a, [hl+]
inc c
ld a, [de]
inc c
jr nz, jr_01c_42cc
jr nz, @+$0e
inc h
inc c
inc h
dec c
daa
dec c
daa
dec c
ld a, [hl+]
dec c
jr_01c_42cc:
add hl, hl
ld c, $19
dec c
add hl, de
dec c
jr nz, @+$0f
jr nz, @+$10
dec h
ld c, $25
ld c, $29
jr_01c_42db:
rrca
pop bc
ld a, a
add hl, de
ld hl, $03a7
pop bc
jr nc, jr_01c_42fe
inc bc
ld a, [de]
inc bc
jr nz, jr_01c_42ed
ld [hl+], a
inc bc
inc h
jr_01c_42ed:
inc bc
dec h
inc bc
daa
inc bc
pop bc
ld a, a
add hl, hl
add hl, de
rra
jr jr_01c_4318
ld e, d
rst $38
inc b
nop
dec c
jr_01c_42fe:
nop
and e
dec de
pop bc
dec [hl]
jr nc, jr_01c_4317
jr nc, @+$08
pop bc
ld e, a
and b
inc c
dec [hl]
jr jr_01c_4345
jr jr_01c_42b0
dec c
add hl, sp
jr jr_01c_434e
jr @-$3c
jr_01c_4316:
ld a, a
jr_01c_4317:
ld b, b
jr_01c_4318:
jr @-$3e
cp $a3
cp $45
inc h
and b
jr_01c_4320:
ld a, [bc]
pop bc
ld a, a
ld b, l
inc c
and b
dec c
pop bc
dec [hl]
ld b, h
ld [de], a
pop bc
cpl
ld b, d
ld b, $c0
cp $42
ld e, $a0
jr_01c_4334:
ld a, [bc]
pop bc
ld a, a
ld b, d
ld b, $a0
jr_01c_433a:
dec c
and e
add hl, bc
pop bc
jr nz, jr_01c_4380
inc c
and b
dec b
ld b, b
inc c
jr_01c_4345:
and b
dec c
pop bc
jr nc, jr_01c_4385
inc c
dec sp
inc c
ld b, d
jr_01c_434e:
inc c
pop bc
ld c, d
and e
jr_01c_4352:
inc c
ld b, b
jr jr_01c_4316
cp $39
inc h
and b
dec b
jr_01c_435b:
pop bc
ld d, b
and e
nop
add hl, sp
inc c
and b
dec c
pop bc
ld b, b
and e
add hl, bc
add hl, hl
ld [de], a
pop bc
cpl
add hl, hl
ld b, $c1
ld e, a
add hl, hl
jr @-$3d
ld h, b
add hl, hl
jr jr_01c_43a1
jr @+$33
jr jr_01c_433a
cp $a3
inc c
ld [hl-], a
jr nc, jr_01c_4320
jr_01c_4380:
ld [$7fc1], sp
ld [hl-], a
inc c
jr_01c_4385:
and b
dec c
pop bc
jr_01c_4388:
jr nc, jr_01c_43bc
inc c
inc [hl]
inc c
dec [hl]
jr_01c_438e:
inc c
ret nz
cp $37
jr nc, jr_01c_4334
ld [$7fc1], sp
scf
inc c
and b
dec c
jr_01c_439b:
pop bc
jr nc, jr_01c_43d0
inc c
ld [hl-], a
inc c
jr_01c_43a1:
dec [hl]
inc c
and e
ld [$4ac1], sp
dec [hl]
jr jr_01c_43de
jr jr_01c_43de
jr jr_01c_43de