-
Notifications
You must be signed in to change notification settings - Fork 1
/
GridRunner_Kick.asm
2736 lines (2705 loc) · 70.8 KB
/
GridRunner_Kick.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
*= $8000
#import "Constants.asm"
#import "C64Constants.asm"
CopyCharSet:
ldx #$00
//------------------------------
//L_BRS_8002_800F
//------------------------------
!CharacterCopyLooper:
lda CharSetSource,x // Copy Char Set to New Location
sta CharSetTarget,x // Store in Bank 0
lda CharSetSource + $0100,x
sta CharSetTarget + $0100,x
dex
bne !CharacterCopyLooper- //L_BRS_8002_800F
jmp SetupVICChip // L_jmp_821B_8011
nop
//------------------------------
//L_jmp_8015_806A:
//------------------------------
HiScoreLooper:
inx
cpx #$07
bne ScoreBoardTestLoop // L_BRS_8062_8018
jmp DisplayByJeffMinter // L_jmp_8D8E_801A
nop
nop
nop
//------------------------------
// L_jsr_8020_868D:
//------------------------------
CheckForShipImpact:
jsr GetCharacterFromScreenLocation // L_jsr_818B_8020
cmp #SHIPCharacter
beq !PlayerDetected+ // L_BRS_8028_8025
rts
//------------------------------
// L_BRS_8028_8025:
//------------------------------
!PlayerDetected:
jmp ResetTheStack // L_jmp_8ADE_8028
nop
nop
nop
nop
nop
//------------------------------
// L_jmp_8030_805C:
//------------------------------
CheckRowIsStillOnGrid:
and #$1F
cmp #SCREEN_MAX_ROWS
bpl !ExplosionOffGrid+ // L_BRS_803A_8034
//------------------------------
// L_jmp_8036_803C:
//------------------------------
!ExplosionStillWithinBounds:
sta ShipRowExplosionArr,x
rts
//------------------------------
// L_BRS_803A_8034:
//------------------------------
!ExplosionOffGrid:
lda ShipRow
jmp !ExplosionStillWithinBounds- // L_jmp_8036_803C
nop
//------------------------------
// L_jsr_8040_8B7F:
//------------------------------
CalculatingExplosionCol:
dec ShipColExplosionArr,x
lda ShipColExplosionArr,x
and #$3F
cmp #SCREEN_ROW_LENGTH - 1
bpl !ResetToShipCol+ // L_BRS_8050_804A
sta ShipColExplosionArr,x
rts
//------------------------------
// L_BRS_8050_804A:
//------------------------------
!ResetToShipCol:
lda ShipColumn
sta ShipColExplosionArr,x
rts
//------------------------------
//L_jsr_8056_8B91:
//------------------------------
CalculatingExplosionRow:
dec ShipRowExplosionArr,x
lda ShipRowExplosionArr,x
jmp CheckRowIsStillOnGrid // L_jmp_8030_805C
nop
//------------------------------
// L_jmp_8060_8C2A:
//------------------------------
HiScoreTest:
ldx #$00
//------------------------------
// L_BRS_8062_8018:
//------------------------------
ScoreBoardTestLoop:
lda ScoreBoard + 1,x
cmp HiScoreBoard + 1 ,x
bne !HiScoreNotTheSame+ // L_BRS_8070_8068
jmp HiScoreLooper // L_jmp_8015_806A
//------------------------------
// L_BRS_806D_8070:
//------------------------------
!NotAHiScore:
jmp DisplayByJeffMinter // L_jmp_8D8E_806D
//------------------------------
// L_BRS_8070_8068:
//------------------------------
!HiScoreNotTheSame:
bmi !NotAHiScore- // L_BRS_806D_8070
//------------------------------
// L_BRS_8072_807B:
//------------------------------
!CopyScoreToHiScoreLoop:
lda ScoreBoard + 1,x
sta HiScoreBoard + 1,x
inx
cpx #$07
bne !CopyScoreToHiScoreLoop- // L_BRS_8072_807B
jmp DisplayByJeffMinter // L_jmp_8D8E_807D
//*=$8080
CopyRightandFire:
.byte $3C,$3D,$20,$3E,$3E,$28,$2D,$28,$2F,$30,$2A,$3A,$20,$2E,$22,$27
//*=$8090
.byte $2F,$2F,$20,$2A,$24,$22,$27,$20,$3A,$30,$20,$29,$27,$21,$24,$26
//------------------------------
// L_jsr_80A0_8DC0:
//------------------------------
DisplayLevelNumber:
lda CurrentLevelNumber
cmp #MAX_NUMBER_OF_LEVELS // Max 20 Levels
bne !NotHitMaxLevels+
lda #$01
sta CurrentLevelNumber // Level Number
//L_BRS_80AA_80A4:
!NotHitMaxLevels:
lda #$30
sta CurrentLevelDigit2
sta CurrentLevelDigit1
ldx CurrentLevelNumber
//------------------------------
// L_BRS_80B4_80C7:
//------------------------------
IncreaseCurrentDisplayLevel:
inc CurrentLevelDigit1
lda CurrentLevelDigit1
cmp #$3A
bne !ByPass+ // L_BRS_80C6_80BC
lda #$30
sta CurrentLevelDigit1
inc CurrentLevelDigit2
//------------------------------
// L_BRS_80C6_80BC:
//------------------------------
!ByPass:
dex
bne IncreaseCurrentDisplayLevel // L_BRS_80B4_80C7
ldx #$30
//------------------------------
//L_BRS_80CB_80CF:
//------------------------------
!DelayLooper:
jsr TwoStage256Delay // L_jsr_8386_80CB
dex
bne !DelayLooper- // L_BRS_80CB_80CF
rts
//------------------------------
//L_jmp_80D2_8DAD:
//------------------------------
DisplayCopyRight:
ldx #$20
//------------------------------
//L_BRS_80D4_80E0:
//------------------------------
!CharacterLooper:
lda CopyRightandFire,x // Copyright Lamasoft
sta CopyRightScreenLoc,x// Press Fire To start
lda #$07
sta CopyRightColourLoc,x// Yellow
dex
bne !CharacterLooper- // L_BRS_80D4_80E0
jmp LevelSelection // L_jmp_8DC0_80E2
//------------------------------
// L_jmp_80E5_8DC8:
//------------------------------
BeginGame:
lda #$34
sta NoOfLives
ldx #$07
lda #$30
//------------------------------
// L_BRS_80EE_80F2:
//------------------------------
!ClearNextScoreDigit:
sta ScoreBoard,x
dex
bne !ClearNextScoreDigit- //L_BRS_80EE_80F2
jmp DisplayBattleStations // L_jmp_8C2D_80F4
nop
nop
nop
nop
nop
nop
nop
nop
nop
//------------------------------
// L_jmp_8100_822D:
//------------------------------
SetUpSIDChip:
// lda #$00 // Black
// sta $D021 // Set Border
// sta EXTCOL // Set Background
// lda #$16 // Video Bank $0400 : Character Bank $1800
// sta VMCSB // Set Up Video and Character Bank
lda #>VIC_SP0X
sta ScreenRow
lda #$00
sta ScreenColumn
ldy #$18
tya
sta ($02),y // store $18 in VMCSB
ldy #$20
lda #$00
sta ($02),y // Store $00 in EXTCOL
iny
sta ($02),y // Store $00 in $D021
lda #$0A
sta SID_FREHI1 // Set Hi Freq Voice 1
sta SID_ATDCY1 // Set Att/dec Voice 1
sta SID_ATDCY2 // Set Att/dec Voice 2
lda #$00
sta SID_SUREL1 // Voice 1 Sus/Rel
sta SID_SUREL2 // Voice 2 Sus/Rel
lda #$05
sta SID_FREHI2 // Set Hi Freq Voice 2
ldx #$00
lda #$00
sta ScreenColumn
lda #$04
sta ScreenRow
//------------------------------
//L_BRS_8138_815D:
//------------------------------
// Clear Screen Routine
ClearScreen:
lda ScreenColumn
sta ScreenRowLoByte,x // Lo Byte Screen Row Table
lda ScreenRow
sta ScreenRowHiByte,x // Hi Byte Screen Row Table
// Clear the screen
ldy #$00
lda #$20
//------------------------------
//L_BRS_8146_814B
//------------------------------
!RowCharLooper:
sta ($02),y // Set Top Row to Space
iny
cpy #SCREEN_ROW_LENGTH // Loop back Round
bne !RowCharLooper- //L_BRS_8146_814B
lda ScreenColumn
clc
adc #SCREEN_ROW_LENGTH // Add 40 for next Row
sta ScreenColumn
lda ScreenRow
adc #$00
sta ScreenRow
inx
cpx #SCREEN_MAX_ROWS
bne ClearScreen //L_BRS_8138_815D
jmp L_jmp_8818_815F
rts
//------------------------------
// L_jsr_8163_8172:
// L_jsr_8163_818B:
//------------------------------
GetCurrentScreenLineAddress:
ldx ScreenRow // Get Row
ldy ScreenColumn
lda ScreenRowLoByte,x // Row Lo Byte
sta ScreenLocationLo
lda ScreenRowHiByte,x // Row Hi Byte
sta ScreenLocationHi
rts
//------------------------------
// L_jsr_8172_81C4:
// L_jsr_8172_81F9:
// L_jsr_8172_827D:
// L_jsr_8172_8287:
// L_jsr_8172_8291:
// L_jsr_8172_8298:
// L_jsr_8172_82A1:
// L_jsr_8172_82C4:
// L_jsr_8172_82CE:
// L_jsr_8172_82D8:
// L_jsr_8172_82DF:
// L_jsr_8172_8400:
// L_jsr_8172_842A:
// L_jsr_8172_8492:
// L_jmp_8172_84F5:
// L_jsr_8172_8540:
// L_jmp_8172_8570:
// L_jsr_8172_85B6:
// L_jsr_8172_85D1:
// L_jmp_8172_85FA:
// L_jsr_8172_85FD:
// L_jsr_8172_8662:
// L_jsr_8172_8684:
// L_jmp_8172_869F:
// L_jsr_8172_86B2:
// L_jmp_8172_86CD:
// L_jsr_8172_87F8:
// L_jmp_8172_8803:
// L_jsr_8172_8921:
// L_jsr_8172_897C:
// L_jmp_8172_899C:
// L_jmp_8172_8A77:
// L_jmp_8172_8ADB:
// L_jsr_8172_8B50:
// L_jsr_8172_8BAB:
// L_jsr_8172_8D88:
//------------------------------
SetCharAndColourAtXY:
// Store Character and Colour
jsr GetCurrentScreenLineAddress // L_jsr_8163_8172 // Get Current Line Address
lda ScreenCharacter
sta (ScreenLocationLo),y
lda ScreenLocationHi
clc
adc #COLOUR_OFFSET_HI // Adds Colour Ram Offset
sta ScreenLocationHi
//------------------------------------------
// Why
lda ScreenLocationHi
lda ScreenLocationHi
sta ScreenLocationHi
// End Why
//------------------------------------------
lda ScreenCharColour
sta (ScreenLocationLo),y
rts
//------------------------------
// L_jsr_818B_8020:
// L_jsr_818B_8480:
// L_jsr_818B_84DD:
// L_jsr_818B_852A:
// L_jsr_818B_8560:
// L_jsr_818B_8675:
// L_jsr_818B_8937:
// L_jsr_818B_8AD4:
// L_jsr_818B_8B49:
// L_jmp_818B_8BBD:
//------------------------------
GetCharacterFromScreenLocation:
jsr GetCurrentScreenLineAddress // L_jsr_8163_818B
lda (ScreenLocationLo),y
rts
//------------------------------
// L_jsr_8191_0A02:
// L_jsr_8191_0A37:
// L_jsr_8191_81C7:
// L_jsr_8191_81FC:
//------------------------------
SetNoiseForVoc1Voc2:
lda #$00
sta SID_VCREG1 // Turn Voice 1 off
sta SID_VCREG2 // Turn Voice Two Off
lda #$81
sta SID_VCREG1 // Configure Voice 1 and 2
sta SID_VCREG2 // Enabled, Noise
rts
//------------------------------
// L_jsr_81A2_8314:
//------------------------------
ScrnGridBuilding:
lda #$02 // Column Number
sta $08
lda #GRIDColour // Character Colour
sta ScreenCharColour
lda #GRIDVerticalBar // Character For Screen
sta ScreenCharacter
//------------------------------
// L_BRS_81AE_81E3:
//------------------------------
!OuterColumnLoop:
lda #$00
sta SID_VCREG3
lda #$00 // Turn Voice 3 off
sta SID_VCREG3
lda #$02 // Row Number
sta $09
//------------------------------
// L_BRS_81BC_81D0:
//------------------------------
!ColumnLineDrawingLoop:
lda $09
sta ScreenRow // Copy Column
lda $08
sta ScreenColumn // Copy Row
jsr SetCharAndColourAtXY // L_jsr_8172_81C4
jsr SetNoiseForVoc1Voc2
inc $09
lda $09
cmp #MATRIX_BOTTOM_ROW + 1
bne !ColumnLineDrawingLoop- // L_BRS_81BC_81D0
ldx #$01
//------------------------------
// L_BRS_81D4_81DB:
//------------------------------
!DumpSFXLooper:
jsr IReleventDumpSFXJmp // L_jsr_8230_81D4
dey
bne L_BRS_81DA_81D8 // OSK : Potential Bug
//------------------------------
L_BRS_81DA_81D8:
//------------------------------
dex
bne !DumpSFXLooper- // L_BRS_81D4_81DB
inc $08
lda $08
cmp #$27
bne !OuterColumnLoop- // L_BRS_81AE_81E3
lda #$02
sta $08
lda #GRIDCharacter
sta ScreenCharacter
//------------------------------
// L_BRS_81ED_8218:
//------------------------------
!OuterRowLoop:
lda #$01
sta $09
//------------------------------
// L_BRS_81F1_8205:
//------------------------------
!RowLineDrawingLoop:
lda $09
sta ScreenColumn
lda $08
sta ScreenRow
jsr SetCharAndColourAtXY // L_jsr_8172_81F9
// Why
jsr SetNoiseForVoc1Voc2
inc $09
lda $09
cmp #MATRIX_LAST_COL + 1
bne !RowLineDrawingLoop- // L_BRS_81F1_8205
// jsr SetNoiseForVoc1Voc2 // --> OSK Addition
ldx #$01
//------------------------------
//L_BRS_8209_8210:
//------------------------------
!DumpSFXLooper:
jsr IReleventDumpSFXJmp // L_jsr_8230_8209
// jsr DumpSFX // --> OSK Addition
dey
bne L_BRS_820F_820D // Potential Bug : OSK
//------------------------------
L_BRS_820F_820D:
//------------------------------
dex
bne !DumpSFXLooper- // L_BRS_8209_8210
inc $08
lda $08
cmp #MATRIX_BOTTOM_ROW + 1
bne !OuterRowLoop- // L_BRS_81ED_8218
rts
//------------------------------
// L_jmp_821B_8011:
//------------------------------
SetupVICChip:
lda #$34
sta $0314 // alter IRQ to not Do RunStop Test ($EA34)
lda #$00 // Black
sta VIC_BGCOL0 // Set Border
sta VIC_EXTCOL // Set Background
lda #%00010110 // $16 = Video Bank $0400 : Character Bank $1800
sta VIC_VMCSB // Set Up Video and Character Bank
jmp SetUpSIDChip // L_jmp_8100_822D
//------------------------------
// L_jsr_8230_81D4:
// L_jsr_8230_8209:
IReleventDumpSFXJmp:
//------------------------------
//------------------------------------------
// Why ?
jmp DumpSFX // L_jmp_8233_8230
//------------------------------------------
//------------------------------
// L_jmp_8233_8230:
DumpSFX:
//------------------------------
lda #$04
sta $0A
//------------------------------
// L_jmp_8237_824C:
DumpSFXSpecial:
//------------------------------
inc $0A
lda $0A
cmp #$04
bne !PerformDumpSFX+ // L_BRS_8240_823D
rts
//------------------------------
// L_BRS_8240_823D:
//------------------------------
!PerformDumpSFX:
lda $08
sta SID_FREHI1
lda $08
adc #$01
sta SID_FREHI2
jmp DumpSFXSpecial // L_jmp_8237_824C
//------------------------------
// L_jsr_824F_8317:
//------------------------------
ShipMaterialisation:
lda #$0F
sta $0A
lda #$02
sta SID_FREHI2
lda #$00
sta SID_VCREG1
sta SID_VCREG2
lda #EXPLOSION_ANI_START
sta ScreenCharacter
//------------------------------
// L_jmp_8264_8417:
//------------------------------
MaterialiseShip:
lda #PLAYERColour
sta ScreenCharColour
lda #$00
sta SID_VCREG2
lda #$81
sta SID_VCREG2
// Lower Left Meterialisation Org
lda #MATRIX_ROW_SIZE
sta ScreenRow
lda #$14
clc
sbc $0A
sta ScreenColumn // Lower Left Corner
jsr SetCharAndColourAtXY // L_jsr_8172_827D
// Lower Right Meterialisation Org
lda #$14
clc
adc $0A
sta ScreenColumn // Lower Right Corner
jsr SetCharAndColourAtXY // L_jsr_8172_8287
// Upper Left Meterialisation Org
lda ScreenRow
clc
sbc $0A
sta ScreenRow // Upper Right Corner
jsr SetCharAndColourAtXY // L_jsr_8172_8291
lda #$14
sta ScreenColumn // Upper Central
jsr SetCharAndColourAtXY // L_jsr_8172_8298
lda #$14
sbc $0A
sta ScreenColumn // Upper Left Corner
jsr SetCharAndColourAtXY // L_jsr_8172_82A1
inc ScreenCharacter
lda ScreenCharacter // Loop Tru Chars $16 -> $19
cmp #EXPLOSION_ANI_END
bne !ResetMaterialisationChar+ // L_BRS_82AE_82AA
lda #EXPLOSION_ANI_START
//------------------------------
// L_BRS_82AE_82AA:
//------------------------------
!ResetMaterialisationChar:
sta $09
ldx $0A
//------------------------------
// L_BRS_82B2_82B6:
//------------------------------
!SoundDelayLoop:
jsr DelayRoutine // L_jsr_8380_82B2
dex
bne !SoundDelayLoop- // L_BRS_82B2_82B6
// Reset Characters back To Grid Character
lda #GRIDCharacter
sta ScreenCharacter
lda #GRIDColour
sta ScreenCharColour
lda #$14
sta ScreenColumn
jsr SetCharAndColourAtXY // L_jsr_8172_82C4
lda #$14
clc
sbc $0A
sta ScreenColumn
jsr SetCharAndColourAtXY // L_jsr_8172_82CE
lda #$14
clc
adc $0A
sta ScreenColumn
jsr SetCharAndColourAtXY // L_jsr_8172_82D8
lda #MATRIX_ROW_SIZE
sta ScreenRow
jsr SetCharAndColourAtXY // L_jsr_8172_82DF
lda #$14
clc
sbc $0A
sta ScreenColumn
jmp ShipMaterialisationLoop // L_jmp_8400_82E9
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
//------------------------------
// L_jmp_8300_8D4F:
//------------------------------
GameActivation:
lda #$0F
sta SID_SIGVOL
lda #$A0
sta SID_FREHI3
lda #$04
sta SID_ATDCY3
lda #$00
sta SID_SUREL3
jsr ScrnGridBuilding // L_jsr_81A2_8314
jsr ShipMaterialisation // L_jsr_824F_8317
lda #(SCREEN_ROW_LENGTH / 2)
sta ShipColumn
lda #MATRIX_BOTTOM_ROW
sta ShipRow
lda #$FF
sta BulletRow
lda #$01
sta HorizontalShipColumn
lda #$02
sta VerticalShipRow
lda #$04
sta OuterGridShipTimer
lda #$0A
sta OutShipFiringTimer
sta SID_ATDCY3
sta LaserActiveFlag
jsr ClearBombArray // L_jsr_8748_833B
lda #$00
sta PODSfxTimer
sta PODSfxLoopCounter
sta NoOfActiveSnakes
lda #SNAKE_ANI_START
sta SnakeHeadCharacter
lda #$20
sta SnakeTimer
lda LevelSnakeLength
sta LevelSnakeLength
sta LevelSnakeLength //// Why ?
lda NoOfSnakesForLevel
sta NoOfSnakesForLevel
lda #$00
sta NumberofSnakeChars
lda #$0F
sta SID_SIGVOL
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
jmp MainGameLoop // L_jmp_83A0_8370
//------------------------------
// L_jsr_8373_8475:
//------------------------------
JoystickCapture:
//lda $DC11
lda CIAPRB + $10
eor #$FF
sta JoystickInput
rts
//------------------------------
nop
nop
nop
nop
nop
//------------------------------
// L_jsr_8380_82B2:
// L_jsr_8380_8465:
//------------------------------
DelayRoutine:
lda $0A
cmp #$00
beq !LoopEnd+ // L_BRS_8392_8384
//------------------------------
//L_jsr_8386_80CB:
//L_jsr_8386_8BD9:
//------------------------------
TwoStage256Delay:
lda #$00
//------------------------------
// L_jmp_8388_8D54:
//------------------------------
TwoStageDelay:
sta $30
//------------------------------
//L_BRS_838A_838C:
//------------------------------
!DelayLoopOne:
dec $30
bne !DelayLoopOne- // L_BRS_838A_838C
//------------------------------
//L_BRS_838E_8390:
//------------------------------
!DelayLoopPartTwo:
dec $30
bne !DelayLoopPartTwo- //L_BRS_838E_8390
//------------------------------
//L_BRS_8392_8384:
//------------------------------
!LoopEnd:
rts
//------------------------------
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
//------------------------------
// L_jmp_83A0_8370:
// L_jmp_83A0_83FA:
//------------------------------
MainGameLoop:
jsr GameControls // L_jsr_8470_83A0
jsr FireControl // L_jsr_84F8_83A3
jsr GridEdgeShipsControl // L_jsr_859B_83A6
jsr LaserControl // L_jsr_8635_83A9
jsr PODDecayControl // L_jsr_86D7_83AC
jsr BombControl // L_jsr_8753_83AF
jsr PODDestructionSfx // L_jsr_889A_83B2
jsr SnakeControl // L_jsr_88C9_83B5
jsr MasterTimerReset // L_jsr_89A0_83B8
jsr LevelCompletedControl // L_jsr_8AC8_83BB
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
jmp MainGameLoop // L_jmp_83A0_8370
nop
nop
nop
//------------------------------
// L_jmp_8400_82E9:
//------------------------------
ShipMaterialisationLoop:
jsr SetCharAndColourAtXY // L_jsr_8172_8400
lda $09
sta ScreenCharacter
dec $0A
lda $0A
cmp #$FF
beq !ShipPlacement+ // L_BRS_841A_840D
lda #$0F
clc
sbc $0A
sta SID_SIGVOL
jmp MaterialiseShip // L_jmp_8264_8417
//------------------------------
// L_BRS_841A_840D:
//------------------------------
!ShipPlacement:
lda #SHIPCharacter
sta ScreenCharacter
lda #SHIPColour
sta ScreenCharColour
lda #MATRIX_BOTTOM_ROW
sta ScreenRow
lda #(SCREEN_ROW_LENGTH / 2)
sta ScreenColumn
jsr SetCharAndColourAtXY // L_jsr_8172_842A
// Ship Materialised Sound Effect
lda #$0F
sta SID_SIGVOL
jsr WibbleWobbleSFX // L_jsr_8450_8432
lda #$08
sta SID_SIGVOL
jsr WibbleWobbleSFX // L_jsr_8450_843A
lda #$02
sta SID_SIGVOL
jsr WibbleWobbleSFX // L_jsr_8450_8442
lda #$00
sta SID_VCREG2
lda #$0F
sta SID_SIGVOL
rts
//------------------------------
// L_jsr_8450_8432:
// L_jsr_8450_843A:
// L_jsr_8450_8442:
//------------------------------
WibbleWobbleSFX:
lda #$18
sta $0A
//------------------------------
//L_BRS_8454_846D:
//------------------------------
!OuterDelayLoop:
lda $0A
sta SID_FREHI2
lda #$00
sta SID_VCREG2
lda #$11
sta SID_VCREG2
ldx #$02
//------------------------------
// L_BRS_8465_8469:
//------------------------------
!InnerDelayLoop:
jsr DelayRoutine // L_jsr_8380_8465
dex
bne !InnerDelayLoop- // L_BRS_8465_8469
dec $0A
bne !OuterDelayLoop- // L_BRS_8454_846D
rts
//------------------------------
// L_jsr_8470_83A0:
//------------------------------
GameControls:
dec MasterTimer // Equivalent to Raster Check
beq !CheckControls+ // L_BRS_8475_8472
rts
//------------------------------
// L_BRS_8475_8472:
//------------------------------
!CheckControls:
jsr JoystickCapture // L_jsr_8373_8475
lda ShipColumn
sta ScreenColumn
lda ShipRow
sta ScreenRow
jsr GetCharacterFromScreenLocation // L_jsr_818B_8020
cmp #SHIPCharacter
beq ShipStillIntacked // L_BRS_848A_8485
jsr IsFriendlyFireInShipSpot // L_jsr_8BEC_8487
//------------------------------
// L_BRS_848A_8485:
//------------------------------
ShipStillIntacked:
lda #GRIDCharacter
sta ScreenCharacter
lda #GRIDColour
sta ScreenCharColour
jsr SetCharAndColourAtXY // L_jsr_8172_8492
lda JoystickInput
and #joyUP // #$01 : Test For Down
beq !TestForDown+ // L_BRS_84A7_8499
dec ScreenRow
lda ScreenRow
cmp #MATRIX_SHIP_TOP_ROW - 1// Test For Upper Limit
bne !TestForDown+ // L_BRS_84A7_84A1
lda #MATRIX_SHIP_TOP_ROW // Reset back
sta ScreenRow
//------------------------------
// L_BRS_84A7_8499:
// L_BRS_84A7_84A1:
//------------------------------
!TestForDown:
lda JoystickInput
and #joyDOWN // #$02
beq !TestForLeft+ // L_BRS_84B9_84AB
inc ScreenRow
lda ScreenRow
cmp #MATRIX_BOTTOM_ROW + 1 // Test For off Grid
bne !TestForLeft+ // L_BRS_84B9_84B3
lda #MATRIX_BOTTOM_ROW // Reset To Bottom Row
sta ScreenRow
//------------------------------
// L_BRS_84B9_84AB:
// L_BRS_84B9_84B3:
//------------------------------
!TestForLeft:
lda JoystickInput
and #joyLEFT // #$04
beq !TestForRight+ // L_BRS_84CB_84BD
dec ScreenColumn
lda ScreenColumn
cmp #MATRIX_FIRST_COL - 1 // Test For Left Limit
bne !TestForRight+ // L_BRS_84CB_84C5
lda #MATRIX_FIRST_COL // Reset For Left Most Column
sta ScreenColumn
//------------------------------
// L_BRS_84CB_84BD:
// L_BRS_84CB_84C5:
//------------------------------
!TestForRight: