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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
|
PlayIntroScene:
ld a, [rIE]
push af
xor a
ld [rIF], a
ld a, $f
ld [rIE], a
ld a, $8
ld [rSTAT], a
call InitYellowIntroGFXAndMusic
call DelayFrame
.loop
ld a, [wYellowIntroCurrentScene]
bit 7, a
jr nz, .go_to_title_screen
call JoypadLowSensitivity
ld a, [hJoyPressed]
and A_BUTTON | B_BUTTON | START
jr nz, .go_to_title_screen
call Func_f98fc
ld a, $0
ld [wCurrentAnimatedObjectOAMBufferOffset], a
call RunObjectAnimations
ld a, [wYellowIntroCurrentScene]
cp $7
call z, Func_f98a2
cp $b
call z, Func_f98cb
call DelayFrame
jr .loop
.go_to_title_screen
call YellowIntro_BlankPalettes
xor a
ld [hLCDCPointer], a
call DelayFrame
xor a
ld [rIF], a
pop af
ld [rIE], a
ld a, $90
ld [hWY], a
call ClearObjectAnimationBuffers
ld hl, wTileMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call Bank3E_FillMemory
call YellowIntro_BlankOAMBuffer
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ret
Func_f98a2:
ld a, [wOAMBuffer + 8 * 4 + 3]
or $1
ld [wOAMBuffer + 8 * 4 + 3], a
ld a, [wOAMBuffer + 14 * 4 + 3]
or $1
ld [wOAMBuffer + 14 * 4 + 3], a
ld a, [wOAMBuffer + 16 * 4 + 3]
or $1
ld [wOAMBuffer + 16 * 4 + 3], a
ld a, [wOAMBuffer + 18 * 4 + 3]
or $1
ld [wOAMBuffer + 18 * 4 + 3], a
ld a, [wOAMBuffer + 19 * 4 + 3]
or $1
ld [wOAMBuffer + 19 * 4 + 3], a
ret
Func_f98cb:
ld a, [wOAMBuffer + 18 * 4 + 3]
or $1
ld [wOAMBuffer + 18 * 4 + 3], a
ld a, [wOAMBuffer + 19 * 4 + 3]
or $1
ld [wOAMBuffer + 19 * 4 + 3], a
ld a, [wOAMBuffer + 20 * 4 + 3]
or $1
ld [wOAMBuffer + 20 * 4 + 3], a
ld a, [wOAMBuffer + 25 * 4 + 3]
or $1
ld [wOAMBuffer + 25 * 4 + 3], a
ld a, [wOAMBuffer + 26 * 4 + 3]
or $1
ld [wOAMBuffer + 26 * 4 + 3], a
ld a, [wOAMBuffer + 28 * 4 + 3]
or $1
ld [wOAMBuffer + 28 * 4 + 3], a
ret
Func_f98fc:
ld a, [wYellowIntroCurrentScene]
ld hl, Jumptable_f9906
call Func_fa06e
jp [hl]
Jumptable_f9906:
dw YellowIntroScene0 ; running pika 1
dw YellowIntroScene1 ; wait last
dw YellowIntroScene2 ; pikachu kick
dw YellowIntroScene3 ; wait last
dw YellowIntroScene4 ; running pika 2
dw YellowIntroScene5 ; wait last
dw YellowIntroScene6 ; surfing pika
dw YellowIntroScene7 ; wait last
dw YellowIntroScene8 ; running pika 3
dw YellowIntroScene9 ; wait last
dw YellowIntroScene10 ; flying pika
dw YellowIntroScene11 ; wait last
dw YellowIntroScene12 ; pika close up
dw YellowIntroScene13 ; wait last
dw YellowIntroScene14 ; pika thunderbolt
dw YellowIntroScene15 ; wait last
dw YellowIntroScene16 ; fade to white
dw YellowIntroScene17 ; wait and quit
YellowIntro_NextScene:
ld hl, wYellowIntroCurrentScene
inc [hl]
ret
YellowIntroScene0:
xor a
ld [hLCDCPointer], a
lb de, $58, $58
ld a, $1
call YellowIntro_SpawnAnimatedObjectAndSavePointer
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $90
ld [hWY], a
ld a, $e4
ld [rBGP], a
ld [rOBP0], a
ld a, $c4
ld [rOBP1], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
ld a, 130
ld [wYellowIntroSceneTimer], a
call YellowIntro_NextScene
ret
YellowIntroScene1:
call YellowIntro_CheckFrameTimerDecrement
ret nc
call YellowIntro_MaskCurrentAnimatedObjectStruct
call YellowIntro_NextScene
ret
YellowIntroScene2:
call YellowIntro_BlankPalsDelay2AndDisableLCD
ld c, $8
call UpdateMusicCTimes
xor a
ld [hLCDCPointer], a
ld hl, vBGMap0
ld bc, $400
xor a
call Bank3E_FillMemory
call YellowIntroScene2_PlaceGraphic
lb de, $58, $b8 ; overloaded
ld a, $4 ; overloaded
call LoadYellowIntroFlyingSpeedBars
ld a, $1
call Func_f9e9a
call YellowIntro_SetTimerFor128Frames
call YellowIntro_NextScene
ret
YellowIntroScene2_PlaceGraphic:
ld hl, $98d4 ; (20, 6)
ld de, $20
ld b, $6
ld a, $90
.row
ld c, $6
push af
push hl
.col
ld [hli], a
inc a
dec c
jr nz, .col
pop hl
add hl, de
pop af
add $10
dec b
jr nz, .row
ld a, [hGBC]
and a
jr z, .dmg_sgb
; We can actually set palettes!
ld hl, $98d4 ; (20, 6)
ld de, $20
ld b, $6
ld a, $1
ld [rVBK], a
.attr_row
ld c, $6
push hl
.attr_col
ld [hli], a
dec c
jr nz, .attr_col
pop hl
add hl, de
dec b
jr nz, .attr_row
xor a
ld [rVBK], a
.dmg_sgb
ret
LoadYellowIntroFlyingSpeedBars:
ld hl, YellowIntroFlyingSpeedBarData
ld a, $8
.loop
; Spawn object $8 at indicated coordinates with indicated speeds
push af
ld e, [hl]
inc hl
ld d, [hl]
inc hl
ld a, [hli]
push hl
push af
ld a, $8
call SpawnAnimatedObject
pop af
ld hl, $b
add hl, bc
ld [hl], a
pop hl
pop af
dec a
jr nz, .loop
ret
YellowIntroFlyingSpeedBarData:
; y, x, speed
db $d0, $20, $02
db $f0, $30, $04
db $d0, $40, $06
db $c0, $50, $08
db $e0, $60, $08
db $c0, $70, $06
db $e0, $80, $04
db $f0, $90, $02
YellowIntroScene3:
call YellowIntro_CheckFrameTimerDecrement
jr c, .expired
ld a, [hSCX]
cp $68
ret z
add $4
ld [hSCX], a
ret
.expired
call MaskAllAnimatedObjectStructs
call YellowIntro_NextScene
ret
YellowIntroScene4:
call YellowIntro_BlankPalsDelay2AndDisableLCD
ld c, $5
call UpdateMusicCTimes
ld a, [hGBC]
and a
jr z, .dmg_sgb
; We can actually set palettes!
ld hl, $98d4
ld de, $20
ld b, $6
ld a, $1
ld [rVBK], a
xor a
.attr_row
ld c, $6
push hl
.attr_col
ld [hli], a
dec c
jr nz, .attr_col
pop hl
add hl, de
dec b
jr nz, .attr_row
xor a
ld [rVBK], a
.dmg_sgb
xor a
ld [hLCDCPointer], a
call Func_f9e5f
lb de, $58, $58
ld a, $2
call YellowIntro_SpawnAnimatedObjectAndSavePointer
xor a
call Func_f9e9a
call YellowIntro_SetTimerFor128Frames
call YellowIntro_NextScene
ret
YellowIntroScene5:
call YellowIntro_CheckFrameTimerDecrement
ret nc
call YellowIntro_MaskCurrentAnimatedObjectStruct
call YellowIntro_NextScene
ret
YellowIntroScene6:
call YellowIntro_BlankPalsDelay2AndDisableLCD
ld c, $5
call UpdateMusicCTimes
ld a, $42
ld [hLCDCPointer], a
call YellowIntro_Copy8BitSineWave
ld hl, vBGMap0
ld bc, $60
xor a
call Bank3E_FillMemory
ld hl, $9860
ld c, $10
ld a, $20
.asm_f9a8b
ld [hli], a
inc a
ld [hli], a
dec a
dec c
jr nz, .asm_f9a8b
ld hl, $9880
ld bc, $300
ld a, $10
call Bank3E_FillMemory
lb de, $40, $f8
ld a, $5
call YellowIntro_SpawnAnimatedObjectAndSavePointer
ld a, $1
call Func_f9e9a
call YellowIntro_SetTimerFor88Frames
call YellowIntro_NextScene
ret
YellowIntroScene7:
call YellowIntro_CheckFrameTimerDecrement
jr c, .expired
ld hl, hSCX
inc [hl]
inc [hl]
ld hl, wYellowIntroSurfingPikaSineWaveBuffer
ld de, wYellowIntroSurfingPikaSineWaveBuffer + 1
ld a, [hl]
push af
ld c, $ff
.shift_loop
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .shift_loop
pop af
ld [hl], a
call Request7TileTransferFromC810ToC710
ret
.expired
call YellowIntro_MaskCurrentAnimatedObjectStruct
call YellowIntro_NextScene
ret
YellowIntroScene8:
call YellowIntro_BlankPalsDelay2AndDisableLCD
ld c, $5
call UpdateMusicCTimes
xor a
ld [hLCDCPointer], a
call Func_f9e5f
lb de, $58, $58
ld a, $3
call YellowIntro_SpawnAnimatedObjectAndSavePointer
xor a
call Func_f9e9a
call YellowIntro_SetTimerFor128Frames
call YellowIntro_NextScene
ret
YellowIntroScene9:
call YellowIntro_CheckFrameTimerDecrement
ret nc
call YellowIntro_MaskCurrentAnimatedObjectStruct
call YellowIntro_NextScene
ret
YellowIntroScene10:
call YellowIntro_BlankPalsDelay2AndDisableLCD
ld c, $5
call UpdateMusicCTimes
xor a
ld [hLCDCPointer], a
ld hl, vBGMap0
ld bc, $400
xor a
call Bank3E_FillMemory
ld hl, vBGMap0
ld bc, $100
ld a, $2
call Bank3E_FillMemory
ld hl, $9900
ld de, Unkn_f9b6e
lb bc, 6, 20
call .FillBGMapBox
ld hl, $988c
ld de, Unkn_f9be6
lb bc, 3, 4
call .FillBGMapBox
ld hl, $98e3
ld de, Unkn_f9bf2
lb bc, 2, 2
call .FillBGMapBox
lb de, $98, $58
ld a, $6
call YellowIntro_SpawnAnimatedObjectAndSavePointer
ld a, $1
call Func_f9e9a
call YellowIntro_SetTimerFor128Frames
call YellowIntro_NextScene
ret
.FillBGMapBox:
.fill_row
push bc
push hl
.fill_col
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .fill_col
pop hl
ld bc, $20
add hl, bc
pop bc
dec b
jr nz, .fill_row
ret
Unkn_f9b6e: INCBIN "gfx/unknown_f9b6e.map"
Unkn_f9be6: INCBIN "gfx/unknown_f9be6.map"
Unkn_f9bf2: INCBIN "gfx/unknown_f9bf2.map"
YellowIntroScene11:
call YellowIntro_CheckFrameTimerDecrement
jr c, .expired
ld a, [wYellowIntroSceneTimer]
and $7
ret nz
ld a, [wYellowIntroSceneTimer]
and $8
sla a
sla a
sla a
ld e, a
ld d, $0
ld hl, YellowIntroCloudGFX1
add hl, de
ld a, l
ld [H_VBCOPYSRC], a
ld a, h
ld [H_VBCOPYSRC + 1], a
xor a
ld [H_VBCOPYDEST], a
ld a, $96
ld [H_VBCOPYDEST + 1], a
ld a, $4
ld [H_VBCOPYSIZE], a
ret
.expired
call YellowIntro_MaskCurrentAnimatedObjectStruct
call YellowIntro_NextScene
ret
YellowIntroCloudGFX1: INCBIN "gfx/unknown_f9c2c.2bpp"
YellowIntroCloudGFX2: INCBIN "gfx/unknown_f9c6c.2bpp" ; indirectly referenced
YellowIntroScene12:
call YellowIntro_BlankPalsDelay2AndDisableLCD
ld c, $5
call UpdateMusicCTimes
xor a
ld [hLCDCPointer], a
ld hl, vBGMap0
ld bc, $80
ld a, $1
call Bank3E_FillMemory
ld hl, $9880
ld bc, $140
xor a
call Bank3E_FillMemory
ld hl, $99c0
ld bc, $80
ld a, $1
call Bank3E_FillMemory
; paste 8x12 graphic into vBGMap0 at (5, 6) starting at tile 4, skipping 4 vtiles at the end of each row
ld hl, $98c5
ld de, $20
ld a, $4
ld b, 8
.row
ld c, 12
push hl
.col
ld [hli], a
inc a
dec c
jr nz, .col
pop hl
add hl, de
add $4
dec b
jr nz, .row
ld hl, $98c4 ; (4, 6)
ld [hl], $3
ld hl, $98e4 ; (4, 7)
ld [hl], $74
ld hl, $99a5 ; (5, 5)
ld [hl], $0
lb de, $60, $58
ld a, $9
call YellowIntro_SpawnAnimatedObjectAndSavePointer
xor a
call Func_f9e9a
call YellowIntro_SetTimerFor128Frames
call YellowIntro_NextScene
ret
YellowIntroScene13:
call YellowIntro_CheckFrameTimerDecrement
ret nc
lb de, $68, $58
ld a, $a
call SpawnAnimatedObject
call YellowIntro_NextScene
ret
YellowIntroScene14:
ld de, YellowIntroPalSequence_f9dd6
call YellowIntro_LoadDMGPalAndIncrementCounter
jr c, .expired
ld [rBGP], a
ld [rOBP0], a
and $f0
ld [rOBP1], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
ret
.expired
call MaskAllAnimatedObjectStructs
call YellowIntro_BlankOAMBuffer
ld hl, wTileMap
ld bc, $50
ld a, $1
call Bank3E_FillMemory
coord hl, 0, 4
ld bc, CopyVideoDataAlternate
xor a
call Bank3E_FillMemory
coord hl, 0, 14
ld bc, $50
ld a, $1
call Bank3E_FillMemory
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld a, $e4
ld [rOBP0], a
ld [rBGP], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
lb de, $58, $58
ld a, $7
call YellowIntro_SpawnAnimatedObjectAndSavePointer
call YellowIntro_NextScene
ld a, $28
ld [wYellowIntroSceneTimer], a
ret
YellowIntroScene15:
call YellowIntro_CheckFrameTimerDecrement
jr c, .expired
ld a, [wYellowIntroSceneTimer]
and $3
ret nz
ld a, [rOBP0]
xor $ff
ld [rOBP0], a
ld a, [rBGP]
xor $3
ld [rBGP], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
ret
.expired
xor a
ld [hLCDCPointer], a
ld a, $e4
ld [rBGP], a
ld [rOBP0], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
call YellowIntro_NextScene
YellowIntroScene16:
ld de, YellowIntroPalSequence_f9e0a
call YellowIntro_LoadDMGPalAndIncrementCounter
jr c, .expired
ld [rOBP0], a
ld [rBGP], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
ret
.expired
call YellowIntro_NextScene
ret
YellowIntroPalSequence_f9dd6:
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $e4
db $e4, $c0, $c0, $ff
YellowIntroPalSequence_f9e0a:
db $e4, $90, $90, $40
db $40, $00, $00, $ff
YellowIntroScene17:
ld c, 64
call DelayFrames
ld hl, wYellowIntroCurrentScene
set 7, [hl]
ret
YellowIntro_SpawnAnimatedObjectAndSavePointer:
call SpawnAnimatedObject
ld a, c
ld [wYellowIntroAnimatedObjectStructPointer], a
ld a, b
ld [wYellowIntroAnimatedObjectStructPointer + 1], a
ret
YellowIntro_MaskCurrentAnimatedObjectStruct:
ld a, [wYellowIntroAnimatedObjectStructPointer]
ld c, a
ld a, [wYellowIntroAnimatedObjectStructPointer + 1]
ld b, a
call MaskCurrentAnimatedObjectStruct
ret
YellowIntro_SetTimerFor128Frames:
ld a, 128
ld [wYellowIntroSceneTimer], a
ret
YellowIntro_SetTimerFor88Frames:
ld a, 88
ld [wYellowIntroSceneTimer], a
ret
YellowIntro_CheckFrameTimerDecrement:
ld hl, wYellowIntroSceneTimer
ld a, [hl]
and a
jr z, .asm_f9e4b
dec [hl]
and a
ret
.asm_f9e4b
scf
ret
YellowIntro_LoadDMGPalAndIncrementCounter:
ld hl, wYellowIntroSceneTimer
ld a, [hl]
inc [hl]
ld l, a
ld h, $0
add hl, de
ld a, [hl]
cp $ff
jr z, .asm_f9e5d
and a
ret
.asm_f9e5d
scf
ret
Func_f9e5f:
ld hl, vBGMap0
ld bc, $80
ld a, $1
call Bank3E_FillMemory
ld hl, $9880
ld bc, $140
xor a
call Bank3E_FillMemory
ld hl, $99c0
ld bc, $80
ld a, $1
call Bank3E_FillMemory
ret
YellowIntro_BlankPalsDelay2AndDisableLCD:
xor a
ld [rBGP], a
ld [rOBP0], a
ld [rOBP1], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
call DelayFrame
call DelayFrame
call DisableLCD
ret
Func_f9e9a:
ld e, a
callab YellowIntroPaletteAction
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $90
ld [hWY], a
ld a, $e3
ld [rLCDC], a
ld a, $e4
ld [rBGP], a
ld [rOBP0], a
ld a, $e0
ld [rOBP1], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
ret
YellowIntro_Copy8BitSineWave:
; Copy this sine wave into wYellowIntroSurfingPikaSineWaveBuffer 8 times (end just before wc900)
ld de, wYellowIntroSurfingPikaSineWaveBuffer
ld a, $8
.loop
push af
ld hl, .SineWave
ld bc, .SineWaveEnd - .SineWave
call Bank3E_CopyData
pop af
dec a
jr nz, .loop
ret
.SineWave:
; a sine wave with amplitude 4
db 0, 0, 1, 2, 2, 3, 3, 3
db 4, 3, 3, 3, 2, 2, 1, 0
db 0, 0, -1, -2, -2, -3, -3, -3
db -4, -3, -3, -3, -2, -2, -1, 0
.SineWaveEnd:
Request7TileTransferFromC810ToC710:
ld a, wc810 % $100
ld [H_VBCOPYSRC], a
ld a, wc810 / $100
ld [H_VBCOPYSRC + 1], a
ld a, wc710 % $100
ld [H_VBCOPYDEST], a
ld a, wc710 / $100
ld [H_VBCOPYDEST + 1], a
ld a, $7
ld [H_VBCOPYSIZE], a
ret
InitYellowIntroGFXAndMusic:
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld [hSCX], a
ld [hSCY], a
ld [H_AUTOBGTRANSFERDEST], a
ld a, $98
ld [H_AUTOBGTRANSFERDEST + 1], a
call YellowIntro_BlankTileMap
ld hl, wTileMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $1
call Bank3E_FillMemory
coord hl, 0, 4
ld bc, CopyVideoDataAlternate
xor a
call Bank3E_FillMemory
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld de, $6b5a
ld hl, $8000
ld bc, $3eff
call CopyVideoData
ld de, $635a
ld hl, $9000
ld bc, $3e80
call CopyVideoData
call ClearObjectAnimationBuffers
call LoadYellowIntroObjectAnimationDataPointers
ld b, $8
call RunPaletteCommand
xor a
ld hl, wYellowIntroCurrentScene
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld a, MUSIC_INTRO_BATTLE
ld c, BANK(Music_IntroBattle)
call PlayMusic
ret
LoadYellowIntroObjectAnimationDataPointers:
ld a, YellowIntro_AnimatedObjectSpawnStateData % $100
ld [wAnimatedObjectSpawnStateDataPointer], a
ld a, YellowIntro_AnimatedObjectSpawnStateData / $100
ld [wAnimatedObjectSpawnStateDataPointer + 1], a
ld a, YellowIntro_AnimatedObjectJumptable % $100
ld [wAnimatedObjectJumptablePointer], a
ld a, YellowIntro_AnimatedObjectJumptable / $100
ld [wAnimatedObjectJumptablePointer + 1], a
ld a, YellowIntro_AnimatedObjectOAMData % $100
ld [wAnimatedObjectOAMDataPointer], a
ld a, YellowIntro_AnimatedObjectOAMData / $100
ld [wAnimatedObjectOAMDataPointer + 1], a
ld a, YellowIntro_AnimatedObjectFramesData % $100
ld [wAnimatedObjectFramesDataPointer], a
ld a, YellowIntro_AnimatedObjectFramesData / $100
ld [wAnimatedObjectFramesDataPointer + 1], a
ret
YellowIntro_BlankTileMap:
ld hl, wTileMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call Bank3E_FillMemory
ret
Bank3E_CopyData:
.loop
ld a, [hli]
ld [de], a
inc de
dec bc
ld a, c
or b
jr nz, .loop
ret
Bank3E_FillMemory:
push de
ld e, a
.loop
ld a, e
ld [hli], a
dec bc
ld a, c
or b
jr nz, .loop
pop de
ret
YellowIntro_BlankOAMBuffer:
ld hl, wOAMBuffer
ld bc, wOAMBufferEnd - wOAMBuffer
xor a
call Bank3E_FillMemory
ret
YellowIntro_BlankPalettes:
xor a
ld [rBGP], a
ld [rOBP0], a
ld [rOBP1], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
ret
YellowIntro_AnimatedObjectSpawnStateData:
db $00, $00, $00
db $01, $01, $00
db $02, $01, $00
db $03, $01, $00
db $04, $02, $00
db $05, $03, $00
db $06, $04, $00
db $07, $01, $00
db $08, $05, $00
db $09, $01, $00
db $0a, $01, $00
YellowIntro_AnimatedObjectJumptable:
dw Func_fa007
dw Func_fa007
dw Func_fa008
dw Func_fa014
dw Func_fa02b
dw Func_fa062
Func_fa007:
ret
Func_fa008:
ld hl, $4
add hl, bc
ld a, [hl]
cp $58
ret z
sub $4
ld [hl], a
ret
Func_fa014:
ld hl, $4
add hl, bc
ld a, [hl]
cp $58
jr z, .asm_fa020
add $4
ld [hl], a
.asm_fa020
ld hl, $5
add hl, bc
cp $58
ret z
add $1
ld [hl], a
ret
Func_fa02b:
ld hl, $b
add hl, bc
ld e, [hl]
ld d, $0
ld hl, Jumptable_fa03b
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_fa03b:
dw Func_fa03f
dw Func_fa051
Func_fa03f:
ld hl, $5
add hl, bc
ld a, [hl]
cp $58
jr z, .asm_fa04c
sub $2
ld [hl], a
ret
.asm_fa04c
ld hl, $b
add hl, bc
inc [hl]
Func_fa051:
ld hl, $c
add hl, bc
ld a, [hl]
inc [hl]
ld d, $8
call Func_fa079
ld hl, $7
add hl, bc
ld [hl], a
ret
Func_fa062:
ld hl, $b
add hl, bc
ld a, [hl]
ld hl, $4
add hl, bc
add [hl]
ld [hl], a
ret
Func_fa06e:
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
Func_fa077: ; cosine
add $10
Func_fa079:
and $3f
cp $20
jr nc, .asm_fa084
call Func_fa08e
ld a, h
ret
.asm_fa084
and $1f
call Func_fa08e
ld a, h
xor $ff
inc a
ret
Func_fa08e:
ld e, a
ld a, d
ld d, $0
ld hl, Unkn_fa0aa
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, $0
.asm_fa09d
srl a
jr nc, .asm_fa0a2
add hl, de
.asm_fa0a2
sla e
rl d
and a
jr nz, .asm_fa09d
ret
Unkn_fa0aa:
sine_wave $100
|