-
Notifications
You must be signed in to change notification settings - Fork 806
/
mobile_5f.asm
5172 lines (4748 loc) · 75.3 KB
/
mobile_5f.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
Function17c000:
call DisableLCD
ld hl, vTiles2
ld bc, $31 tiles
xor a
call ByteFill
call LoadStandardFont
call LoadFontsExtra
ld hl, HaveWantMap
decoord 0, 0
bccoord 0, 0, wAttrmap
ld a, SCREEN_HEIGHT
.y
push af
ld a, SCREEN_WIDTH
push hl
.x
push af
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [bc], a
inc bc
pop af
dec a
jr nz, .x
pop hl
push bc
ld bc, BG_MAP_WIDTH * 2
add hl, bc
pop bc
pop af
dec a
jr nz, .y
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ldh [rSVBK], a
ld hl, HaveWantPals
ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
pop af
ldh [rSVBK], a
ld hl, MobileSelectGFX
ld de, vTiles0 tile $30
ld bc, $20 tiles
call CopyBytes
ld a, 1
ldh [rVBK], a
ld hl, HaveWantGFX
ld de, vTiles2
ld bc, $80 tiles
call CopyBytes
ld hl, HaveWantGFX + $80 tiles
ld de, vTiles1
ld bc, $10 tiles
call CopyBytes
xor a
ldh [rVBK], a
call EnableLCD
farcall HDMATransferTilemapAndAttrmap_Overworld
ret
HaveWantGFX:
INCBIN "gfx/mobile/havewant.2bpp"
MobileSelectGFX:
INCBIN "gfx/mobile/select.2bpp"
HaveWantMap:
; Interleaved tile/palette map.
INCBIN "gfx/mobile/havewant_map.bin"
HaveWantPals:
; BG and OBJ palettes.
RGB 0, 0, 0
RGB 21, 21, 21
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 4, 17, 29
RGB 6, 19, 31
RGB 31, 31, 31
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 2, 13, 18
RGB 6, 19, 31
RGB 31, 31, 31
RGB 0, 0, 0
RGB 31, 5, 5
RGB 29, 21, 21
RGB 31, 31, 31
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 4, 17, 29
RGB 6, 19, 31
RGB 2, 15, 27
RGB 0, 0, 0
RGB 28, 19, 18
RGB 25, 9, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 31, 27, 27
RGB 31, 10, 4
RGB 29, 0, 0
RGB 0, 0, 0
RGB 31, 31, 31
RGB 26, 8, 23
RGB 22, 0, 16
RGB 0, 0, 0
RGB 31, 31, 31
RGB 20, 8, 31
RGB 15, 1, 26
RGB 0, 0, 0
RGB 31, 31, 31
RGB 17, 12, 31
RGB 12, 6, 31
RGB 0, 16, 0
RGB 11, 11, 14
RGB 5, 5, 7
RGB 31, 31, 31
RGB 0, 31, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 16, 31, 0
RGB 0, 0, 0
RGB 0, 0, 0
RGB 0, 0, 0
CheckStringForErrors:
; Valid character ranges:
; $0, $5 - $13, $19 - $1c, $26 - $34, $3a - $3e, $40 - $48, $60 - $ff
.loop
ld a, [de]
inc de
and a ; "<NULL>"
jr z, .NextChar
cp FIRST_REGULAR_TEXT_CHAR
jr nc, .NextChar
cp "<NEXT>"
jr z, .NextChar
cp "@"
jr z, .Done
cp "ガ"
jr c, .Fail
cp "<PLAY_G>"
jr c, .NextChar
cp "<JP_18>" + 1
jr c, .Fail
cp "<NI>"
jr c, .NextChar
cp "<NO>" + 1
jr c, .Fail
cp "<ROUTE>"
jr c, .NextChar
cp "<GREEN>" + 1
jr c, .Fail
cp "<ENEMY>"
jr c, .NextChar
cp "<ENEMY>" + 1
jr c, .Fail
cp "<MOM>"
jr c, .NextChar
.Fail:
scf
ret
.NextChar:
dec c
jr nz, .loop
.Done:
and a
ret
CheckStringForErrors_IgnoreTerminator:
; Find control chars
.loop
ld a, [de]
inc de
and a
jr z, .next
cp "<DEXEND>" + 1
jr nc, .next
cp "<NEXT>"
jr z, .next
cp "@"
jr z, .next
cp "ガ"
jr c, .end
cp "<PLAY_G>"
jr c, .next
cp "<JP_18>" + 1
jr c, .end
cp "<NI>"
jr c, .next
cp "<NO>" + 1
jr c, .end
cp "<ROUTE>"
jr c, .next
cp "<GREEN>" + 1
jr c, .end
cp "<ENEMY>"
jr c, .next
cp "<ENEMY>" + 1
jr c, .end
cp "<MOM>"
jr c, .next
.end
scf
ret
.next
dec c
jr nz, .loop
and a
ret
Function17d0f3:
ld a, [wMobileMonSpecies]
ld [wOTTrademonSpecies], a
ld [wCurPartySpecies], a
ld a, [wcd81]
ld [wc74e], a
ld hl, wMobileMonOT
ld de, wOTTrademonOTName
ld bc, NAME_LENGTH_JAPANESE - 1
call CopyBytes
ld a, "@"
ld [de], a
ld a, [wMobileMonID]
ld [wOTTrademonID], a
ld a, [wMobileMonID + 1]
ld [wOTTrademonID + 1], a
ld hl, wMobileMonDVs
ld a, [hli]
ld [wOTTrademonDVs], a
ld a, [hl]
ld [wOTTrademonDVs + 1], a
ld bc, wMobileMonSpecies
farcall GetCaughtGender
ld a, c
ld [wOTTrademonCaughtData], a
call SpeechTextbox
call FadeToMenu
farcall Function10804d
farcall Function17d1f1
ld a, $1
ld [wForceEvolution], a
ld a, LINK_TRADECENTER
ld [wLinkMode], a
farcall EvolvePokemon
xor a
ld [wLinkMode], a
farcall SaveAfterLinkTrade
ld a, BANK(s5_a800)
call OpenSRAM
ld a, BANK(s5_a800)
ld [s5_a800], a
call CloseSRAM
ld a, [wMapGroup]
ld b, a
ld a, [wMapNumber]
ld c, a
call GetMapSceneID
ld a, d
or e
jr z, .asm_17d180
ld a, $1
ld [de], a
.asm_17d180
call CloseSubmenu
call RestartMapMusic
ret
Mobile_CopyDefaultOTName:
ld hl, Mobile5F_PlayersName
ld de, wMobileMonOT
ld bc, NAME_LENGTH_JAPANESE - 1
call CopyBytes
ret
Mobile5F_PlayersName:
db "クりス@@"
Mobile_CopyDefaultNickname:
ld hl, .DefaultNickname
ld de, wMobileMonNick
ld bc, NAME_LENGTH_JAPANESE - 1
call CopyBytes
ret
.DefaultNickname:
db "?????"
Mobile_CopyDefaultMail:
ld a, "@"
ld hl, wMobileMonMail
ld bc, MAIL_MSG_LENGTH + 1
call ByteFill
ld hl, .DefaultMessage
ld de, wMobileMonMail
ld bc, .DefaultMessageEnd - .DefaultMessage
call CopyBytes
ret
.DefaultMessage:
db "こんにちは@"
.DefaultMessageEnd:
Mobile_CopyDefaultMailAuthor:
ld a, "@"
ld de, wMobileMonMailAuthor
ld bc, NAME_LENGTH_JAPANESE - 1
call ByteFill
ld hl, Mobile5F_PlayersName
ld de, wMobileMonMailAuthor
ld bc, NAME_LENGTH_JAPANESE - 1
call CopyBytes
ret
CheckStringContainsLessThanBNextCharacters:
.loop
ld a, [de]
inc de
cp "<NEXT>"
jr nz, .next_char
dec b
jr z, .done
.next_char
dec c
jr nz, .loop
and a
ret
.done
scf
ret
Function17d1f1:
ld a, [wCurPartySpecies]
dec a
call SetSeenAndCaughtMon
ld a, [wCurPartySpecies]
cp UNOWN
jr nz, .asm_17d223
ld hl, wPartyMon1DVs
ld a, [wPartyCount]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
predef GetUnownLetter
callfar UpdateUnownDex
ld a, [wFirstUnownSeen]
and a
jr nz, .asm_17d223
ld a, [wUnownLetter]
ld [wFirstUnownSeen], a
.asm_17d223
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Parameter: [wScriptVar] = 0..1
;
; if [wScriptVar] == FALSE
; Show japanese menu options
; - News - News - ??? - Cancel
; if [wScriptVar] == TRUE
; Show BattleTower-Menu with 3 options in english language
; - Challenge - Explanation - Cancel
Menu_ChallengeExplanationCancel:
ld a, [wScriptVar]
and a
jr nz, .English
ld a, $4
ld [wScriptVar], a
ld hl, MenuHeader_17d26a ; Japanese Menu, where you can choose 'News' as an option
jr .Load_Interpret
.English:
ld a, $4
ld [wScriptVar], a
ld hl, MenuHeader_ChallengeExplanationCancel ; English Menu
.Load_Interpret:
call LoadMenuHeader
call Function17d246
call CloseWindow
ret
Function17d246:
call VerticalMenu
jr c, .Exit
ld a, [wScriptVar]
cp $5
jr nz, .UsewMenuCursorY
ld a, [wMenuCursorY]
cp $3
ret z
jr c, .UsewMenuCursorY
dec a
jr .LoadToScriptVar
.UsewMenuCursorY:
ld a, [wMenuCursorY]
.LoadToScriptVar:
ld [wScriptVar], a
ret
.Exit:
ld a, $4
ld [wScriptVar], a
ret
MenuHeader_17d26a:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 0, 14, 9
dw MenuData_17d272
db 1 ; default option
MenuData_17d272:
db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
db 4
db "ニュース<WO>よみこむ@"
db "ニュース<WO>みる@"
db "せつめい@"
db "やめる@"
MenuHeader_ChallengeExplanationCancel:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 0, 14, 7
dw MenuData_ChallengeExplanationCancel
db 1 ; default option
MenuData_ChallengeExplanationCancel:
db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
db 3
db "Challenge@"
db "Explanation@"
db "Cancel@"
Function17d2b6:
call Function17d2c0
farcall Function1181da
ret
Function17d2c0:
xor a
ld [wJumptableIndex], a
ld [wcf64], a
ld [wcf65], a
ld [wcf66], a
ret
Function17d2ce:
ld a, BANK(s5_aa72)
call OpenSRAM
ld a, [s5_aa72]
call CloseSRAM
and a
jr nz, .asm_17d2e2
ld a, $1
ld [wScriptVar], a
ret
.asm_17d2e2
call Function17d314
ret c
call SpeechTextbox
call FadeToMenu
ldh a, [rSVBK]
push af
ld a, $4
ldh [rSVBK], a
call Function17d370
call Function17d45a
pop af
ldh [rSVBK], a
ld de, MUSIC_MOBILE_CENTER
ld a, e
ld [wMapMusic], a
ld [wMusicFadeID], a
ld a, d
ld [wMusicFadeID + 1], a
call PlayMusic
call ReturnToMapFromSubmenu
call CloseSubmenu
ret
Function17d314:
ld a, BANK(s5_b1b1)
call OpenSRAM
ld a, [s5_b1b1]
call CloseSRAM
cp $21
jr nc, .asm_17d354
ld a, BANK(s6_a006)
call OpenSRAM
ld l, 0
ld h, l
ld de, s6_a006
ld a, [s6_a004]
ld c, a
ld a, [s6_a005]
ld b, a
.asm_17d336
push bc
ld a, [de]
inc de
ld c, a
ld b, 0
add hl, bc
pop bc
dec bc
ld a, b
or c
jr nz, .asm_17d336
ld a, [s6_a002]
cp l
jr nz, .asm_17d354
ld a, [s6_a003]
cp h
jr nz, .asm_17d354
call CloseSRAM
and a
ret
.asm_17d354
call CloseSRAM
ld a, $5
call OpenSRAM
xor a
ld hl, $aa73
ld bc, $c
call ByteFill
call CloseSRAM
ld a, $2
ld [wScriptVar], a
scf
ret
Function17d370:
xor a
ld [wcd77], a
ld [wMobileCrashCheckPointer], a
ld [wMobileCrashCheckPointer + 1], a
dec a
ld [wcd6c], a
call ClearBGPalettes
call ClearSprites
call ClearScreen
farcall HDMATransferTilemapAndAttrmap_Overworld
call DisableLCD
ld hl, vTiles0 tile $ee
ld de, wc608
ld bc, 1 tiles
call CopyBytes
ld a, $1
ldh [rVBK], a
ld hl, PokemonNewsGFX
ld de, vTiles1
ld bc, $48 tiles
call CopyBytes
xor a
ld hl, vTiles2 tile $7f
ld bc, 1 tiles
call ByteFill
ld hl, wc608
ld de, vTiles0 tile $ee
ld bc, 1 tiles
call CopyBytes
xor a
ldh [rVBK], a
ld hl, PostalMarkGFX
ld de, vTiles2 tile $60
ld bc, 1 tiles
call CopyBytes
call EnableLCD
call Function17d60b
ld a, $0
ld [wBGMapBuffer], a
ld a, $d0
ld [wcd21], a
ld a, BANK(s6_a006)
call OpenSRAM
ld hl, s6_a006
ld de, w4_d000
ld bc, $1000
call CopyBytes
call CloseSRAM
ret
Function17d3f6:
call ClearBGPalettes
call ClearSprites
call ClearScreen
farcall HDMATransferTilemapAndAttrmap_Overworld
Function17d405:
call DisableLCD
ld hl, vTiles0 tile $ee
ld de, wc608
ld bc, 1 tiles
call CopyBytes
ld a, $1
ldh [rVBK], a
ld hl, PokemonNewsGFX
ld de, vTiles1
ld bc, $48 tiles
call CopyBytes
xor a
ld hl, vTiles2 tile $7f
ld bc, 1 tiles
call ByteFill
ld hl, wc608
ld de, vTiles0 tile $ee
ld bc, 1 tiles
call CopyBytes
xor a
ldh [rVBK], a
call EnableLCD
ldh a, [rSVBK]
push af
ld a, $5
ldh [rSVBK], a
ld hl, PokemonNewsPalettes
ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
call SetDefaultBGPAndOBP
pop af
ldh [rSVBK], a
ret
Function17d45a:
.asm_17d45a
call JoyTextDelay
ld a, [wcd77]
bit 7, a
jr nz, .asm_17d46f
call Function17d474
farcall HDMATransferTilemapAndAttrmap_Overworld
jr .asm_17d45a
.asm_17d46f
xor a
ld [wScriptVar], a
ret
Function17d474:
jumptable Jumptable_17d483, wcd77
Jumptable_17d483:
dw Function17d48d
dw Function17d5be
dw Function17d5c4
dw Function17d6fd
dw Function17e427
Function17d48d:
ld hl, PokemonNewsPalettes
ld de, wc608
ld bc, $40
call CopyBytes
ld hl, PokemonNewsTileAttrmap
decoord 0, 0
bccoord 0, 0, wAttrmap
ld a, $12
.asm_17d4a4
push af
ld a, $14
push hl
.asm_17d4a8
push af
ld a, [hli]
cp $7f
jr z, .asm_17d4b0
add $80
.asm_17d4b0
ld [de], a
inc de
ld a, [hli]
ld [bc], a
inc bc
pop af
dec a
jr nz, .asm_17d4a8
pop hl
push bc
ld bc, $40
add hl, bc
pop bc
pop af
dec a
jr nz, .asm_17d4a4
ld a, [wBGMapBuffer]
ld l, a
ld a, [wcd21]
ld h, a
ld a, [hli]
ld e, a
ld a, [wcd6c]
cp e
jr z, .asm_17d4e0
ld a, e
ld [wcd6c], a
ld [wMapMusic], a
ld d, $0
call PlayMusic2
.asm_17d4e0
ld a, [hli]
ld de, wc608
ld c, $8
.asm_17d4e6
srl a
jr nc, .asm_17d4f6
ld b, $8
push af
.asm_17d4ed
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .asm_17d4ed
pop af
jr .asm_17d4fc
.asm_17d4f6
push af
ld a, e
add $8
ld e, a
pop af
.asm_17d4fc
dec c
jr nz, .asm_17d4e6
push hl
call Function17d5f6
pop hl
ld a, [hli]
and a
jr z, .asm_17d539
.asm_17d508
push af
ld a, [hli]
ld [wcd4f], a
ld a, [hli]
ld [wcd50], a
ld a, [hli]
ld [wcd51], a
ld a, [hli]
ld [wcd52], a
ld a, [hli]
sla a
sla a
sla a
add $98
ld [wcd53], a
ld de, wcd4f
call Function17e613
ld a, [hli]
ld [wcd53], a
ld de, wcd4f
call Function17e691
pop af
dec a
jr nz, .asm_17d508
.asm_17d539
ld a, [hli]
.asm_17d53a
push af
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
push hl
pop de
hlcoord 0, 0
add hl, bc
call PlaceString
push de
pop hl
inc hl
pop af
dec a
jr nz, .asm_17d53a
ld de, wCreditsTimer
ld bc, $c
call CopyBytes
xor a
ld [wcd2e], a
ld [wcd2f], a
inc a
ld [wcd30], a
ld [wcd31], a
ld de, wcd32
ld bc, $10
call CopyBytes
ld a, [hli]
ld [wcd42], a
ld a, [hli]
ld [wcd43], a
ld a, [hli]
ld [wMobileInactivityTimerMinutes], a
ld a, [hli]
ld [wMobileInactivityTimerSeconds], a
ld a, [hli]
ld [wMobileInactivityTimerFrames], a
ld a, [hli]
and a
jr z, .asm_17d58a
call Function17d6a1
.asm_17d58a
ld a, l
ld [wcd49], a
ld a, h
ld [wcd4a], a
ld a, [wcd42]
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, l
ld [wcd4b], a
ld a, h
ld [wcd4c], a
add hl, bc
add hl, bc
ld a, l
ld [wcd4d], a
ld a, h
ld [wcd4e], a
call Function17e451
call Function17e55b
call Function17e5af
farcall HDMATransferTilemapAndAttrmap_Overworld
jp Function17e438
Function17d5be:
call SetDefaultBGPAndOBP
call Function17e438
Function17d5c4:
ldh a, [hJoyPressed]
and a
ret z
ld c, 0
ld b, c
ld hl, wcd32
.loop
srl a
jr c, .got_button
inc c
inc c
jr .loop
.got_button
add hl, bc
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
and c
cp $ff
ret z
ld a, [wcd20]
ld l, a
ld a, [wcd21]
ld h, a
add hl, bc
ld a, l
ld [wMobileCrashCheckPointer], a
ld a, h
ld [wMobileCrashCheckPointer + 1], a
ld a, $3
ld [wcd77], a
ret
Function17d5f6:
ld a, $5
ldh [rSVBK], a
ld hl, wc608
ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
ld a, $4
ldh [rSVBK], a
ret
Function17d60b:
ld a, $5
call OpenSRAM
ld hl, $b1d3
ld de, wc608
ld bc, $20
call CopyBytes
ld a, [$b1b1]
ld c, a
ld a, [$b1b2]
ld b, a
ld a, [$b1b3]
ld l, a
ld a, [$b1b4]
ld h, a
call CloseSRAM
ld a, $6
call OpenSRAM
ld de, wc708
ld a, c
and a
jr z, .asm_17d684
.asm_17d63b
push bc
ld a, l
ld [de], a
inc de
ld a, h
ld [de], a
inc de
ld bc, $a
add hl, bc
pop bc
ld a, [hli]
ld [wcd4a], a
ld a, [hli]
ld [wcd49], a
push hl
push de
ld hl, wc608
ld e, b
ld d, $0
add hl, de
ld a, [hli]
ld [wcd4b], a
ld a, [hl]
ld [wcd4c], a
pop de
pop hl
inc b
inc b