-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplit_second.asm
More file actions
2954 lines (2531 loc) · 50.9 KB
/
split_second.asm
File metadata and controls
2954 lines (2531 loc) · 50.9 KB
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
;ines headers
.inesprg 1 ; 1 x 16KB PRG code
.ineschr 1 ; 1 x 8 KB CHR data
.inesmap 0 ; 0=NROM, no bank swapping
.inesmir 1 ; 1 = VERT mirroring for HORIZ scrolling
.rsset $0000
meta_tiles_ptr .rs 2
meta_tile_ptr .rs 2
meta_tile_ppu_addr_coords_ptr .rs 2
meta_tile_ppu_addr_coord_ptr .rs 2
scores_ptr .rs 2
number_ptr .rs 2
seed .rs 2 ; CD
gamestate .rs 1
sleeping .rs 1 ;F
ppu_x_coord .rs 1 ;10
ppu_y_coord .rs 1
dbuffer_index .rs 1
textPointer1Lo .rs 1
textPointer1Hi .rs 1
buttons_this .rs 1 ;15
buttons_last .rs 1
buttons .rs 1
needDrawBuffer .rs 1
attributeLo .rs 1
attributeHi .rs 1
board_ptr .rs 2
box_ptr .rs 1 ;1D
score_1 .rs 1 ;1E
score_2 .rs 1 ;1F
score_3 .rs 1 ;20
hi_score_1 .rs 1 ;21
hi_score_2 .rs 1 ;22
hi_score_3 .rs 1 ;23
score_looper .rs 1
;timer_on .rs 1
game_4_wait .rs 1
timer .rs 2
difficulty_timer .rs 2
backgroundLo .rs 1
backgroundHi .rs 1
counterLo .rs 1
counterHi .rs 1
needDrawFullScreen .rs 1
needClearBoard .rs 1
needClearBoard2 .rs 1
PPUCTRL_2000_Buffer .rs 1 ;2E
PPUMASK_2001_Buffer .rs 1
ball_box .rs 1 ;30
ball_box_old .rs 1
current_game .rs 1
ram_board_ptr .rs 1
mad_maze_number .rs 1 ;37
needBoardRendering .rs 1
needBoardRendering2 .rs 1
needUpdateBall .rs 1
needEraseBall .rs 1
needUpdateShip .rs 1
needEraseShip .rs 1
clear_ball .rs 1
isMasking .rs 1
isFirstMasking .rs 1
isAutoMoving .rs 1
maskingTimer .rs 1
ship_box .rs 1
ship_box_old .rs 1
car_box .rs 1
car_box_old .rs 1
tempVar1 .rs 1
tempVar2 .rs 1
tempVar3 .rs 1
tempVar4 .rs 1
muteButtons .rs 1
difficulty .rs 1 ;48 in mem
move_trigger .rs 1 ;49 in mem
seed2 .rs 2
game_6_vars .rs 4 ;[ballBox1, ballBox2, lineWinner, lineStart]
game_6_vars_old .rs 4 ;[ballBox1, ballBox2, lineWinner, lineStart]
needUpdateCar .rs 1
needEraseCar .rs 1
car_position .rs 1
car_position_old .rs 1
car_direction .rs 1 ; 0-UP ; 1-RT ; 2-DN ; 3-LT
nametable_address_hi .rs 1
game_6_checked_ball_2 .rs 1
need_new_cones .rs 1 ;5D
need_remove_cones .rs 1
needEraseCones .rs 1
needDrawGame7 .rs 1
stomp_input .rs 1
stomp_target .rs 1
needPlaySound .rs 1
current_sound .rs 1
current_sound_length .rs 1
current_sound_address_lo .rs 2
current_sound_address_hi .rs 2
current_sound_pointer .rs 1
car_crash_timer .rs 2
isCrashing .rs 1
needDrawGame8 .rs 1
needEraseGame8 .rs 1
snake_current .rs 4
snake_winner .rs 4
snake_same_metatiles .rs 4
snake_metatiles .rs 4
snake_segment .rs 1
snake_buffer .rs 10 ;{$2006, $2006, $2007, $2007, #$FF} x2
game_8_ball_buttons .rs 1
isMissing .rs 1
nmis .rs 1
detecting_tv .rs 1
tv_region .rs 1
nmi_show_board_routine .rs 1
.rsset $0091
debug .rs 15
;;;;;;;;;;;;;;;
; NES is powererd on
;
.bank 0 ; NESASM arranges things into 8KB chunks, this is chunk 0
.org $8000 ; Tells the assembler where to start in this 8kb chunk
RESET:
SEI ; disable IRQs
CLD ; disable decimal mode, meant to make decimal arithmetic "easier"
LDX #$40
STX $4017 ; disable APU frame IRQ
LDX #$FF
TXS ; Set up stack
INX ; now X = 0
STX $2000 ; disable NMI
STX $2001 ; disable rendering
STX $4010 ; disable DMC IRQs
vblankwait1: ; First wait for vblank to make sure PPU is ready
BIT $2002
BPL vblankwait1
clrmem:
LDA #$00
STA $0000, x
STA $0100, x
STA $0300, x
STA $0400, x
STA $0500, x
STA $0600, x
STA $0700, x
LDA #$FE
STA $0200, x
INX
BNE clrmem
vblankwait2: ; Second wait for vblank, PPU is ready after this
BIT $2002
BPL vblankwait2
.include "initialize_palette.asm"
.include "initialize_attributes.asm"
.include "initialize_macros.asm"
; PPUCTRL ($2000)
; 76543210
; | ||||||
; | ||||++- Base nametable address
; | |||| (0 = $2000; 1 = $2400; 2 = $2800; 3 = $2C00)
; | |||+--- VRAM address increment per CPU read/write of PPUDATA
; | ||| (0: increment by 1, going across; 1: increment by 32, going down)
; | ||+---- Sprite pattern table address for 8x8 sprites (0: $0000; 1: $1000)
; | |+----- Background pattern table address (0: $0000; 1: $1000)
; | +------ Sprite size (0: 8x8; 1: 8x16)
; |
; +-------- Generate an NMI at the start of the
; vertical blanking interval vblank (0: off; 1: on)
LDA #%10000001 ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1
STA $2000
STA PPUCTRL_2000_Buffer
; PPUMASK ($2001)
; binary byte flags
; 76543210
; ||||||||
; |||||||+- Grayscale (0: normal color; 1: AND all palette entries
; ||||||| with 0x30, effectively producing a monochrome display;
; ||||||| note that colour emphasis STILL works when this is on!)
; ||||||+-- Disable background clipping in leftmost 8 pixels of screen
; |||||+--- Disable sprite clipping in leftmost 8 pixels of screen
; ||||+---- Enable background rendering
; |||+----- Enable sprite rendering
; ||+------ Intensify reds (and darken other colors)
; |+------- Intensify greens (and darken other colors)
; +-------- Intensify blues (and darken other colors)
;LDA #%00001110 ; enable sprites, enable background, no clipping on left side
;STA $2001
;STA PPUMASK_2001_Buffer
SOUND_00_GAME_01_WIN = $00
SOUND_01_INTRO_SOUND = $02
SOUND_03_GAME_01_MOVE = $04
SOUND_04_HIGH_SCORE = $06
SOUND_04_HIGH_SCORE_2 = $08
SOUND_05_LOWER_SCORE = $0A
SOUND_06_GAME_04_GUN_SOUND = $0C
SOUND_07_GAME_06_BLOOP_SOUND = $0E
SOUND_08_GAME_07_BAD_SOUND = $10
SOUND_09_GAME_07_GOOD_SOUND = $12
SOUND_10_GAME_08_BLEEP_SOUND = $14
SOUND_11_GAME_SELECT_SOUND = $16
SOUND_12_TIE_SCORE = $18
DIFFICULTY_HARD = $0C
DIFFICULTY_MEDIUM = $18
DIFFICULTY_EASY = $00
LDA #$00
STA gamestate
LDA #$0A
STA hi_score_1
LDA #%00001001
STA $4015
LDA #$01
STA score_1
LDA #%10011111 ;Duty 10, Length Counter Disabled, Saw Envelopes disabled, Volume F
STA $4000
JSR load_intro_background
;JSR loadIntroScreen1
JSR waitVBlank
JSR waitVBlank
JSR load_hand_held_background
JSR waitVBlank
JSR waitVBlank
LDA #%00101000
STA $2001
STA PPUMASK_2001_Buffer
JSR detect_tv_setting
STA tv_region ;$00 - NTSC || $01 - PAL || $02 - Dendry || $03 - Other
forever:
INC sleeping ;go to sleep (wait for NMI).
loop_forever:
CLC
LDA seed
ADC #$01
STA seed
LDA seed+1
ADC #$00
STA seed+1
LDA sleeping
BNE loop_forever ;wait for NMI to clear the sleeping flag and wake us up
JSR ReadController1
LDA gamestate
CMP #$00
BEQ .wait_start
CMP #$01
BEQ .setup_game_menu
CMP #$02
BEQ .game_menu
JMP pick_game_to_run
JMP forever
.wait_start:
JSR handle_input_wait_start
JMP forever
.setup_game_menu:
LDA PPUCTRL_2000_Buffer
EOR #%00010001
STA PPUCTRL_2000_Buffer
JSR sound_game_select
clear_board
LDA #$01
STA score_1
JSR load_level_selector_screen
INC gamestate
JMP forever
.game_menu:
JSR handle_input_wait_start
JMP forever
pick_game_to_run:
LDA current_game
ASL A
TAX
LDA gamestates+1, x
PHA
LDA gamestates, x
PHA
PHP ;this simulates getting a 16 bit address into mem for RTI
RTI ;this is not a normal RTI, no. This is a special RTI to jump to a table!
gamestates:
.word $0000,game_1,game_1,game_1,game_4,game_4,game_6,game_7,game_8
game_1:
LDA gamestate
CMP #$03
BEQ .initialize_game_1
CMP #$04
BEQ .load_boards_into_ram
CMP #$05
BEQ .copy_current_board_into_ram
CMP #$06
BEQ .display_current_board
CMP #$07
BEQ .play_game_1
CMP #$08
BEQ .game_1_winner
CMP #$09
BEQ .game_1_gameover
CMP #$0A
BEQ .game_1_score
CMP #$0B
BEQ .game_1_stop_wait_input
CMP #$0C
BEQ .game_1_reset_first_board
CMP #$0D
BEQ .check_play_game_1_win_sound
CMP #$FE
BEQ .check_game_1_boop_sound
JMP forever
.load_boards_into_ram:
JMP load_boards_into_ram
.copy_current_board_into_ram:
JMP copy_current_board_into_ram
.display_current_board:
JMP display_current_board
.play_game_1:
JMP play_game_1
.game_1_winner:
JMP game_1_winner
.game_1_gameover:
JMP game_1_gameover
.game_1_score:
JMP game_1_score
.game_1_stop_wait_input:
JMP game_1_stop_wait_input
.game_1_reset_first_board:
JMP game_1_reset_first_board
.check_play_game_1_win_sound:
JMP check_play_game_1_win_sound
.check_game_1_boop_sound:
JMP check_game_1_boop_sound
.initialize_game_1:
;initilize all RAM to $FF
LDX #$00
.init_loop:
LDA #$03
STA $200, x
INX
TXA
CMP #$F0
BNE .init_loop
JSR waitVBlank
LDA #$08
LDY #$3C
LDX #$00
.load_wall:
STA $203,x
INX
INX
INX
INX
DEY
BNE .load_wall
clear_board
LDA #$00
STA ram_board_ptr
STA mad_maze_number
LDA #$11
STA ball_box
LDA #$11
STA ball_box_old
JSR intro_sound
INC gamestate
JMP forever
load_boards_into_ram:
LDA ram_board_ptr
CMP #$F0
BEQ .done_loading
JSR game_1_load_board
INC mad_maze_number
JMP forever
.done_loading:
INC gamestate
LDA #$00
STA ram_board_ptr
reset_timer
STA mad_maze_number
JMP forever
copy_current_board_into_ram:
LDA ram_board_ptr
CLC
ADC #$18
STA ram_board_ptr
JSR load_tiles_into_ram
.finish_up:
INC gamestate
JMP forever
display_current_board:
update_screen
update_ball
JSR waitVBlank
LDA #$00
STA isMasking
STA maskingTimer
INC gamestate
JMP forever
play_game_1:
JSR check_gameover
BCS .game_over
.check_needs_masking:
LDA current_game
CMP #$02
BNE .keep_going
LDA isMasking
BEQ .keep_muting
JMP .muting_not_needed
.keep_muting:
mute_buttons
.muting_not_needed:
LDA maskingTimer
CMP #$20
BEQ .needs_masking
JMP .keep_going
.needs_masking:
LDA isMasking
BNE .keep_going
LDA #$01
STA isMasking
;JSR mask_tiles_in_ram
JSR mask_tiles_in_ram_new
JSR turn_off_ball
update_ball
unmute_buttons
JMP forever
.game_over:
INC gamestate
INC gamestate
JMP forever
.keep_going:
LDA ram_board_ptr
SEC
SBC #$18
STA ram_board_ptr
LDA #$02
STA board_ptr+1
LDA ram_board_ptr
STA board_ptr
LDA ball_box
CMP #$04
BMI .check_top
CMP #$10
BPL .check_bottom
JMP .finish_winner_check
.check_bottom:
LDY #$03
LDA board_ptr
CLC
ADC #$10
STA board_ptr
.loop_bottom:
LDA #$04
CMP [board_ptr], y
BNE .skip_next
INY
LDA #$00
CMP [board_ptr], y
BEQ .winner
LDA #$09
CMP [board_ptr], y
BEQ .winner
DEY
.skip_next:
DEY
BPL .loop_bottom
JMP .finish_winner_check
.check_top:
LDY #$03
LDA #$06
.loop_top:
CMP [board_ptr], y
BNE .skip_next2
JMP .winner
.skip_next2:
DEY
BPL .loop_top
JMP .finish_winner_check
.finish_winner_check:
LDA ram_board_ptr
CLC
ADC #$18
STA ram_board_ptr
;otherwise - if not a winner....
;need these checks to ensure that the ball doesn't switch too fast between screens.
LDA needBoardRendering
BNE .end
LDA needBoardRendering2
BNE .end
LDA needUpdateBall
BNE .end
LDA needEraseBall
BNE .end
JSR handle_input_game
JMP .end
.winner:
LDA ram_board_ptr
CLC
ADC #$18
STA ram_board_ptr
INC gamestate
JMP forever
.end:
JMP forever
game_1_winner:
LDA ball_box
STA ball_box_old
JSR turn_off_ball
;this fixes the timing between the ball landing in the basket
;and the time that the screen goes blank.
JSR waitVBlank
JSR waitVBlank
JSR waitVBlank
JSR waitVBlank
JSR waitVBlank
clear_board
INC mad_maze_number
.wait_until_sound_off:
LDA needPlaySound
BEQ .done_waiting
JSR waitVBlank
JMP .wait_until_sound_off
.done_waiting:
LDA #SOUND_00_GAME_01_WIN
STA current_sound
LDA #$01
STA needPlaySound
LDA #$0D
STA gamestate
JMP forever
winner_for_real:
LDA #$00
STA score_1
STA score_2
STA score_3
LDA tv_region
BNE .go_pal_loops
JMP .ntsc_loops
.go_pal_loops:
JMP .pal_loops
.ntsc_loops:
LDA timer+1
CMP #$17
BMI .tens_loop
LDA #$09
STA score_1
STA score_2
STA score_3
JMP .end_win_forever
.tens_loop:
LDA timer+1
CMP #$03
BPL .add_to_score1
CMP #$02
BMI .ones_loop
LDA timer
SEC
SBC #$4D
BCS .add_to_score1
JMP .ones_loop
.add_to_score1:
INC score_1
LDA timer
SEC
SBC #$4D
STA timer
LDA timer+1
SBC #$02
STA timer+1
JMP .tens_loop
.ones_loop:
LDA timer+1
CMP #$01
BPL .add_to_score2
LDA timer
SEC
SBC #$3B
BCS .add_to_score2
JMP .tenths_loop
.add_to_score2:
INC score_2
LDA timer
SEC
SBC #$3B
STA timer
LDA timer+1
SBC #$00
STA timer+1
JMP .ones_loop
.tenths_loop:
LDA timer
SEC
SBC #$06
BCS .add_to_score3
JMP .end_win_forever
.add_to_score3:
INC score_3
LDA timer
SEC
SBC #$06
STA timer
JMP .tenths_loop
JMP .end_win_forever
; end ntsc loops
.pal_loops:
LDA timer+1
CMP #$14
BMI .pal_tens_loop
LDA #$09
STA score_1
STA score_2
STA score_3
JMP .end_win_forever
.pal_tens_loop:
LDA timer+1
CMP #$02
BPL .pal_add_to_score1
CMP #$01
BMI .pal_ones_loop
LDA timer
SEC
SBC #$F4
BCS .pal_add_to_score1
JMP .pal_ones_loop
.pal_add_to_score1:
INC score_1
LDA timer
SEC
SBC #$F4
STA timer
LDA timer+1
SBC #$01
STA timer+1
JMP .pal_tens_loop
.pal_ones_loop:
LDA timer+1
CMP #$01
BPL .pal_add_to_score2
LDA timer
SEC
SBC #$32
BCS .pal_add_to_score2
JMP .pal_tenths_loop
.pal_add_to_score2:
INC score_2
LDA timer
SEC
SBC #$32
STA timer
LDA timer+1
SBC #$00
STA timer+1
JMP .pal_ones_loop
.pal_tenths_loop:
LDA timer
SEC
SBC #$05
BCS .pal_add_to_score3
JMP .end_win_forever
.pal_add_to_score3:
INC score_3
LDA timer
SEC
SBC #$05
STA timer
JMP .pal_tenths_loop
.end_win_forever:
JSR wait_until_sound_off
JSR play_winner_or_loser_music
INC gamestate
INC gamestate ;skip the gameover state at go to score.
JMP forever
game_1_gameover:
LDA ball_box
STA ball_box_old
JSR turn_off_ball
LDA #$09
STA score_1
STA score_2
STA score_3
INC gamestate
JMP forever
game_1_score:
clear_board
JSR waitVBlank
JSR load_score_screen
INC gamestate
JMP forever
game_1_stop_wait_input:
LDA current_game
STA score_1
JSR handle_input_wait_start
JMP forever
game_1_reset_first_board:
LDA #$00
STA ram_board_ptr
STA mad_maze_number
STA isMasking
STA maskingTimer
LDA #$11
STA ball_box
STA ball_box_old
LDA #$05
STA gamestate
reset_timer
clear_board
JSR intro_sound
JMP forever
check_play_game_1_win_sound:
LDA needPlaySound
BNE .end
LDA mad_maze_number
CMP #$0A
BEQ .winner_for_real
LDA #$05
STA gamestate
.end:
JMP forever
.winner_for_real:
LDA #$08
STA gamestate
JMP winner_for_real
check_game_1_boop_sound:
LDA needPlaySound
BNE .end
LDA #$07
STA gamestate
.end:
JMP forever
; ++++++++++++ START NMI +++++++++++++
NMI:
pha ;save registers
txa
pha
tya
pha
LDA detecting_tv
BEQ .skip_nmi_inc
INC nmis
JMP endNMI
.skip_nmi_inc
INC maskingTimer
INC timer
BNE .continue_difficulty
INC timer+1
.continue_difficulty
INC difficulty_timer
BNE run_sound
INC difficulty_timer+1
run_sound:
LDA needPlaySound
CMP #$01
BEQ .playSound
JMP show_board
.playSound:
JSR playSound
show_board:
LDA gamestate
BEQ continue_nmi
LDA needClearBoard
BEQ continue_nmi
LDA #$01
STA nmi_show_board_routine
LDA #$01
BIT timer
BEQ .show_top
JMP .show_bottom
.show_top:
LDA #$01
STA needClearBoard
JMP continue_nmi
.show_bottom:
LDA #$01
STA needClearBoard2
;JMP continue_nmi
continue_nmi:
LDA needClearBoard
CMP #$01
BEQ .drawClearBoard
LDA needClearBoard2
CMP #$01
BEQ .drawClearBoard2
LDA needDrawFullScreen
CMP #$01
BEQ .drawFullScreen
LDA needBoardRendering
CMP #$01
BEQ .drawBoardRendering
LDA needBoardRendering2
CMP #$01
BEQ .drawBoardRendering2
LDA needEraseBall
CMP #$01
BEQ .eraseBallUpdate
LDA needEraseShip
CMP #$01
BEQ .eraseShipUpdate
LDA needUpdateBall
CMP #$01
BEQ .drawBallUpdate
LDA needUpdateShip
CMP #$01
BEQ .drawShipUpdate
LDA needUpdateCar
CMP #$01
BEQ .carUpdate
LDA needDrawBuffer
CMP #$01
BEQ .drawBuffer
LDA needEraseCones
CMP #$01
BEQ .erase_cones
LDA needDrawGame7
CMP #$01
BEQ .need_draw_game_7
LDA needDrawGame8
CMP #$01
BEQ .need_draw_game_8
LDA needEraseGame8
CMP #$01
BEQ .need_erase_game_8
JMP endNMI
.drawClearBoard:
JMP drawClearBoard_2
.drawClearBoard2:
JMP drawClearBoard2_2
.drawFullScreen:
JMP drawFullScreen
.drawBoardRendering:
JMP drawBoardRendering
.drawBoardRendering2:
JMP drawBoardRendering2_2
.drawBallUpdate:
JMP drawBallUpdate2
.eraseBallUpdate:
JMP eraseBallUpdate2
.eraseShipUpdate:
JMP eraseShipUpdate2
.drawShipUpdate:
JMP drawShipUpdate
.carUpdate:
JMP carUpdate
.drawBuffer:
JMP drawBuffer
.erase_cones:
JMP need_erase_cones
.need_draw_game_7:
JMP need_draw_game_7
.need_draw_game_8:
JMP need_draw_game_8
.need_erase_game_8:
JMP need_erase_game_8
drawClearBoard_2:
LDA #$21
STA ppu_y_coord
LDA #$14
STA ppu_x_coord
JSR drawClearBoard
LDA #$00
STA needClearBoard
LDA #$01
STA needClearBoard2
JMP endNMI
drawClearBoard2_2:
LDA #$21
STA ppu_y_coord
LDA #$D4
STA ppu_x_coord
JSR drawClearBoard
LDA #$00
STA needClearBoard2
JMP endNMI
drawFullScreen:
JSR drawFullBackground
LDA #$00
STA needDrawFullScreen
JMP continue_nmi
drawBoardRendering:
JSR drawBoardRendering1
LDA #$01
STA needBoardRendering2
LDA #$00
STA needBoardRendering
JMP endNMI ; so that I don't render 2 as well