forked from bruddog/Tecmo_Super_Bowl_NES_Disassembly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bank17_18_main_game_loop.asm
10968 lines (8876 loc) · 669 KB
/
Bank17_18_main_game_loop.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
.BASE $8000
.ORG $8000
BANK_JUMP_GAME_START:
JMP GAME_START ; START GAME MAIN LOOP
JUMP_PLAYER_INJURED:
JMP SWAP_BANK_THEN_DO_UPDATE_STARTERS ; PLAYER INJURED UPDATE STARTERS
UNUSED_BANK_17_JUMP:
JMP UNUSED_BANK_17_JUMP ; UNUSED
JUMP_CHANGE_PLAYERS:
JMP IN_GAME_CHANGE_PLAYERS ; CHANGE PLAYERS
JUMP_UPDATE_SCOREBOARD_SKP_MODE:
JMP UPDATE_SCOREBOARD_CONDITIONS_SKP_MODE ; UPDATE SCOREBOARD PPU, CLEAR PPU SECTION AND CLEAR SCORES 800C
JUMP_UPDATE_LARGE_SCOREBOARD:
JMP UPDATE_LARGE_SCOREBOARD ; UPDATE SCOREBOARD PPU 800F
; offset for nfl shield sprties
NLF_LOGO_X_LOCATION_PRESEASON = $B0
NLF_LOGO_X_LOCATION_SEASON = $20
; *** can replace with actual label names once all builds
;;; BANK 19 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;ON_FIELD_GAMEPLAY_START = $8000
;;; BANK 20 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;DRAW_PLAYBOOK = $8803
;DO_PLAY_CHANGE_IN_TEAM_DATA = $8806
;DRAW_INITIAL_PLAY_NAME_PLAY_CHANGE = $8809
;DRAW_CURRENT_PLAY_NAME_PLAY_CHANGE = $880C
;;;BANK 23 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;BANK_JUMP_BANNER_TASK_START = $9003
;;; BANK 25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;DRAW_NFL_LEADERS = $8000
;DRAW_PLAYER_ATTRIBUTES = $8003
;DRAW_PLAYER_TYPE_PRO_BOWL = $8006
;;;; BANK 26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;FLASH_CURRENT_GAME_IN_SCHEDULE = $8003
;RESET_SCHEDULE_RANDOMIZE_ORDER = $8006
;GET_NUMBER_OF_GAMES_IN_WEEK = $8009
;CLEAR_SEASON_INFO = $800C
;RESET_TEAM_PLAYBOOK_TO_DEFAULT_SAVE_CHECKSUM = $800F
;RESET_AFC_STARTERS = $8012
;RESET_NFC_STARTERS = $8015
;DRAW_TEAM_DATA_SCREEN = $8018
;DRAW_DEFENSIVE_STARTERS_SCREEN = $801B
;DRAW_TEAM_CONTROL_TYPE_SCREEN = $801E
;SAVE_DEFAULT_AFC_PLAYERS_W_CHECKSUM = $8021
;SAVE_DEFAULT_NFC_PLAYERS_W_CHECKSUM = $8024
;GET_TEAM_1_RUSHING_YARDS = $802A
;GET_TEAM_2_RUSHING_YARDS = $802D
;GET_TEAM_1_PASSING_YARDS = $8030
;GET_TEAM_2_PASSING_YARDS = $8033
PLAYER_IS_INJURED_BITFLAG = $80
PLAYER_IS_STARTER_BITFLAG = $40
_F{_START_INTRO ; DONE
GAME_START:
SET_STACK[loc] GAME_MENUS_STACK_INDEX
SWAP_A000_BANK[bank_id] MAIN_GAME_BANK_2
JSR SET_BG_SPR_FULLY_FADED_OUT ; FADE OUT PALLETE()
JSR CLEAR_ALL_NAMETABLES ; CLEAR NAMETABLES()
JSR SET_ALL_SPR_OFFSCREEN ; CLEAR SPRITES()
@draw_intro: ; DRAW INTRO
RETURN_1_FRAME
END_SCENE_DRAW_NEW[sceneId_sceneBank] INTRO_SCENE_ID, CUTSCENE_DRAW_SCRIPT_BANK
RETURN_IN_NUM_FRAMES 4
@intro_slow_mo_enable_check: ; INTRO LOOP
RETURN_1_FRAME
LDA JOY_PRESS_1 ; CHECK FOR DOWN PRESSED
AND #DOWN_DPAD ;
BEQ @intro_a_b_press_check ;
INC SLOW_MOTION_PAUSE_DEBUG ; INCREASE SLOW MOTION/STOP DEBUG
@intro_a_b_press_check:
LDA JOY_PRESS_BOTH ; IS P1/P2 PRESS = A or B , select or starts
AND #(A_BUTTON + B_BUTTON + SELECT_BUTTON + START_BUTTON) ;
BEQ @intro_slow_mo_enable_check ; NO-> INTRO LOOP
_F}_START_INTRO
_F{_START_SCREEN ; DONE
DRAW_START_SCREEN:
JSR END_DRAW_FADE_OUT_STOP_SOUND_CLEAR_SCREEN ; END TASKS, FADE OUT PALLETE, STOP MUSIC, CLEAR NAMETABLES, CLEAR SPRITES()
END_SCENE_DRAW_NEW[sceneId_sceneBank] START_SCREEN_SCENE_ID, CUTSCENE_DRAW_SCRIPT_BANK
RETURN_IN_NUM_FRAMES 8
@check_for_start_sound_mode: ; CHECK FOR SOUND MODE SCREEN OR START/A PRESS LOOP
RETURN_1_FRAME
LDA JOY_RAW_1 ; IS P1 LEFT + B HELD
CMP #(LEFT_DPAD + B_BUTTON) ;
BEQ DO_SOUND_MODE ; YES-> BRANCH TO DRAW SOUND MODE SCREEN
@check_for_start_game:
LDA JOY_PRESS_BOTH ; IS START OR A PRESSED?
AND #(START_BUTTON+ A_BUTTON) ;
BEQ @check_for_start_sound_mode ; NO-> LOOP BACK TO CHECK FOR SOUND MODE SCREEN OR START/A PRESS LOOP
@start_game:
JSR END_ALL_DRAWING_TASKS_CLEAR_YSCROLL ; END TASKS 2,3,4,5, CLEAR Y SCROLL()
END_SCENE_DRAW_NEW[sceneId_sceneBank] FLASH_START_GAME_SCENE_ID, CUTSCENE_DRAW_SCRIPT_BANK
RETURN_IN_NUM_FRAMES 120
JSR END_DRAW_FADE_OUT_STOP_SOUND_CLEAR_SCREEN ; END TASKS, FADE OUT PALLETE, STOP MUSIC, CLEAR NAMETABLES, CLEAR SPRITES()
JMP DRAW_MAIN_MENU_INIT ; JUMP TO MAIN MENU START
_F}_START_SCREEN
_F{_DO_SOUND_MODE ; DONE
DO_SOUND_MODE: ; DRAW SOUND MODE SCREEN
JUMP_8000_BANK_AND_RETURN[bank_funcAddr] SOUND_MODE_SCREEN_BANK, $8000
JMP DRAW_START_SCREEN ; JUMP BACK TO DRAW START SCREEN
_F}_DO_SOUND_MODE
_F{_MAIN_MENU_SCREEN ; DONE
DRAW_MAIN_MENU_INIT: ; MAIN MENU START
SET_ADDR_XY[addr] SMALL_LARGE_LETTERS_LOGO_IRQ_INFO
JSR LOAD_IRQ_SPLIT_DATA ; LOAD IRQ SPLIT INFO(Y,X= IRQ INFO ADDRESS)
SET_SOFT_SPRITE_8_BY_8[] ; SETS RAM PPU CTRL TO 8 X 8 SPRITES
LDA #$00 ;
STA MENU_Y ; CLEAR MENU ARROW Y
STA MENU_X ; CLEAR MENU ARROW X
DRAW_MAIN_MENU_PREV_CHOICE: ; FADE OUT PAL, CLEAR NAMETABLES AND SPRITE AND DRAW MAIN MENU
JSR SET_BG_SPR_FULLY_FADED_OUT ; FADE OUT PALLETE()
JSR SET_MMC3_VERT_MIRROR ; SET MMC3 MIRRORING TO VERTICAL()
JSR CLEAR_ALL_NAMETABLES ; CLEAR NAMETABLES()
JSR SET_ALL_SPR_OFFSCREEN ; CLEAR SPRITES()
JSR DRAW_MAIN_MENU_ONSCREEN_SEASON_OFFSCREEN ; DRAW MAIN MENU()
LDA #PRESEASON_MENU_BG_PAL_INDEX ; SET BACKGROUND PALLETE INDEX TO MAIN MENU
LDX #PRESEASON_MENU_SPR_PAL_INDEX ; SET SPRITE(OAM) PALLETE TO MAIN MENU
JSR SET_BG_SPR_PAL_SET_FULLY_FADED_IN ; UPDATE PALLETES,SOFT PALLETE IDS AND SET PALLETE FADES TO FULLY FADED IN(A= BACKGROUND, X = SPRITE)
INIT_MAIN_MENU_CHOICES: ; INITIALIZE MAIN MENU Y DATA OPTIONS
LDY #<MAIN_MENU_OPTIONS_DATA ;
LDX #>MAIN_MENU_OPTIONS_DATA ;
LDA #BOTH_JOYPADS ; SET JOYPAD INDEX= P1 AND P2
JSR SET_MENU_ARROW_OPTIONS ; SET MENU ARROW Y(X,Y = MENU DATA ADDRESS, A=JOYPAD)
@main_menu_input_loop: ; MAIN MENU PRESS LOOP
_WHILE PLUS
RETURN_1_FRAME
JSR CHECK_MENU_ARROW_UP_DOWN ; CHECK FOR MOVE MENU ARROW UP DOWN()
JSR UPDATE_MENU_ARROW_SPR_Y ; UPDATE MENU ARROW SPRITE Y LOCATION()
LDA JOY_PRESS_BOTH ; IS A BUTTON = PRESSED?
_END_WHILE
@do_menu_choice
JSR END_ALL_DRAWING_TASKS_CLEAR_YSCROLL ; END TASKS 2,3,4,5, CLEAR Y SCROLL()
LDA #SPRITE_OFFSCREEN ; SET ARROW SPRITE Y LOCATION = OFFSCREEN
STA MENU_ARROW_SPR_Y ;
RTS_JUMP_TABLE[memVal_tableAddr] MENU_Y, MAIN_MENU_COMMAND_TABLE
MAIN_MENU_COMMAND_TABLE: ; MENU COMMAND TABLE
.WORD PRESEASON_MENU_START -1 ; PRESEASON_MENU-1,
.WORD SEASON_MENU_START -1 ; SEASON_MENU -1,
.WORD PRO_BOWL_MENU_START -1 ; PRO_BOWL_MENU -1,
.WORD PRESEASON_TEAM_DATA_START -1 ; TEAM_DATA_MENU -1
_F}_MAIN_MENU_SCREEN
_F{_PRESEASON_MENU_SCREEN ; DONE
PRESEASON_MENU_START: ; PRESEASON_MENU
LDA GAME_STATUS ; SET GAME STATUS == PRESEASON
AND #$FC ;
STA GAME_STATUS ;
JSR SAVE_PORTION_OF_MAIN_MENU_SRAM ; SAVE PART OF MAIN MENU IN SRAM AND LOAD PRESASON MENU UNTIL DESTROYED()
INIT_PRESEASON_MENU:
LDY #<PRESEASON_MENU_OPTIONS_DATA ; SET MENU DRAW ADDRESS = MAIN MENU DRAW DATA= $B9E7
LDX #>PRESEASON_MENU_OPTIONS_DATA ;
LDA #BOTH_JOYPADS ; SET JOYPAD INDEX= P1 AND P2
JSR SET_MENU_ARROW_OPTIONS ; SET MENU ARROW Y(X,Y = MENU DATA ADDRESS, A=JOYPAD)
@preseason_menu: ; CHECK FOR PRESEASON MENU BUTTON PRESS LOOP
_WHILE PLUS
RETURN_1_FRAME
JSR CHECK_MENU_ARROW_UP_DOWN ; CHECK FOR MOVE MENU ARROW UP DOWN()
JSR UPDATE_MENU_ARROW_SPR_Y ; UPDATE MENU ARROW SPRITE Y LOCATION()
BIT JOY_PRESS_BOTH ; DOES P1/P2 PRESS= B PRESSED
BVC @check_a_pressed ; NO-> CHECK FOR A PRESSED
JMP RESTORE_MAIN_MENU_FROM_SRAM ; JUMP TO REDRAW MISSING PART MAIN MENU FROM SRAM AND JUMP TO INITIALIZE MAIN MENU Y DATA OPTIONS
@check_a_pressed: ; CHECK FOR A PRESSED
_END_WHILE
JSR END_ALL_DRAWING_TASKS_CLEAR_YSCROLL ; END TASKS 2,3,4,5, CLEAR Y SCROLL()
JSR SET_BG_SPR_FULLY_FADED_OUT ; FADE OUT PALLETE()
RTS_JUMP_TABLE[memVal_tableAddr] MENU_Y, PRESEASON_MENU_COMMAND_TABLE
.ENUM $00
MAN_V_COM_MENU_CHOICE .dsb 1
MAN_V_MAN_MENU_CHOICE .dsb 1
MAN_V_COA_MENU_CHOICE .dsb 1
COA_V_COM_MENU_CHOICE .dsb 1
COA_V_COA_MENU_CHOICE .dsb 1
COM_V_COM_MENU_CHOICE .dsb 1
.ENDE
PRESEASON_MENU_COMMAND_TABLE: ; PRESEASON MENU CHOICES
.WORD MAN_VS_COM_PRESEASON-1 ; MAN V COM PRESEASON - 1,
.WORD MAN_VS_MAN_PRESEASON-1 ; MAN V MAN PRESEASON - 1,
.WORD MAN_VS_COA_PRESEASON-1 ; MAN V COA PRESEASON - 1,
.WORD COA_VS_COM_PRESEASON-1 ; COA V COM PRESEASON - 1,
.WORD COA_VS_COA_PRESEASON-1 ; COA V COA PRESEASON - 1,
.WORD COM_VS_COM_PRESEASON-1 ; COM V COM PRESEASON - 1,
MAN_VS_COM_PRESEASON: ; MAN V COM PRESEASON
LDA #(P1_TEAM_MAN_CTRL + P2_TEAM_COM_CTRL) ; SET PLAYER TYPE = P1 MAN, P2 COM
STA TEAM_CONTROL_TYPES ;
JSR DRAW_TEAM_SELECT_BG_AND_INIT_MENU_MAP ; DRAW TEAM SELECT BACKGROUND, SET POSSIBLE ARROW LOCATIONS FOR TEAMS, UPDATE PALLETES
JSR CHECK_FOR_FIRST_TEAM_SELECTED ; CHECK FOR SINGLE TEAM SELECTED()
BCS @return_main_menu_man_v_com ; B PRESSED-> REDRAW MAIN MENU WITH ARROW ON MAN VS COM OPTION
@set_com_team:
JSR CHECK_FOR_SECOND_TEAM_SELECTED ; DO SINGLE MAN PLAYER TEAM SELECT()
BCS @return_main_menu_man_v_com: ; B PRESSED? YES->REDRAW MAIN MENU WITH ARROW ON MAN VS COM OPTION
@start_game
JMP TRANSFER_TEAM_INFO_AND_START_GAME ; JUMP TO GAME START
@return_main_menu_man_v_com: ; REDRAW MAIN MENU WITH ARROW ON MAN VS COM OPTION
LDA #MAN_V_COM_MENU_CHOICE ; SET Y MENU INDEX = FIRST OPTION = MAN V COM
STA MENU_Y ;
JMP REDRAW_MAIN_MENU_WITH_PRESEASON_MENU ; FADE OUT PALLETE, CLR SPRITES, NAMETABLES, DRAW MAIN MENU, SAVE MENU SRAM()
MAN_VS_MAN_PRESEASON: ; MAN V MAN PRESEASON
LDA #(P1_TEAM_MAN_CTRL + P2_TEAM_MAN_CTRL) ; SET PLAYER TYPE = P1 MAN, P2 COM
STA TEAM_CONTROL_TYPES ;
JSR DRAW_TEAM_SELECT_BG_AND_INIT_MENU_MAP ; DRAW TEAM SELECT BACKGROUND AND HELMETS, SET POSSIBLE ARROW LOCATIONS FOR TEAMS, UPDATE PALLETES
JSR CHECK_FOR_TEAM_SELECTED_2_PLAYER ; DO TWO PLAYER SELECT TEAMS LOOP()
BCS @return_main_menu_man_v_man ; B PRESSED? YES-> REDRAW MAIN MENU WITH ARROW ON MAN VS MAN OPTION
@start_game:
JMP TRANSFER_TEAM_INFO_AND_START_GAME ; JUMP TO GAME START
@return_main_menu_man_v_man: ; REDRAW MAIN MENU WITH ARROW ON MAN VS MAN OPTION
LDA #MAN_V_MAN_MENU_CHOICE ; SET Y MENU INDEX = SECOND OPTION = MAN V MAN
STA MENU_Y ;
JMP REDRAW_MAIN_MENU_WITH_PRESEASON_MENU ; FADE OUT PALLETE, CLR SPRITES, NAMETABLES, DRAW MAIN MENU, SAVE MENU SRAM()
COA_VS_COM_PRESEASON: ; COA V COM PRESEASON
LDA #(P1_TEAM_COA_CTRL + P2_TEAM_COM_CTRL) ; SET PLAYER TYPE = P1 COA, P2 COM
STA TEAM_CONTROL_TYPES ;
JSR DRAW_TEAM_SELECT_BG_AND_INIT_MENU_MAP ; DRAW TEAM SELECT BACKGROUND AND HELMETS, SET POSSIBLE ARROW LOCATIONS FOR TEAMS, UPDATE PALLETES
JSR CHECK_FOR_FIRST_TEAM_SELECTED ; CHECK FOR SINGLE TEAM SELECTED()
BCS @return_main_menu_coa_v_com ; B PRESSED-> REDRAW MAIN MENU WITH ARROW ON COA VS COM OPTION
@set_com_team:
JSR CHECK_FOR_SECOND_TEAM_SELECTED ; DO SINGLE MAN PLAYER TEAM SELECT()
BCS @return_main_menu_coa_v_com ; B PRESSED-> REDRAW MAIN MENU WITH ARROW ON COA VS COM OPTION
JMP TRANSFER_TEAM_INFO_AND_START_GAME ; JUMP TO GAME START
@return_main_menu_coa_v_com: ; REDRAW MAIN MENU WITH ARROW ON COA VS COM OPTION
LDA #COA_V_COM_MENU_CHOICE ; SET Y MENU INDEX= FOURTH OPTION = COA VS COM
STA MENU_Y ;
JMP REDRAW_MAIN_MENU_WITH_PRESEASON_MENU ; FADE OUT PALLETE, CLR SPRITES, NAMETABLES, DRAW MAIN MENU, SAVE MENU SRAM()
COA_VS_COA_PRESEASON: ; COA V COA PRESEASON
LDA #(P1_TEAM_COA_CTRL + P2_TEAM_COA_CTRL) ; SET PLAYER TYPE = P1 COA, P2 COA
STA TEAM_CONTROL_TYPES ;
JSR DRAW_TEAM_SELECT_BG_AND_INIT_MENU_MAP ; DRAW TEAM SELECT BACKGROUND AND HELMETS, SET POSSIBLE ARROW LOCATIONS FOR TEAMS, UPDATE PALLETES
JSR CHECK_FOR_TEAM_SELECTED_2_PLAYER ; DO TWO PLAYER SELECT TEAMS LOOP()
BCS @return_main_menu_coa_v_coa ; B PRESSED? YES-> REDRAW MAIN MENU WITH ARROW ON COA VS COA OPTION
@start_game:
JMP TRANSFER_TEAM_INFO_AND_START_GAME ; JUMP TO GAME START
@return_main_menu_coa_v_coa: ; REDRAW MAIN MENU WITH ARROW ON COA VS COA OPTION
LDA #COA_V_COA_MENU_CHOICE ; SET Y MENU INDEX = FIFTH OPTION = COA VS COM
STA MENU_Y
JMP REDRAW_MAIN_MENU_WITH_PRESEASON_MENU ; FADE OUT PALLETE, CLR SPRITES, NAMETABLES, DRAW MAIN MENU, SAVE MENU SRAM()
MAN_VS_COA_PRESEASON: ; MAN V COA PRESEASON
LDA #(P1_TEAM_MAN_CTRL + P2_TEAM_COA_CTRL) ; SET PLAYER TYPE = P1 MAN, P2 COA
STA TEAM_CONTROL_TYPES ;
JSR DRAW_TEAM_SELECT_BG_AND_INIT_MENU_MAP ; DRAW TEAM SELECT BACKGROUND AND HELMETS, SET POSSIBLE ARROW LOCATIONS FOR TEAMS, UPDATE PALLETES
JSR CHECK_FOR_FIRST_TEAM_SELECTED ; CHECK FOR SINGLE TEAM SELECTED()
BCS @return_main_menu_man_v_coa ; B PRESSED->REDRAW MAIN MENU WITH ARROW ON MAN VS COA OPTION
@set_coa_team:
JSR CHECK_FOR_SECOND_TEAM_SELECTED ; DO SINGLE MAN PLAYER TEAM SELECT()
BCS @return_main_menu_man_v_coa ; B PRESSED->REDRAW MAIN MENU WITH ARROW ON MAN VS COA OPTION
@start_game:
JMP TRANSFER_TEAM_INFO_AND_START_GAME ; JUMP TO GAME START
@return_main_menu_man_v_coa: ; REDRAW MAIN MENU WITH ARROW ON MAN VS COA OPTION
LDA #MAN_V_COA_MENU_CHOICE ; SET Y MENU INDEX = THIRD OPTION = COA VS COM
STA MENU_Y ;
JMP REDRAW_MAIN_MENU_WITH_PRESEASON_MENU ; FADE OUT PALLETE, CLR SPRITES, NAMETABLES, DRAW MAIN MENU, SAVE MENU SRAM()
COM_VS_COM_PRESEASON: ; COM V COM PRESEASON
LDA #(P1_TEAM_COM_CTRL + P2_TEAM_COM_CTRL) ; SET PLAYER TYPE = P1 COM, P2 COM
STA TEAM_CONTROL_TYPES ;
JSR DRAW_TEAM_SELECT_BG_AND_INIT_MENU_MAP ; DRAW TEAM SELECT BACKGROUND AND HELMETS, SET POSSIBLE ARROW LOCATIONS FOR TEAMS, UPDATE PALLETES
JSR CHECK_FOR_FIRST_TEAM_SELECTED ; CHECK FOR SINGLE TEAM SELECTED()
BCS @return_main_menu_com_v_com ; B PRESSED->REDRAW MAIN MENU WITH ARROW ON COM VS COM OPTION
JSR CHECK_FOR_SECOND_TEAM_SELECTED ; DO SINGLE MAN PLAYER TEAM SELECT()
BCS @return_main_menu_com_v_com ; B PRESSED->REDRAW MAIN MENU WITH ARROW ON COM VS COM OPTION
JMP TRANSFER_TEAM_INFO_AND_START_GAME ; JUMP TO GAME START
@return_main_menu_com_v_com: ; REDRAW MAIN MENU WITH ARROW ON COM VS COM OPTION
LDA #COM_V_COM_MENU_CHOICE ; SET MENU Y OPTION = THIRD OPTION = COM VS COM
STA MENU_Y ;
JMP REDRAW_MAIN_MENU_WITH_PRESEASON_MENU ; JUMP->FADE OUT PALLETE, CLR SPRITES, NAMETABLES, DRAW MAIN MENU, SAVE MENU SRAM()
sram_addr = LOCAL_1
RESTORE_MAIN_MENU_FROM_SRAM: ; REDRAW MISSING PART MAIN MENU FROM SRAM AND JUMP TO INITIALIZE MAIN MENU Y DATA OPTIONS
LDA #SPRITE_OFFSCREEN ; SET MENU ARROW SPRITE Y = OFFSCREEN
STA MENU_ARROW_SPR_Y ;
LDY #<MAIN_MENU_TEXT_START_PPU_ADDR ; SET PPU ADDRESS = $2545
LDX #>MAIN_MENU_TEXT_START_PPU_ADDR ;
LDA #<MENU_SCREEN_SAVE_SRAM ; SET SRAM ADDRESS = $6003
STA sram_addr ;
LDA #>MENU_SCREEN_SAVE_SRAM ;
STA sram_addr+1 ;
JSR TRANSFER_TO_PPU_OR_PPUBUFF_WITH_COMMANDS ; TRANFER DATA TO PPU VIA BUFFER OR DIRECTLY DEPENDING ON FADE VALUES (X,Y= PPU ADDRESS, 3E,3F = DATA ADDRESS)
LDA #$00 ; SET Y MENU INDEX= FIRST OPTION
STA MENU_Y ;
JMP INIT_MAIN_MENU_CHOICES ; JUMP TO INITIALIZE MAIN MENU Y DATA OPTIONS
REDRAW_MAIN_MENU_WITH_PRESEASON_MENU: ; FADE OUT PALLETE, CLR SPRITES, NAMETABLES, DRAW MAIN MENU, SAVE MENU SRAM()
JSR SET_BG_SPR_FULLY_FADED_OUT ; FADE OUT PALLETE()
JSR CLEAR_ALL_NAMETABLES ; CLEAR NAMETABLES()
JSR SET_ALL_SPR_OFFSCREEN ; CLEAR SPRITES()
JSR DRAW_MAIN_MENU_ONSCREEN_SEASON_OFFSCREEN ; DRAW MAIN MENU()
JSR SAVE_PORTION_OF_MAIN_MENU_SRAM ; SAVE PART OF MAIN MENU IN SRAM AND LOAD PRESEASON MENU UNTIL DESTROYED()
LDA #PRESEASON_MENU_BG_PAL_INDEX ; SET BACKGROUND PALLETE
LDX #PRESEASON_MENU_SPR_PAL_INDEX ; SET SPRITE PALLETE
JSR SET_BG_SPR_PAL_SET_FULLY_FADED_IN ; UPDATE PALLETES,SOFT PALLETE IDS AND SET PALLETE FADES TO FULLY FADED IN(A= BACKGROUND, X = SPRITE)
JMP INIT_PRESEASON_MENU
_F}_PRESEASON_MENU_SCREEN
_F{_SEASON_MAIN_MENU_SCREEN ; DONE
SEASON_MENU_START: ; SEASON_MENU
SET_GAME_STATUS_SEASON_MODE[]
LDA #$00 ; SET NFL SHIELD LOCATION
STA MENU_Y ; SET Y MENU INDEX= FIRST OPTION
JSR SCROLL_PRESEASON_SEASON_SCREENS ; SCROLL MENU SCREEN AND INITIALIAZE ARROW LOCATION(A= NFL SHIELD LOATION)
SEASON_MENU_INIT: ; SEASON MENU SELECTION LOOP
LDY #<SEASON_MENU_OPTIONS_DATA ;
LDX #>SEASON_MENU_OPTIONS_DATA ;
LDA #BOTH_JOYPADS ; SET JOYPAD INDEX= P1 AND P2
JSR SET_MENU_ARROW_OPTIONS ; SET MENU ARROW Y(X,Y = MENU DATA ADDRESS, A=JOYPAD)
@not_selected:
_WHILE PLUS
RETURN_1_FRAME
JSR CHECK_MENU_ARROW_UP_DOWN ; CHECK FOR MENU CURSOR MOVED UP OR DOWN() RET= CARRY SET= MOVED
JSR UPDATE_MENU_ARROW_SPR_Y ; UPDATE MENU ARROW SPRITE Y LOCATION()
BIT JOY_PRESS_BOTH ; DOES P1/P2 PRESS= B PRESSED
BVC @check_a ; NO->
JMP SCROLL_TO_MAIN_MENU
@check_a: ; CHECK FOR A PRESSED
_END_WHILE
JSR END_ALL_DRAWING_TASKS_CLEAR_YSCROLL ; END TASKS 2,3,4,5, CLEAR Y SCROLL()
RTS_JUMP_TABLE[memVal_tableAddr] MENU_Y, SEASON_MENU_COMMAND_TABLE
SEASON_MENU_COMMAND_TABLE: ; SEASON MENU CHOICES
.WORD SEASON_TEAM_CONTROL-1 ; TEAM CONTROL
.WORD SEASON_SCHEDULE-1 ; SCHEDULE
.WORD SEASON_GAME_START-1 ; GAME START
.WORD SEASON_STANDINGS-1 ; STANDINGS
.WORD TEAM_RANKINGS_SCREEN_START-1 ; TEAM RANKINGS
.WORD SEASON_NFL_LEADERS-1 ; NFL LEADERS
.WORD SEASON_TEAM_DATA-1 ; TEAM DATA
_F}_SEASON_MAIN_MENU_SCREEN
_F{_SEASON_TEAM_CONTROL_SCREEN ; DONE
SEASON_TEAM_CONTROL: ; TEAM CONTROL
JSR SET_BG_SPR_FULLY_FADED_OUT ; FADE OUT PALLETE()
DRAW_SCENE_UNTIL_ENDED[sceneId_sceneBank] TEAM_CONTROL_SCREEN_ID, MENU_DRAW_SCRIPT_BANK
LDY #<MINI_HELMETS_TEAM_CONTROL_SELECT_SPR_Y_X ;
LDX #>MINI_HELMETS_TEAM_CONTROL_SELECT_SPR_Y_X ;
JSR DRAW_MINI_HELMETS_AT_LOCATIONS ; DRAW MINI HELMETS AT COORDINATES()
JUMP_8000_BANK_AND_RETURN[bank_funcAddr] DRAW_TEAM_CONTROL_SCREEN_BANK, BANK_JUMP_DRAW_TEAM_CONTROL_TYPE_SCREEN ; *** can use actual addr
JSR END_ALL_DRAWING_TASKS_CLEAR_YSCROLL ; END TASKS 2,3,4,5, CLEAR Y SCROLL()
LDA #$00 ;
STA MENU_Y ; SET Y MENU OPTION = FIRST OPTION
STA MENU_X ; SET X MENU OPTION = FIRST OPTION
REDRAW_SEASON_MENU_SCREEN_INIT_MENU: ; REDRAW MAIN MENU/SEASON MENU, UPDATE PALLETES, JUMP TO SEASON MENU SELECTION LOOP
JSR REDRAW_SEASON_MENU_SCREEN ; REDRAW MAIN MENU AND SEASON MENU()
LDA #SEASON_MENU_BG_PAL_INDEX ; SET BACKGROUND PALLETE INDEX
LDX #SEASON_MENU_SPR_PAL_INDEX ; SET SPRITE PALLETE INDEX
JSR SET_BG_SPR_PAL_SET_FULLY_FADED_IN ;
JMP SEASON_MENU_INIT ; JUMP TO SEASON MENU SELECTION LOOP
REDRAW_SEASON_MENU_SCREEN: ; REDRAW MAIN MENU AND SEASON MENU
JSR SET_BG_SPR_FULLY_FADED_OUT ; FADE OUT PALLETE()
JSR CLEAR_ALL_NAMETABLES ; CLEAR NAMETABLES()
JSR SET_ALL_SPR_OFFSCREEN ; CLEAR SPRITES()
DRAW_SCENE_UNTIL_ENDED[sceneId_sceneBank] MAIN_MENU_SCREEN_ID, MENU_DRAW_SCRIPT_BANK
DRAW_SCENE_UNTIL_ENDED[sceneId_sceneBank] SEASON_MENU_SCREEN_ID, MENU_DRAW_SCRIPT_BANK
LDA #NLF_LOGO_X_LOCATION_SEASON ; SET LOGO LOCATION = LEFT PART OF SCREEN
JSR DRAW_NFL_SHIELD_SPRITES[x_offset] ; DRAW NFL LOGO FOR MENU(A= LOGO LOCATION)
RTS ; RETURN
_F}_SEASON_TEAM_CONTROL_SCREEN
_F{_SEASON_SCHEDULE_SCREEN ; DONE
ppu_addr = LOCAL_1
sram_addr = LOCAL_3
LAST_SCHEDULE_PAGE = $12
NUM_WEEKS_PER_SCREEN = $04
SCHEDULE_MENU_NUM_TILES = $0D
SCHEDULE_MENU_NUM_ROWS = $09
AUTOSKP_MENU_NUM_TILES = $0D
AUTOSKP_MENU_NUM_ROWS = $05
AUTOSKP_WEEK_NUM_TILES = $02
AUTOSKP_WEEK_NUM_ROWS = $01
RESET_SCHED_NUM_TILES = $1C
RESET_SCHED_NUM_ROWS = $0B
FINAL_RESET_SCHED_NUM_TILES = $1C
FINAL_RESET_SCHED_NUM_ROWS = $0B
autoskip_choices = LAST_WEEK_OF_SEASON + 2 ; add one for zero index and one more for week 0(none) skip choice
SEASON_SCHEDULE: ; SEASON SCHEDULE
LDA CURRENT_WEEK_IN_SEASON ; IS CURRENT WEEK < PLAYOFFS
CMP #FIRST_WEEK_OF_PLAYOFFS ;
BCC DRAW_REGULAR_SEASON_SCHEDULE ;
@else_draw_playoff_bracket:
JMP JUMP_TO_DRAW_PLAYOFF_BRACKET ;
DRAW_REGULAR_SEASON_SCHEDULE: ; REGULAR SEASON SCHEDULE
JSR SET_BG_SPR_FULLY_FADED_OUT ; FADE OUT PALLETE()
DRAW_SCENE_UNTIL_ENDED[sceneId_sceneBank] NFL_SCHEDULE_HEADER_SCREEN_ID, MENU_DRAW_SCRIPT_BANK
LDA #<WEEKLY_MATCHUPS_START ; SET START OF CURRENT WEEK MATCHUPS SRAM ADDRESS IN $8E/8F
STA WEEKLY_MATCHUPS_SRAM_ADDR ;
LDA #>WEEKLY_MATCHUPS_START ;
STA WEEKLY_MATCHUPS_SRAM_ADDR+1 ;
LDA CURRENT_WEEK_IN_SEASON ; LOAD CURRENT WEEK
AND #$FC ; CONVERTS WEEK NUMBER TO 4 WEEK INDEX
STA SCHEDULE_PAGE_FOR_DRAW ; SAVE 4 WEEK INDEX
STA TEMP_SCHEDULE_PAGE ;
JUMP_8000_BANK_AND_RETURN[bank_funcAddr] DRAW_SCHEDULE_BANK, $8000
LDA #SCHEDULE_MENU_BG_PAL_INDEX ; SET BG PALLETE
LDX #SCHEDULE_MENU_SPR_PAL_INDEX ; SET SPR PALLETE
JSR SET_BG_SPR_PAL_SET_FULLY_FADED_IN ; UPDATE PALLETES,SOFT PALLETE IDS AND SET PALLETE FADES TO FULLY FADED IN(A= BACKGROUND, X = SPRITE)
REGULAR_SEASON_SCHEDULE_INPUT_LOOP:
@update_schedule_page_loop: ; REGULAR SEASON SCHEDULE UPDATE LOOP
RETURN_1_FRAME
JUMP_8000_BANK_AND_RETURN[bank_funcAddr] DRAW_SCHEDULE_BANK, BANK_JUMP_FLASH_CURRENT_GAME_IN_SCHEDULE ; *** can use actual
BIT JOY_PRESS_BOTH ; DOES P1/P2 PRESS= B PRESSED
BVS REDRAW_SEASON_MENU_SCREEN_INIT_MENU ; YES-> REDRAW MAIN MENU/SEASON MENU, UPDATE PALLETES, JUMP TO SEASON MENU SELECTION LOOP
BMI @draw_schedule_menu ; DOES P1/P2 PRESS= A PRESSED YES->
LDA JOY_PRESS_BOTH ; DOES P1/P2 PRESS= UP OR DOWN PRESSED
AND #(UP_DPAD+DOWN_DPAD) ;
BEQ @update_schedule_page_loop ; NOTHING PRESSED-> REGULAR SEASON SCHEDULE UPDATE LOOP
@check_up_pressed:
AND #UP_DPAD ; DOES P1/P2 PRESS= UP PRESSED
BEQ @down_pressed ;
@up_pressed:
LDA TEMP_SCHEDULE_PAGE ; = 4 WEEK INDEX - 4 WEEKS
SEC ;
SBC #NUM_WEEKS_PER_SCREEN ; ARE WE AT FIRST 4 WEEK SEGMENT?
BCC @update_schedule_page_loop ; YES-> REGULAR SEASON SCHEDULE UPDATE LOOP
JMP @save_four_week_schedule_and_draw: ;
@down_pressed: ; DOWN PRESSED ON SCHEDULE GO FORWARD 4 WEEKS
LDA TEMP_SCHEDULE_PAGE ; = 4 WEEK INDEX + 4 WEEKS
CLC ;
ADC #NUM_WEEKS_PER_SCREEN ;
CMP #LAST_SCHEDULE_PAGE ; ARE WE AT LAST 4 WEEK SEGMENT?
BCS @update_schedule_page_loop ; YES-> REGULAR SEASON SCHEDULE UPDATE LOOP
@save_four_week_schedule_and_draw: ; SAVE 4 WEEK SEGMENT AND UPDATE SCHEDULE
STA TEMP_SCHEDULE_PAGE ; SET 4 WEEK INDEX
LDA TEMP_SCHEDULE_PAGE ;
STA SCHEDULE_PAGE_FOR_DRAW ;
JUMP_8000_BANK_AND_RETURN[bank_funcAddr] DRAW_SCHEDULE_BANK, $8000
JMP @update_schedule_page_loop ; JUMP-> REGULAR SEASON SCHEDULE UPDATE LOOP
@draw_schedule_menu: ; A PRESSED ON SCHEDULE
LDA #$00 ;
STA FRAME_COUNTER ;
JUMP_8000_BANK_AND_RETURN[bank_funcAddr] DRAW_SCHEDULE_BANK, BANK_JUMP_FLASH_CURRENT_GAME_IN_SCHEDULE ; *** can usu actual addr
JSR SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_FIRST_OPTION ; SET MENU ARROW OFFSCREEN AND MENU INDEX = FIRST OPTION()
@save_part_of_schedule_menu_sram
LDA #<SCHEDULE_MENU_PPU_ADDR ; SET SCHEDULE MENU PPU ADDRESS = $2082
STA ppu_addr ;
LDA #>SCHEDULE_MENU_PPU_ADDR ;
STA ppu_addr+1 ;
LDA #<SCHEDULE_MENU_SRAM ; SET SCHEDULE MENU ADDRESS = $6003
STA sram_addr ;
LDA #>SCHEDULE_MENU_SRAM ;
STA sram_addr+1 ;
LDX #SCHEDULE_MENU_NUM_TILES ; SET LENGTH = 13 TILES
LDY #SCHEDULE_MENU_NUM_ROWS ; SET ROWS = 9 TILES
JSR SAVE_PARTIAL_SCREEN_BG_IN_SRAM ; SAVE PPU DATA IN SRAM WHEN READY(3E,3F= PPU ADDRESS,40,41= SRAM ADDRESS, X,Y= DATA LENGTH )
LDA #SCHEDULE_MENU_SCREEN_ID ; LOAD SCHEDULE MENU DRAW EVENT INDEX
LDX #MENU_DRAW_SCRIPT_BANK ; LOAD BANK 16
JSR DRAW_SCENE_UNTIL_ENDED ; START DRAWING TASK AND DO UNTIL THREAD DESTROYED (A= CUTSCENE INDEX, X = BANK)
INIT_SCHEDULE_MENU_OPTIONS: ; LOAD SCHEDULE MENU OPTIONS
LDY #<SCHEDULE_MENU_OPTIONS_DATA ; LOAD SCHEDULE MENU INFO ADDRESS
LDX #>SCHEDULE_MENU_OPTIONS_DATA ;
LDA #BOTH_JOYPADS ; SET JOYPAD INDEX= P1 AND P2
JSR SET_MENU_ARROW_OPTIONS ; SET MENU ARROW Y(X,Y = MENU DATA ADDRESS, A=JOYPAD)
@schedule_menu_input_loop: ; SCHEDULE MENU INPUT CHECK
RETURN_1_FRAME
JSR CHECK_MENU_ARROW_UP_DOWN ; CHECK FOR MOVE MENU ARROW UP DOWN()
JSR UPDATE_MENU_ARROW_SPR_Y ; UPDATE MENU ARROW SPRITE Y LOCATION()
BIT JOY_PRESS_BOTH ; DOES P1/P2 PRESS= B PRESSED
BVC @check_a_press ; NO-> CHECK A PRESSED SCHEDULE
JMP RESTORE_SCHEDULE_SRAM ; YES-> CLEAR SCHEDULE MENU
@check_a_press: ; CHECK A PRESSED SCHEDULE
BPL @schedule_menu_input_loop ; A PRESSED? NO-> SCHEDULE MENU INPUT CHECK
LDA MENU_Y ; IS MENU OPTION = RESET SCHEDULE
CMP #RESET_SCHEDULE_CHOICE ;
BNE @check_playoff_autoksip ;
JMP RESET_SCHEDULE ; YES-> RESET SCHEDULE
@check_playoff_autoksip: ; CHECK FOR PLAYOFF SCHEDULE SELECTED
CMP #PLAYOFF_BRACKET_CHOICE ;
BNE AUTOSKIP_START ;
JMP JUMP_TO_DRAW_PLAYOFF_BRACKET ; YES-> JUMP TO PLAYOFF SCHEDULE SELECTED
AUTOSKIP_START: ; AUTOSKIP CHOICE SELECTED
length = LOCAL_1
rows = LOCAL_2
sram_addr = LOCAL_3
JSR SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_FIRST_OPTION ; SET MENU ARROW OFFSCREEN AND MENU INDEX = FIRST OPTION()
LDA #<AUTOSKIP_MENU_PPU_ADDR ; SET PPU ADDRESS = $20C3
STA ppu_addr ;
LDA #>AUTOSKIP_MENU_PPU_ADDR ;
STA ppu_addr+1 ;
LDA #<AUTOSKIP_MENU_SRAM ; SET SRAM ADDRESS = $6103
STA sram_addr ;
LDA #>AUTOSKIP_MENU_SRAM ;
STA sram_addr+1 ;
LDX #AUTOSKP_MENU_NUM_TILES ; SET LENGTH = 13 TILES
LDY #AUTOSKP_MENU_NUM_ROWS ; SET ROWS = 5 ROWS
JSR SAVE_PARTIAL_SCREEN_BG_IN_SRAM ; SAVE PPU DATA IN SRAM WHEN READY(3E,3F= PPU ADDRESS,40,41= SRAM ADDRESS, X,Y= DATA LENGTH )
LDA #SKIP_TO_WEEK_SCREEN_ID ; LOAD AUTO SKIP EVENT INDEX
LDX #MENU_DRAW_SCRIPT_BANK ; BANK 16
JSR DRAW_SCENE_UNTIL_ENDED ; START DRAWING TASK AND DO UNTIL THREAD DESTROYED (A= CUTSCENE INDEX, X = BANK)
LDX CURRENT_WEEK_IN_SEASON ; IS CURRENT WEEK > 17
CPX #FIRST_WEEK_OF_PLAYOFFS ;
BCS @exit_autoskip ; YES->
INX ; AUTOSKIP WEEK ++
CPX WEEK_TO_SKIP_TO ; IS CURRENT WEEK+1 > SKIP TO WEEK
BCS @save_week_to_skip_to ;
LDX WEEK_TO_SKIP_TO ; SAVE WEEK TO SKIP TO
@save_week_to_skip_to: ;
STX MENU_Y ; SET Y MENU CHOICE = WEEK TO SKIP TO
LDA #<AUTO_SKIP_MENU_NUM_WEEKS_MENY_OPT_ADDR ; SET MAX WEEK VALUE TO SKIP TO
STA MENU_OPTIONS_ADDR ;
LDA #>AUTO_SKIP_MENU_NUM_WEEKS_MENY_OPT_ADDR ;
STA MENU_OPTIONS_ADDR+1 ;
JMP @update_autoskip_week_displayed ; JUMP-> UPDATE DISPLAYED AUTOSKIP WEEK NUMBER
@autoskip_input_check: ; AUTOSKIP WEEK INPUT CHECK
RETURN_1_FRAME
JSR CHECK_MENU_ARROW_UP_DOWN ; CHECK FOR MOVE MENU ARROW UP DOWN()
LDA JOY_RAW_BOTH ; IS JOY RAW = UP OR DOWN?
AND #(UP_DPAD+DOWN_DPAD) ;
BNE @update_autoskip_week_displayed ; YES-> UPDATE DISPLAYED AUTOSKIP WEEK NUMBER
LDA FRAME_COUNTER ; SET FLASHING SPEED RATE = EVERY 4 FRAMES
AND #$04 ;
BEQ @clear_week_number_for_flashing ;
@update_autoskip_week_displayed: ; UPDATE DISPLAYED AUTOSKIP WEEK NUMBER
LDA MENU_Y ; LOAD WEEK TO SKIP TO
JSR HEX_TO_2_DIGIT_DEC ; CONVERT HEX NUMBER TO BCD(A= HEX)
LDY #<AUTOSKIP_WEEK_PPU_ADDR ; SET AUTOSKIP WEEK # PPU ADDR = $210D
LDX #>AUTOSKIP_WEEK_PPU_ADDR ;
JSR CONVERT_2_DIG_NUM_TILES_NO_LEADING_ZEROS ; SAVE 2 DIGIT NUMBER TO BUFFER(X,Y=PPU ADDR)
JMP @check_for_exit_autoskip ;
@clear_week_number_for_flashing: ; CLEAR WEEK NUMBER FOR FLASHING EFFECT
LDY #<AUTOSKIP_WEEK_PPU_ADDR ; SET AUTOSKIP WEEK # PPU ADDR = $210D
LDX #>AUTOSKIP_WEEK_PPU_ADDR ;
LDA #AUTOSKP_WEEK_NUM_ROWS ; SET ROWS = 1
STA rows ;
LDA #AUTOSKP_WEEK_NUM_TILES ; SET LENGTH = 2 tiles
STA length ;
JSR FILL_SCREEN_BLANK_TILE_AREA ; FILL PPU LOCATIONS WITH BLANK TILE(X,Y= ADDR, 3F= NUM ROWS, 3E= LENGTH)
@check_for_exit_autoskip:
BIT JOY_PRESS_BOTH ; DOES P1/P2 PRESS= B PRESSED
BVS @exit_autoskip ; YES-> EXIT AUTOSKIP MENU
BPL @autoskip_input_check ; A PRESSED? NO->AUTOSKIP WEEK INPUT CHECK
LDA #SCHEDULE_SELECT_SOUND ; LOAD MENU CHOICE SOUND
JSR PLAY_SOUND ; PLAY SOUND(A= SOUND)
MMC3_SRAM_WRITE_ENABLE
LDA MENU_Y ; SAVE WEEK IN WEEK TO SKIP TO
STA WEEK_TO_SKIP_TO ;
MMC3_SRAM_WRITE_DISABLE
LDA MENU_Y ;
JSR HEX_TO_2_DIGIT_DEC ; CONVERT HEX NUMBER TO BCD(A= HEX)
LDY #<AUTOSKIP_WEEK_PPU_ADDR ; SET AUTOSKIP WEEK # PPU ADDR = $210D
LDX #>AUTOSKIP_WEEK_PPU_ADDR ;
JSR CONVERT_2_DIG_NUM_TILES_NO_LEADING_ZEROS ; SAVE 2 DIGIT NUMBER TO BUFFER(X,Y=PPU ADDR)
RETURN_IN_NUM_FRAMES 30 ; 0.5 sec
@exit_autoskip: ; EXIT AUTOSKIP MENU
sram_addr = LOCAL_1
JSR SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_FIRST_OPTION ; SET MENU ARROW OFFSCREEN AND MENU INDEX = FIRST OPTION()
LDY #<AUTOSKIP_MENU_PPU_ADDR ; SET PPU ADDR = SCHEDULE MENU
LDX #>AUTOSKIP_MENU_PPU_ADDR ;
LDA #<AUTOSKIP_MENU_SRAM ; SET DATA ADDR= SCHEDULE MENU SRAM ADDR
STA sram_addr ;
LDA #>AUTOSKIP_MENU_SRAM ;
STA sram_addr+1 ;
JSR TRANSFER_TO_PPU_OR_PPUBUFF_WITH_COMMANDS ; TRANFER DATA TO PPU VIA BUFFER OR DIRECTLY DEPENDING ON FADE VALUES()
JMP INIT_SCHEDULE_MENU_OPTIONS ; LOAD SCHEDULE MENU OPTIONS
AUTO_SKIP_MENU_NUM_WEEKS_MENY_OPT_ADDR
.DB autoskip_choices ; max number of y options = 0 - 17 weeks. 0 = no skip
ppu_addr = LOCAL_1
sram_addr= LOCAL_3
RESET_SCHEDULE: ; RESET SCHEDULE
JSR SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_FIRST_OPTION ; SET MENU ARROW OFFSCREEN AND MENU INDEX = FIRST OPTION()
LDA #<RESET_SCHEDULE_PPU_ADDR ; SET PPU ADDR = $2143
STA ppu_addr ;
LDA #>RESET_SCHEDULE_PPU_ADDR ;
STA ppu_addr+1 ;
LDA #<RESET_SCHEDULE_MENU_SRAM ; SET SRAM DATA ADDR = $60A3
STA sram_addr ;
LDA #>RESET_SCHEDULE_MENU_SRAM ;
STA sram_addr+1 ;
LDX #RESET_SCHED_NUM_TILES ; SET LENGTH = 28 TILES
LDY #RESET_SCHED_NUM_ROWS ; SET ROWS = 11 TILES
JSR SAVE_PARTIAL_SCREEN_BG_IN_SRAM ; SAVE PPU DATA IN SRAM WHEN READY(3E,3F= PPU ADDRESS,40,41= SRAM ADDRESS, X,Y= DATA LENGTH )
DRAW_SCENE_UNTIL_ENDED[sceneId_sceneBank] FIRST_SCHEDULE_RESET_WARN_SCREEN_ID, MENU_DRAW_SCRIPT_BANK
INIT_RESET_SCHEDULE_MENU: ; LOAD RESET SCHEDULE MENU CHOICES
LDY #<SCHEDULE_RESET_MENU_OPTIONS_DATA ;
LDX #>SCHEDULE_RESET_MENU_OPTIONS_DATA ;
LDA #BOTH_JOYPADS ; SET JOYPAD INDEX= P1 AND P2
JSR SET_MENU_ARROW_OPTIONS ; SET MENU ARROW Y(X,Y = MENU DATA ADDRESS, A=JOYPAD)
@reset_schedule_input_check: ; RESET SCHEDULE WARNING INPUT CHECK
RETURN_1_FRAME
JSR CHECK_MENU_ARROW_UP_DOWN ; CHECK FOR MOVE MENU ARROW UP DOWN()
JSR UPDATE_MENU_ARROW_SPR_Y ; UPDATE MENU ARROW SPRITE Y LOCATION()
BIT JOY_PRESS_BOTH ; DOES P1/P2 PRESS= B PRESSED
BVC @check_a_pressed ; NO->
JMP EXIT_FROM_FIRST_RESET_RESTORE_SCREEN ; YES-> EXIT FROM RESET SEASON WARNING
@check_a_pressed: ;
BPL @reset_schedule_input_check ; A PRESSED? NO-> RESET SCHEDULE WARNING INPUT CHECK
LDA MENU_Y ; LOAD CHOICE
BNE FINAL_RESET_WARNING ;
JMP EXIT_FROM_FIRST_RESET_RESTORE_SCREEN ; NO SELECTED-> EXIT FROM RESET SEASON WARNING
ppu_addr = LOCAL_1
sram_addr = LOCAL_3
FINAL_RESET_WARNING: ; YES SELECTED ON RESET WARNING
JSR SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_FIRST_OPTION ; SET MENU ARROW OFFSCREEN AND MENU INDEX = FIRST OPTION()
; SAVE SCHEDULE COVERED BY MENU IN SRAM
LDA #<FINAL_RESET_PPU_ADDR ; SET PPU ADDR= $224D
STA ppu_addr ;
LDA #>FINAL_RESET_PPU_ADDR ;
STA ppu_addr+1 ; SET SRAM DATA ADDR= $6203
LDA #<FINAL_RESET_MENU_SRAM ;
STA sram_addr ;
LDA #>FINAL_RESET_MENU_SRAM ;
STA sram_addr+1 ;
LDX #FINAL_RESET_SCHED_NUM_TILES ; SET LENGTH = 28 TILES
LDY #FINAL_RESET_SCHED_NUM_ROWS ; SET ROWS = 11 TILES
JSR SAVE_PARTIAL_SCREEN_BG_IN_SRAM ; SAVE PPU DATA IN SRAM WHEN READY(3E,3F= PPU ADDRESS,40,41= SRAM ADDRESS, X,Y= DATA LENGTH )
; DRAW SCHEDULE RESET VERIFY MENU
LDA #FINAL_SCHEDULE_RESET_WARN_SCREEN_ID
LDX #MENU_DRAW_SCRIPT_BANK ; SET BANK = 16
JSR DRAW_SCENE_UNTIL_ENDED ; START DRAWING TASK AND DO UNTIL THREAD DESTROYED (A= CUTSCENE INDEX, X = BANK)
LDY #<SCHEDULE_RESET_VERIFY_MENU_OPTIONS_DATA
LDX #>SCHEDULE_RESET_VERIFY_MENU_OPTIONS_DATA
LDA #BOTH_JOYPADS ; SET JOYPAD INDEX= P1 AND P2
JSR SET_MENU_ARROW_OPTIONS ; SET MENU ARROW Y(X,Y = MENU DATA ADDRESS, A=JOYPAD)
@reset_warn_input_check: ; RESET SEASON CONFIRM INPUT CHECK
RETURN_1_FRAME
JSR CHECK_MENU_ARROW_UP_DOWN ; CHECK FOR MOVE MENU ARROW UP DOWN()
JSR UPDATE_MENU_ARROW_SPR_Y ; UPDATE MENU ARROW SPRITE Y LOCATION()
BIT JOY_PRESS_BOTH ; DOES P1/P2 PRESS= B PRESSED
BVS EXIT_FROM_FINAL_RESET_RESTORE_SCREEN ; YES-> EXIT FROM RESET SEASON CONFIRM
BPL @reset_warn_input_check: ; A PRESSED? NO-> RESET SEASON CONFIRM INPUT CHECK
LDA MENU_Y ; IS MENU ARROW ON NO?
BEQ EXIT_FROM_FINAL_RESET_RESTORE_SCREEN ; YES-> EXIT FROM RESET SEASON CONFIRM
JUMP_8000_BANK_AND_RETURN[bank_funcAddr] CLEAR_SEASON_STATS_BANK, BANK_JUMP_CLEAR_SEASON_INFO ; *** can use actual addr
JUMP_8000_BANK_AND_RETURN[bank_funcAddr] RESET_SCHEDULE_BANK, BANK_JUMP_RESET_SCHEDULE_RANDOMIZE_ORDER ; *** can use actual addr
JMP SEASON_SCHEDULE ; JUMP TO SEASON SCHEDULE
JUMP_TO_DRAW_PLAYOFF_BRACKET: ; PLAYOFF SCHEDULE SELECTED
JSR DRAW_PLAYOFF_BRACKET_RETURN_B_PRESS ; DRAW PLAYOFF BRACKET RETURN WHEN B PRESSED()
JMP DRAW_REGULAR_SEASON_SCHEDULE ; JUMP->REGULAR SEASON SCHEDULE
EXIT_FROM_FINAL_RESET_RESTORE_SCREEN: ; EXIT FROM RESET SEASON CONFIRM
JSR SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_FIRST_OPTION ; SET MENU ARROW OFFSCREEN AND MENU INDEX = FIRST OPTION()
JSR RESTORE_SCHEDULE_MENU_FINAL_RESET_SRAM ; RESTORE PART OF SCHEDULE THAT FINAL RESET MENU DREW OVER()
JMP INIT_RESET_SCHEDULE_MENU ; DRAW RESET SCHEDULE MENU CHOICES
EXIT_FROM_FIRST_RESET_RESTORE_SCREEN: ; EXIT FROM RESET SEASON WARNING
LDA #RESET_SCHEDULE_CHOICE ; SET MENU CHOICE = RESET
JSR SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_OPTION[option] ; SET MENU ARROW OFFSCREEN AND MENU INDEX(A= MENU INDEX)
JSR RESTORE_SCHEDULE_MENU_1ST_RESET_SRAM ; RESTORE PART OF SCHEDULE THAT 1ST RESET MENU DREW OVER()
JMP INIT_SCHEDULE_MENU_OPTIONS ; JUMP-> LOAD SCHEDULE MENU OPTIONS
RESTORE_SCHEDULE_SRAM: ; RESTORE SCHEDULE TILES AND REGULAR SEASON SCHEDULE UPDATE LOOP
sram_addr = LOCAL_1
LDA #SCHEDULE_CHOICE ; SET MENU OPTION = SEASON SCHEDULE
JSR SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_OPTION[option] ; SET MENU ARROW OFFSCREEN AND MENU INDEX(A= MENU INDEX)
; RELOAD SCHEDULE DATA FROM SRAM
LDY #<SCHEDULE_MENU_PPU_ADDR ; SET PPU ADDRESS = MENU LOCATION
LDX #>SCHEDULE_MENU_PPU_ADDR ;
LDA #<SCHEDULE_MENU_SRAM ; SET DATA ADDRESS = $6003 = SCHEDULE TILES WE DREW OVER
STA sram_addr ;
LDA #>SCHEDULE_MENU_SRAM ;
STA sram_addr +1 ;
JSR TRANSFER_TO_PPU_OR_PPUBUFF_WITH_COMMANDS ; TRANFER DATA TO PPU VIA BUFFER OR DIRECTLY (X,Y= PPU ADDRESS, 3E,3F = DATA ADDRESS)
JMP REGULAR_SEASON_SCHEDULE_INPUT_LOOP ; JUMP REGULAR SEASON SCHEDULE UPDATE LOOP
SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_FIRST_OPTION: ; SET MENU ARROW OFFSCREEN AND MENU INDEX = FIRST OPTION()
LDA #$00
SET_MENU_ARROW_OFFSCREEN_SET_CHOICE_TO_OPTION[option]: ; SET MENU ARROW OFFSCREEN AND MENU INDEX(A= MENU INDEX)
STA MENU_Y ; SAVE Y MENU CHOICE
LDA #SPRITE_OFFSCREEN ; SET MENU SPRITE Y = OFFSCREEN
STA MENU_ARROW_SPR_Y ;
RTS ; RETURN
RESTORE_SCHEDULE_MENU_1ST_RESET_SRAM: ; RESTORE PART OF SCHEDULE THAT 1ST RESET MENU DREW OVER
LDY #<RESET_SCHEDULE_PPU_ADDR ; SET PPU ADDRESS = 1ST RESET MENU LOCATION
LDX #>RESET_SCHEDULE_PPU_ADDR ;
LDA #<RESET_SCHEDULE_MENU_SRAM ; SET DATA ADDRESS = $60A3 = SCHEDULE TILES WE DREW OVER
STA sram_addr ;
LDA #>RESET_SCHEDULE_MENU_SRAM ;
STA sram_addr+1 ;
JSR TRANSFER_TO_PPU_OR_PPUBUFF_WITH_COMMANDS ; TRANFER DATA TO PPU VIA BUFFER OR DIRECTLY (X,Y= PPU ADDRESS, 3E,3F = DATA ADDRESS)
RTS ; RETURN
RESTORE_SCHEDULE_MENU_FINAL_RESET_SRAM: ; RESTORE PART OF SCHEDULE THAT FINAL RESET MENU DREW OVER
LDY #<FINAL_RESET_PPU_ADDR ; SET PPU ADDRESS = FINAL RESET MENU LOCATION
LDX #>FINAL_RESET_PPU_ADDR ;
LDA #<FINAL_RESET_MENU_SRAM ; SET DATA ADDRESS = $6203 = SCHEDULE TILES WE DREW OVER
STA sram_addr ;
LDA #>FINAL_RESET_MENU_SRAM ;
STA sram_addr+1 ;
JSR TRANSFER_TO_PPU_OR_PPUBUFF_WITH_COMMANDS ; TRANFER DATA TO PPU VIA BUFFER OR DIRECTLY DEPENDING ON FADE VALUES (X,Y= PPU ADDRESS, 3E,3F = DATA ADDRESS)
RTS ; RETURN
_F}_SEASON_SCHEDULE_SCREEN
_F{_SEASON_STANDINGS_SCREEN ; DONE
ppu_addr = LOCAL_1
sram_addr = LOCAL_3
SCROLL_UP_STANDINGS = $00
SCROLL_DOWN_STANDINGS = $01
AFC_STANDING_MENU_CHOICE = $00
NFC_STANDING_MENU_CHOICE = $01
PLAYOFF_STANDING_MENU_CHOICE = $02
SEASON_MENU_STANDINGS_CHOICE = $03
SEASON_STANDINGS_Y_SCROLL = $60
SEASON_STANDINGS: ; STANDINGS MENU OPTION
LDA #SPRITE_OFFSCREEN ; SET MENU SPRITE Y = OFFSCREEN
STA MENU_ARROW_SPR_Y ;
LDA #<SEASON_STANDINGS_PPU_ADDR ; SET PPU ADDRESS = $2400
STA ppu_addr ;
LDA #>SEASON_STANDINGS_PPU_ADDR ;
STA ppu_addr+1 ;
LDA #<SEASON_STANDINGS_MENU_SRAM ; SET SRAM ADDRESS = $6103
STA sram_addr ;
LDA #>SEASON_STANDINGS_MENU_SRAM ;
STA sram_addr+1 ;
LDX #LENGTH_OF_ONE_ROW ; SET LENGTH = 32 tiles
LDY #$0C ; SET ROWS = 12 rows
JSR SAVE_PARTIAL_SCREEN_BG_IN_SRAM ; SAVE PPU DATA IN SRAM WHEN READY(3E,3F= PPU ADDRESS,40,41= SRAM ADDRESS, X,Y= DATA LENGTH )
LDA #STANDINGS_MENU_SCREEN_ID ; SET DRAW EVENT = STANDINGS SCREEN
LDX #MENU_DRAW_SCRIPT_BANK ; SET BANK = 16
JSR DRAW_SCENE_UNTIL_ENDED ; START DRAWING TASK AND DO UNTIL THREAD DESTROYED (A= CUTSCENE INDEX, X = BANK)
LDA #SCROLL_DOWN_STANDINGS ; SET SCROLL DIRECTION = DOWN
JSR SCROLL_TO_FROM_STANDINGS[direction] ; SCROLL TO OR FROM STANDINGS( 0= SCROLL UP, 1 = SCROLL DOWN)
LDA #$00 ;
STA MENU_Y ; SET Y MENU OPTION = FIRST CHOICE
STA MENU_X ; SET X MENU OPTION = FIRST CHOICE
@season_standings_menu_init: ; STANDINGS MENU INPUT START
LDY #<STANDINGS_MENU_OPTIONS_DATA ; LOAD STANDINGS MENU INFO ADDR
LDX #>STANDINGS_MENU_OPTIONS_DATA ;
LDA #BOTH_JOYPADS ; SET PLAYER JOY = BOTH
JSR INIT_MENU_OPTIONS ; INITIALIZE MENU X,Y OPTIONS (X,Y= ADDRESS, A= PLAYER JOY)
@season_standings_input_check: ; STANDING MENU INPUT CHECK
RETURN_1_FRAME
JSR CHECK_INPUT_MENU ; CHECK FOR MOVE ARROW ON MENU X OR Y()
JSR SET_MENU_ARROW_X_Y ; SET MENU ARROW X AND Y LOCATION()
BIT JOY_PRESS_BOTH ; DOES P1/P2 PRESS= B PRESSED
BVC @check_draw_division_standings ; NO-> B NOT PRESSED STANDINGS MENU
JMP @exit_standings_scroll_up ;
@check_draw_division_standings: ; B NOT PRESSED STANDINGS MENU
BPL @season_standings_input_check ; A PRESSED? NO->STANDING MENU INPUT CHECK
@draw_division_standings: ; A PRESSED STANDINGS MENU
JSR END_ALL_DRAWING_TASKS_CLEAR_YSCROLL ; END TASKS 2,3,4,5, CLEAR Y SCROLL()
LDA MENU_Y ; SAVE Y MENU CHOICE
STA PREV_MENU_Y ;
LDA MENU_X ; SAVE X MENU CHOICE
STA PREV_MENU_X ;
LDA MENU_Y ; IS MENU CHOICE = PLAYOFFS
CMP #PLAYOFF_STANDING_MENU_CHOICE ;
BEQ @draw_playoff_bracket ; YES-> PLAYOFF STANDINGS
JSR DRAW_DIVISION_STANDINGS_MENU_CHOICE ; DRAW DIVISION STANDINGS($E1,$E2= MENU CHOICE)
@division_standings_input_check: ; STANDINGS INPUT CHECK
RETURN_1_FRAME
LDA JOY_PRESS_BOTH ; IS A OR B PRESSED?
AND #(A_BUTTON + B_BUTTON) ;
BEQ @division_standings_input_check ; NO-> STANDINGS INPUT CHECK
JMP @exit_from_division_to_standings_menu ; YES-> RETURN FROM PLAYOFF BRACKET OR STANDINGS TO SEASON MENU
@draw_playoff_bracket: ; PLAYOFF STANDINGS
JSR DRAW_PLAYOFF_BRACKET_RETURN_B_PRESS ; DRAW PLAYOFF BRACKET()
@exit_from_division_to_standings_menu: ;
LDA #$00 ; CLEAR X MENU OPTION
STA MENU_X ;
JSR REDRAW_SEASON_MENU_SCREEN ; REDRAW MAIN MENU AND SEASON MENU()
LDA #STANDINGS_MENU_SCREEN_ID ; SET DRAW SCREEN = STANDINGS MENU
LDX #MENU_DRAW_SCRIPT_BANK ; SET BANK = 16
JSR DRAW_SCENE_UNTIL_ENDED ; START DRAWING TASK AND DO UNTIL THREAD DESTROYED (A= CUTSCENE INDEX, X = BANK)
LDA #SEASON_STANDINGS_Y_SCROLL ; SET Y SCROLL = $0060
STA CURR_Y_SCROLL ;
LDA #$00 ;
STA CURR_Y_SCROLL+1 ;
LDA PREV_MENU_Y ; RESTORE Y MENU CHOICE
STA MENU_Y ;
LDA PREV_MENU_X ; RESTORE X MENU CHOICE
STA MENU_X ;
RETURN_1_FRAME
LDA #SEASON_MENU_BG_PAL_INDEX ; SET BACKGROUND PALLETE INDEX
LDX #SEASON_MENU_SPR_PAL_INDEX ; SET SPRITE PALLETE INDEX
JSR SET_BG_SPR_PAL_SET_FULLY_FADED_IN ; UPDATE PALLETES,SOFT PALLETE IDS AND SET PALLETE FADES TO FULLY FADED IN(A= BACKGROUND, X = SPRITE)
JMP @season_standings_menu_init ; JUMP-> STANDINGS MENU INPUT START
@exit_standings_scroll_up: ; EXIT FROM STANDINGS SCROLL UP TO SEASON MENU
sram_addr = LOCAL_1
LDA #SPRITE_OFFSCREEN ; SET MENU ARROW = OFFSCREEN
STA MENU_ARROW_SPR_Y ;
LDA #SCROLL_UP_STANDINGS ; SET SCROLL DIRECTION = UP
JSR SCROLL_TO_FROM_STANDINGS[direction] ; SCROLL TO OR FROM STANDINGS( 0= SCROLL UP, 1 = SCROLL DOWN)
JSR SET_MMC3_VERT_MIRROR ; SET MMC3 MIRRORING TO VERTICAL()
LDY #<SEASON_STANDINGS_PPU_ADDR ; SET PPU ADDR = $2400
LDX #>SEASON_STANDINGS_PPU_ADDR ;
LDA #<SEASON_STANDINGS_MENU_SRAM ; SET DATA ADDR = $6103
STA sram_addr ;
LDA #>SEASON_STANDINGS_MENU_SRAM ;
STA sram_addr+1 ;
JSR TRANSFER_TO_PPU_OR_PPUBUFF_WITH_COMMANDS ; TRANFER DATA TO PPU VIA BUFFER OR DIRECTLY DEPENDING ON FADE VALUES()
ppu_addr = LOCAL_1
LDY #<SEASON_STANDING_PPU_ATTR_ADDR ; SET PPU ADDR = $27C2
LDX #>SEASON_STANDING_PPU_ATTR_ADDR ;
LDA #<RETURN_FROM_STANDINGS_BG_ATRIB_DATA ;
STA ppu_addr ;
LDA #>RETURN_FROM_STANDINGS_BG_ATRIB_DATA ;
STA ppu_addr+1 ;
JSR TRANSFER_TO_PPU_OR_PPUBUFF_WITH_COMMANDS ; TRANFER DATA TO PPU VIA BUFFER OR DIRECTLY DEPENDING ON FADE VALUES()
LDA #SEASON_MENU_STANDINGS_CHOICE ; SET Y MENU OPTION = STANDINGS
STA MENU_Y ;
JMP SEASON_MENU_INIT ; SEASON MENU INPUT CHECK
RETURN_FROM_STANDINGS_BG_ATRIB_DATA: ; ATTRIBUTE TABLE DATA FOR RETURN FROM SEASON STANDINGS
.BYTE $08,$50,$50,$10,$00,$00
.BYTE $00,$00,$00
.BYTE $FF ; END OF DATA
_F}_SEASON_STANDINGS_SCREEN
_F{_SEASON_RANKINGS_SCREEN ; DONE
SEASON_MENU_RANKINGS_CHOICE = $04
ppu_addr = LOCAL_1
sram_addr = LOCAL_3
num_tiles = LOCAL_1
rows = LOCAL_2
TEAM_RANKINGS_SCREEN_START: ; TEAM RANKINGS
LDA #SPRITE_OFFSCREEN ; SET ARROW SPRITE Y LOCATION = OFFSCREEN
STA MENU_ARROW_SPR_Y ;
LDA #<TEAM_RANKINGS_PPU_ADDR ; SET PPU ADDRESS TO READ FROM TO $224D
STA ppu_addr ;
LDA #>TEAM_RANKINGS_PPU_ADDR ;
STA ppu_addr+1 ;
LDA #<TEAM_RANKINGS_MENU_SRAM ; SET SRAM ADDRESS TO WRITE TO TO $6103
STA sram_addr ;
LDA #>TEAM_RANKINGS_MENU_SRAM ;
STA sram_addr+1 ;
LDX #$11 ; SET LENGTH = 17 TILES
LDY #$0A ; SET ROWS = 10 ROWS
JSR SAVE_PARTIAL_SCREEN_BG_IN_SRAM ; SAVE PPU DATA IN SRAM WHEN READY(3E,3F= PPU ADDRESS,40,41= SRAM ADDRESS, X,Y= DATA LENGTH )
LDA #RANKINGS_MENU_SCREEN_ID_EXTRA ; LOAD TEAM RANKINGS DRAW EVENT INDEX
LDX #MENU_DRAW_SCRIPT_BANK ; LOAD BANK 16
JSR DRAW_SCENE_UNTIL_ENDED ; START DRAWING TASK AND DO UNTIL THREAD DESTROYED (A= DRAW EVENT INDEX, X = BANK)
LDA #$00 ;
STA MENU_Y ; SET Y MENU INDEX = FIRST OPTION
STA MENU_X ; SET X MENU INDEX = FIRST OPTION
@rankings_menu_initialization:
LDY #<RANKINGS_MENU_OPTIONS_DATA ;
LDX #>RANKINGS_MENU_OPTIONS_DATA ;
LDA #BOTH_JOYPADS ; SET JOY = BOTH
JSR INIT_MENU_OPTIONS ; INITIALIZE MENU X,Y OPTIONS (X,Y= ADDRESS, A= PLAYER JOY)
@rankings_menu_input_loop: ; RANKINGS INPUT LOOP
RETURN_1_FRAME
JSR CHECK_INPUT_MENU ; CHECK FOR MOVE ARROW ON MENU X OR Y()
JSR SET_MENU_ARROW_X_Y ; SET MENU ARROW X AND Y LOCATION()
BIT JOY_PRESS_BOTH ; DOES P1/P2 PRESS= B PRESSED
BVS @return_season_menu_from_standings ; YES->B PRESSED ON TEAM RANKINGS RETURN TO SEASON MENU
BPL @rankings_menu_input_loop ; A/B NOT PRESSED-> RANKINGS INPUT LOOP
@save_menu_choice:
LDA MENU_Y ; SAVE Y MENU CHOICE
STA PREV_MENU_Y ;
LDA MENU_X ; SAVE X MENU CHOICE
STA PREV_MENU_X ;
JSR DO_TEAM_RANKINGS ; DO TEAM RANKINGS()
JSR REDRAW_SEASON_MENU_SCREEN ; REDRAW MAIN MENU AND SEASON MENU()
LDA #RANKINGS_MENU_SCREEN_ID_EXTRA ; SET SCREEN ID = RANKINGS SCREEN