forked from EchoBeachUK/NoFuture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
No FutureAZ13_ZEUS.asm
10063 lines (8272 loc) · 539 KB
/
No FutureAZ13_ZEUS.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
AppFilename: equ "NoFuture" ; What we're called (for file generation)
AppFirst: equ 23808 ; First byte of code (uncontended memory) 32768
zeusemulate "48K" ; Set the model and enable ULA+
ORG 23808 ; ;
; 23808
;ATTR1_EMPTY: DEFS 768 ; EQU 23808 ;Screen ATTR Buffer for empty level
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Alien data 29 bytes each
ALIEN_DATA1: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA2: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA3: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA4: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA5: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA6: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA7: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA8: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA9: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA10: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA11: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA12: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA13: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA14: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
ALIEN_DATA15: DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
DEFB 0,0 ; Alien start coordinate
DEFB 0,0 ; Alien end coordinate
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 56,48 88,48 120,48 152,48 184,48
; 56,72 88,72 120,72 152,72 184,72
; 56,96 88,96 120,96 152,96 184,96
; Wave data 106 bytes
; DEFB 15 ; No of aliens
; DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien appears counter, counts to 255 then enables alien
; DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien drop timer to set the alien data
; DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien start coordinates (usually portal location)
; DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien goes to these coordinates
; DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien split counter (Up to 15, 0-disabled, 1 to 254 count up, 255-enabled
;
;ALIEN_DATA1: 29 bytes
; DEFB 0 ; Alien status, 0-disabled, 255-enabled, countdown from 254-explode
; DEFB 0 ; Alien appears counter, counts up to 255, then enables alien, Set by wave data
; DEFB 0 ; Alien split counter, counts up, when 255,alien splits into 4
; DEFB 0 ; Alien dropping timer-0 disabled, any number set by wave data counts up to 254 then alien drops, 255=bottom of screen (has water)
; DEFB 0 ; Alien drops bombs status-0 no bombs, 255=drop bombs randomly.
; DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien missile coordinates (up to 10 missiles)
; DEFB 0,0 ; Alien start coordinate (25 in)
; DEFB 0,0 ; Alien end coordinate
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DEFB 1,2,3,4,5,6,7,8,9,10 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copies wave data here for manipulation
LIVE_WAVE_DATA_STORE: ; 106 bytes ;
NUMBER_OF_ALIENS_SETTINGS:DEFB 0 ; No of aliens
ALIEN_APPEARS_SETTINGS: DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien appears counter, counts to 255 then enables alien
ALIEN_DROPS_SETTINGS: DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien drop timer to set the alien data
ALIEN_START_COORDINATES_SETTINGS:DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien start coordinates (usually portal location)
ALIEN_END_COORDINATES_SETTINGS:DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; Alien goes to these coordinates
ALIEN_BACKGROUND_COLOUR:DEFB 0 ; Bright yellow on black 70
ALIEN_COLLECTED_O2_COLOUR:DEFB 0 ; Bright cyan on black 69
O2_BONUS_COLOUR: DEFB 0 ; Bright magenta on black 67
H2O_BONUS_COLOUR: DEFB 0 ; Bright cyan on black 69
SHIELD_BONUS_COLOUR: DEFB 0 ; Bright red on black 66
THOUSAND_BONUS_COLOUR: DEFB 0 ; Bright white on black 71
LIFE_BONUS_COLOUR: DEFB 0 ; Bright magenta on black 67
POW_BONUS_COLOUR: DEFB 0 ; Bright cyan on black 69
ROCKET_BONUS_COLOUR DEFB 0 ; Bright green on black 68
PLAYER_COLOUR: DEFB 0 ; Player colour cyan on black 69
DEFB 0,0,0,0,0 ;
DEFB 1,2,3,4,5,6,7,8,9,10 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
START_KEY_ENABLED: DEFB 1 ; Start key enable (1)/disable (0)
TEXT_COORDINATES: DEFB 0,0 ; Text coordinates store
TEXT_STRING_POINTER DEFB 0,0 ; Text string pointer
CONTROL: DEFB 0 ; 0=keyboard, 1=Kempston joystick, 2=Fuller
SCORE: DEFM "1234567" ; 10,1000 digit score
DEFM "0000000" ; Overflow digits (these may be updated, but are never printed)
ALLOW_S_BUTTTON: DEFB 0 ; 1=Allow S button on delay routine
SP1X_SHIP DEFB 0 ; Player X coordinate (left/Right)
SP1Y_SHIP DEFB 0 ; Player Y coordinate (up/down, 0 top)
KEY_STORE_MASTER: DEFB 0 ; Stores selected keys
PLAYER_MISSILE_GRAPHIC: DEFB 0,0 ; Player missile graphic pointer
FIRE_ON DEFB 0 ; Fire 0 for off, 1 for on
PORTAL_APPEAR_COUNTER: DEFB 0 ; Counts up for portal appear animation
PORTAL_OPEN_CLOSE: DEFB 0 ; Portal =255 to open, =0 to close
H2O: DEFB 0 ; Amount of H2O left TEXT LINE
O2: DEFB 0 ; Amount of O2 left TEXT LINE
PORTAL_OPEN_COUNTER: DEFB 0 ; Counts up to 255, when 255, portal opens then it counts down again to 0 and portal closes
PORTAL_OPEN_COUNTER_ENABLE:DEFB 0 ; If enabled, allows portal open counter to count up
LIVES: DEFM "0" ; Store lives
DEFM "00" ;
WAVE_COUNT: DEFB 0 ; Wave counter
ALIEN_GRAPHIC: DEFB 0,0 ; Alien graphic store
ALIEN_GRAPHIC_COUNT: DEFB 0 ; Alien graphic counter 0 to 3
PLAYER_DIRECTION_LEFT_RIGHT:DEFB 0 ; Stores player movement flag
FIRE: DEFB 0 ; Fire pressed store
ALIEN_HIT_COUNTER: DEFB 0 ; Count aliens hit for next level
ALIEN_OFFSET_ADJUST DEFB 0 ; Move all alliens to offset
ALIEN_OFFSET_ADJUST_COUNTER:DEFB 0 ; When 255, adjust alien offset
ALIEN_OFFSET_LEFT_RIGHT:DEFB 0 ; Alien offset 1=left, 2=right
BUFFER_RETURN: DEFB 0 ; Buffer return status 1=on
BONUS_UP_DOWN: DEFB 0 ; Bonus up/down coordinate
BONUS_LEFT_RIGHT DEFB 0 ; Bonus left/right coordinate
BONUS_ENABLE: DEFB 0 ; Bonus enabled
BONUS_GRAPHIC_POINTER: DEFB 0,0 ; Bonus graphic pointer
SHIELD_BONUS_COUNTDOWN: DEFB 0 ; Shield bonus countdown to 0 and then disabled
;SHIELD_CHANGER_COUNTER: DEFB 0 ; Shield changer counter
;PLAYER_SHIP_GRAPHIC_POINTER:DEFB 0,0 ; Store player ship graphic pointer
ALIEN_HEAD_ENABLED: DEFB 0 ; Alien Head =0 for disabled, 1 for coming out, 2 for going away, 3 for displaying
ALIEN_HEAD_MOVEMENT_COUNTER:DEFB 0 ; Counts for alien head movement so we know its fully out or in
ALIEN_HEAD_MOVE_COUNTER:DEFB 0 ; Counts to 39 to add alien head move in a circle data
ALIEN_HEAD_CIRCLE_LOCATOR:DEFB 0,0 ; Pointer for alien head circle data
GENERAL_COUNTER: DEFB 0 ; Counts 0 to 255 and loops
BONUS_SELECT_COUNTER DEFB 0 ; counts 1 to 20 for bonus select
ALIENHEAD_HIT_COUNTER: DEFB 0 ; Used to count how many times we hit alienhead
PLAYER_MISSILE_SPREAD: DEFB 0 ; Set to 1 for player missile spread
ROTATE_BONUS DEFB 0 ; Set bonus rotation status
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
if *> 24450 ;
zeuserror "out of room" ;
endif ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ORG 24576 ;
; 24576 (96)
SCREEN1: DEFS 6143 ; EQU 24576 ;Screen buffer
; 30720 (120)
ATTR1: DEFS 768 ; EQU 30720 ;Screen ATTR Buffer
; 31488 (123)
;SCREEN1_EMPTY: DEFS 6143 ; EQU 30719 ;Screen buffer for empty 3
SCREEN: EQU 16384 ; Screen
ATTR: EQU 22528 ; ATTR
; Start planting code here. (When generating a tape file we start saving from here)
org 31488 ; Start of application
EXEC:
AppEntry: JP START ;
START: ; call DISPLAY_COCKPIT ;
; LD A,7
; call COLOUR_ATTR1
; jp GAMEPLAYSTART
; JP HI_SCORE_LOOP ;
; JP HI_SCORE_ENTRY ;
; jp DISPLAY_HI_SCORE_TABLE2
; CALL DISPLAY_COCKPIT
DI ;
LD SP,Zeus_SP ;
XOR A ;
LD (ALLOW_S_BUTTTON),A ; Switch off S key
OUT (254),A ;
LD IX,PRESS_ANY_KEY ;
CALL DISPLAY_STRING ;
CALL MUSIC ;
CALL FADE_CLEAR_PLAY_AREA ; Clear play area
CALL RESET_STATUS ;
DISPLAY_NEWS:
LD BC,65022 ; Reads the half row A to G
IN A,(C) ; Get keys
BIT 0,A ; Key A pressed to go back to News?
JP Z,DISPLAY_NEWS ; Display news screen
CALL CLEAR_SCREEN ;
LD A,71 ;
LD (ALIEN_BACKGROUND_COLOUR),A ;
CALL COLOUR_FULL_PLAY_AREA ;
CALL DISPLAY_COCKPIT ;
CALL DISPLAY_SCORE_FIGURES ; Display score figures
CALL DISPLAY_HI_SCORE_FIGURES ; Display Hi score figures
LD IX,START_MESSAGEA ;
CALL DISPLAY_STRING ;
CALL DISPLAY_TELETEXT_TITLE_TEMPLATE;
LD IX,SBCFAX_NEWS_TITLE ;
CALL DISPLAY_LARGE_TELETEXT_COMPRESSED ; Display data
LD IX,START_MESSAGE ;
CALL DISPLAY_STRING ;
LD IX,START_MESSAGEB ;
CALL DISPLAY_STRING ;
LD IX,TITLE ;
CALL DISPLAY_STRING ;
LD IX,SELECT_CONTROLS_TEXT ;
CALL DISPLAY_STRING ;
LD IX,START_MESSAGE2 ;
CALL DISPLAY_STRING ;
LD IX,START_MESSAGE2A ;
CALL DISPLAY_STRING ;
LD IX,START_MESSAGE2B ;
CALL DISPLAY_STRING ;
LD HL,DISPLAY_COUNTING_NUMBER+4 ;
LD (HL),48 ;
INC HL ;
LD (HL),48 ;
INC HL ;
LD (HL),48 ;
CALL SELECT_JK ; Wait for keyboard or joystick keys
LD A,1 ; Setup A for 1 to allow S key
LD (ALLOW_S_BUTTTON),A ; Switch on S key
LD A,71 ;
LD (ALIEN_BACKGROUND_COLOUR),A ;
CALL COLOUR_FULL_PLAY_AREA ;
CALL FADE_CLEAR_PLAY_AREA ;
JP HI_SCORE_LOOP2 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Hi score loop
HI_SCORE_LOOP:
CALL DISPLAY_COCKPIT ;
CALL UPDATE_METERS ; Update meters
CALL RESET_STATUS ;
CALL FADE_CLEAR_PLAY_AREA ; Clear play area
LD A,9 ; A=9 to set meters
LD (H2O),A ; Set H2O meter
LD (O2),A ; Set O2 meter
CALL UPDATE_METERS ; Update meters
HI_SCORE_LOOP2:
LD A,70 ; 70=Bright yellow on black
LD (ALIEN_BACKGROUND_COLOUR),A ; Set background colour at background colour routine
CALL COLOUR_FULL_PLAY_AREA ;
CALL DISPLAY_INSTRUCTIONS ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for start or news key and delay screen
DI ;
LD HL,DISPLAY_COUNTING_NUMBER+4 ;
LD (HL),48 ;
INC HL ;
LD (HL),48 ;
INC HL ;
LD (HL),48 ;
CHECK_KEY1_LOOP:
LD IX,DISPLAY_COUNTING_NUMBER ;
CALL DISPLAY_STRING ;
LD HL,DISPLAY_COUNTING_NUMBER+6 ;
LD A,(HL) ;
CP "6" ;
JR NZ,INC_NUMBER_1 ;
DEC HL ;
LD A,(HL) ;
CP "9" ;
JR NZ,INC_NUMBER_1 ;
DEC HL ;
LD A,(HL) ;
CP "1" ;
JR NZ,INC_NUMBER_1 ;
JP NEXT_TELETEXT_1 ;
INC_NUMBER_1:
LD HL,DISPLAY_COUNTING_NUMBER+6 ;
CALL RND ;
CP 10 ;
CALL C,INCREMENT_SCOREB ;
SKIP_INC_NUMBER_1:
LD BC,65022 ; Reads the half row A to G
IN A,(C) ; Get keys
BIT 0,A ; Key A pressed to go back to News?
JP Z,DISPLAY_NEWS ; Display news screen
BIT 1,A ; Key S pressed to start game?
JR NZ,NO_KEY_PRESSED1 ; Return if not
LD A,71 ;
LD (ALIEN_BACKGROUND_COLOUR),A ;
CALL COLOUR_FULL_PLAY_AREA ;
JP GAMEPLAYSTART ; Jump to Main level game start address
NO_KEY_PRESSED1:
JP CHECK_KEY1_LOOP ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NEXT_TELETEXT_1:
CALL COLOUR_FULL_PLAY_AREA ;
CALL FADE_CLEAR_PLAY_AREA ;
CALL DISPLAY_HI_SCORE_TABLE ;
LD IX,DISPLAY_INSTRUCTIONS_DATA1D;
CALL DISPLAY_STRING ;
LD IX,DISPLAY_INSTRUCTIONS_DATA1E;
CALL DISPLAY_STRING ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check for start or news key and delay screen
DI ;
LD HL,DISPLAY_COUNTING_NUMBER+4 ;
LD (HL),48 ;
INC HL ;
LD (HL),48 ;
INC HL ;
LD (HL),48 ;
INC HL ;
CHECK_KEY2_LOOP:
LD IX,DISPLAY_COUNTING_NUMBER ;
CALL DISPLAY_STRING ;
LD HL,DISPLAY_COUNTING_NUMBER+6 ;
LD A,(HL) ;
CP "7" ;
JR NZ,INC_NUMBER_2 ;
DEC HL ;
LD A,(HL) ;
CP "9" ;
JR NZ,INC_NUMBER_2 ;
DEC HL ;
LD A,(HL) ;
CP "1" ;
JR NZ,INC_NUMBER_2 ;
JP NEXT_TELETEXT_2 ;
INC_NUMBER_2:
LD HL,DISPLAY_COUNTING_NUMBER+6 ;
CALL RND ;
CP 10 ;
CALL C,INCREMENT_SCOREB ;
SKIP_INC_NUMBER_2:
LD BC,65022 ; Reads the half row A to G
IN A,(C) ; Get keys
BIT 0,A ; Key A pressed to go back to News?
JP Z,DISPLAY_NEWS ; Display news screen
BIT 1,A ; Key S pressed to start game?
JR NZ,NO_KEY_PRESSED2 ; Return if not
LD A,71 ;
LD (ALIEN_BACKGROUND_COLOUR),A ;
CALL COLOUR_FULL_PLAY_AREA ;
JP GAMEPLAYSTART ; Jump to Main level game start address
NO_KEY_PRESSED2:
JP CHECK_KEY2_LOOP ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NEXT_TELETEXT_2:
CALL COLOUR_FULL_PLAY_AREA ;
CALL FADE_CLEAR_PLAY_AREA ;
JP HI_SCORE_LOOP2 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
INCREMENT_NUMBER:
SC37098B: LD (HL),48 ; Roll the digit over from '9' to '0'
DEC HL ; Point HL at the next digit to the left
;The entry point to this routine is here. HL pointing at the digit of the score to be incremented
INCREMENT_SCOREB:
SC37118B:
INC_SCORE_LOOPB:
LD A,(HL) ; Pick up a digit of the score
CP 57 ; Is it '9'?
JR Z,SC37098B ; Jump if so
INC (HL) ; Increment the digit
RET ;
RET ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; _____ __ __ ______ _____ _______ _____ _______
; / ____| /\ | \/ | ____| / ____|__ __|/\ | __ \__ __|
; | | __ / \ | \ / | |__ | (___ | | / \ | |__) | | |
; | | |_ | / /\ \ | |\/| | __| \___ \ | | / /\ \ | _ / | |
; | |__| |/ ____ \| | | | |____ ____) | | |/ ____ \| | \ \ | |
; \_____/_/ \_\_| |_|______| |_____/ |_/_/ \_\_| \_\ |_|
;
; Initialise game varables that dont reset until game over
GAMEPLAYSTART:
XOR A ; A=0
LD (PLAYER_MISSILE_SPREAD),A ; Reset player missile spread
LD (BONUS_SELECT_COUNTER),A ; Reset bonus select counter
LD (WAVE_COUNT),A ; Reset wave counter
LD (BUFFER_RETURN),A ; Reset buffer return status
LD (ALIEN_GRAPHIC_COUNT),A ; Reset alien graphic anim counter
LD A,0 ;
; Set alien head initial status
LD (ALIEN_HEAD_ENABLED),A ; Initial alien head status ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; LD A,18 ;
LD (WAVE_COUNT),A ; Reset wave counter
LD A,9 ; A=9 to set meters
LD (H2O),A ; Set H2O meter
LD (O2),A ; Set O2 meter
CALL UPDATE_METERS ; Update meters
CALL SETUP_TESTTUBE_BUBBLES ; Reset test tube bubbles
LD A,3 ;
LD (SET_NUMBER_OF_PLAYER_ROCKETS+1),A ; Set player number of missiles to 3
CALL RESET_STATUS ;
LD HL,PLAYER_MISSILE_GRAPHIC1 ; Point to Player basic missile graphic
LD (PLAYER_MISSILE_GRAPHIC),HL ; Set plaher missile graphic pointer to basic missile graphic
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Level starts here
; Setup varables for level
NEXT_WAVE:
CALL RESET_ALIEN_MISSILES ; Reset all alien fire
CALL RESET_PLAYER_FIRE ; Reset all player fire data
CALL SETUP_SNOWFLAKES ; Setup stars
CALL RESET_ALIEN_HEAD_DATA ; Reset alien head data
CALL RESET_ALIEN_HEAD_MISSILES ; Reset alien head missiles
XOR A ; A=0
LD (ROTATE_BONUS),A ; Set bonus rotation status
LD (ALIENHEAD_HIT_COUNTER),A ; Reset alien head hit counter
LD (GENERAL_COUNTER),A ; Reset General counter
LD (PORTAL_OPEN_CLOSE),A ; Initialise Portal open/close
LD (BONUS_ENABLE),A ; Reset bonus
LD (ALIEN_OFFSET_ADJUST_COUNTER),A; When 255, adjust alien offset
LD (ALIEN_OFFSET_LEFT_RIGHT),A ; Alien offset 0=OFF, 1=left, 2=right
LD (PORTAL_APPEAR_COUNTER),A ; Initialise Portal appear counter
LD (ALIEN_HEAD_MOVEMENT_COUNTER),A; Reset alien head counter
LD (ALIEN_HEAD_MOVE_COUNTER),A ; Reset alienhead move counter
LD A,254 ;
LD (PORTAL_OPEN_COUNTER),A ; Reset portal open counter
LD A,1 ; Make A=1
LD (ALIEN_OFFSET_ADJUST),A ; Move all alliens to offset
LD (PORTAL_OPEN_COUNTER_ENABLE),A ; Update portal open counter enabler to 1
; Set alien head initial status
; LD A,0 ;
; LD (ALIEN_HEAD_ENABLED),A ; Initial alien head status ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; LD A,255
; LD (PORTAL_OPEN_COUNTER),A
LD A,120 ; Middle left/right
LD (SP1X_SHIP),A ; Set Middle left/right
LD A,168 ; Player ship starts at line 21 and goes up to line 19 at 152
LD (SP1Y_SHIP),A ; Set bottom up/down
CALL FADE_CLEAR_PLAY_AREA ;
LD A,7 ; To fill ATTR 1 with white on black
CALL COLOUR_ATTR1 ; Fill ATTR buffer with white on black
CALL CLEAR_ALIEN_DATA ; Reset all alien data
LD A,(WAVE_COUNT) ; Get wave number
CP 19 ; Are we on wave 19 or above?
CALL C,PROCESS_WAVE_DATA ; If not then Copies wave data to live and updates alien settings
LD A,50 ; Set player shield countdown
LD (SHIELD_BONUS_COUNTDOWN),A ; Reset shield bonus countdown
LD HL,CIRCLE_MOVE_DATA ; Point HL at alien head circle data
LD (ALIEN_HEAD_CIRCLE_LOCATOR),HL ; Store alien head circle data pointer
LD A,9 ; A=9 to set meters
LD (H2O),A ; Set H2O meter
LD (O2),A ; Set O2 meter
CALL UPDATE_METERS ; Update meters
LD A,(ALIEN_BACKGROUND_COLOUR) ;
LD (ALIEN_BACKGROUND_COLOURA+1),A;
LD (ALIEN_BACKGROUND_COLOURB+1),A;
LD (GAME_OVER_TEXT+2),A ; Set background colour for text
LD A,(PLAYER_COLOUR) ; Get player colour
LD (SET_PLAYER_COLOUR+1),A ; Set player colour at sprite routine for player
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; __ __ _____ _ _ _____ __ __ ______ _ ____ ____ _____
; | \/ | /\ |_ _| \ | | / ____| /\ | \/ | ____| | | / __ \ / __ \| __ \
; | \ / | / \ | | | \| | | | __ / \ | \ / | |__ | | | | | | | | | |__) |
; | |\/| | / /\ \ | | | . ` | | | |_ | / /\ \ | |\/| | __| | | | | | | | | | ___/
; | | | |/ ____ \ _| |_| |\ | | |__| |/ ____ \| | | | |____ | |___| |__| | |__| | |
; |_| |_/_/ \_\_____|_| \_| \_____/_/ \_\_| |_|______| |______\____/ \____/|_|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MAIN_GAME_LOOP:
; Clear buffers
;
; Fast clear-screen routine
; Uses the stack to block clear memory
; Clear screen buffer
DI ;
LD (STACKPOINTER+1),SP ; Save the stack
LD SP,SCREEN1+6143 ; Set stack pointer to end of screen buffer
LD HL,0 ; Set HL to 0 to clear the buffer
LD B,189 ; Set loop counter
; Fill the memory
PUSHLOOP:
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
DJNZ PUSHLOOP ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Fast clear-screen routine
; Uses the stack to block clear memory
; Save the stack pointer
LD SP,ATTR1+768-64 ; e.g. to fill from &C000 to &FFFF (&4000 bytes), set SP to &FFFF+1 = &0000
; Define the region of RAM to be filled
ALIEN_BACKGROUND_COLOURA:LD H,0 ;
ALIEN_BACKGROUND_COLOURB:LD L,0 ; Use HL or whichever 16-bit register you prefer
; LD HL,17990 ;
LD B,19 ; 19 lines to fill for visible ATTR
; Fill the memory
PUSHLOOP2:
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
PUSH HL ; Writes HL to (SP-2) and DECs SP by 2
DJNZ PUSHLOOP2 ;
STACKPOINTER: LD SP,0 ; Restore the stack
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; _____ _____ __ __ _____ __ __ ______
; | __ \| __ \ /\ \ / / / ____| /\ | \/ | ____|
; | | | | |__) | / \ \ /\ / / | | __ / \ | \ / | |__
; | | | | _ / / /\ \ \/ \/ / | | |_ | / /\ \ | |\/| | __|
; | |__| | | \ \ / ____ \ /\ / | |__| |/ ____ \| | | | |____
; |_____/|_| \_\/_/ \_\/ \/ \_____/_/ \_\_| |_|______|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LD HL,GENERAL_COUNTER ; Get general counter
INC (HL) ; Add 1 to general counter
LD A,(PORTAL_OPEN_COUNTER_ENABLE) ; Get status of portal open counter enabler
OR A ; CP 0 ; Is it ON to enable the portal open counter to increment?
JR Z,SKIP_PORTAL_ENABLER_COUNTER ; Skip if so
LD HL,PORTAL_OPEN_COUNTER ; Get portal open counter
INC (HL) ; Add 1 to Portal open counter
LD A,(HL) ; Place portal open counter into A
CP 255 ; Is it at 255?
JR NZ,SKIP_PORTAL_ENABLER_COUNTER2 ; If not enabled then skip setting portal open_close
LD (PORTAL_OPEN_CLOSE),A ; Update portal open close status
INC A ; Make A =0
LD (PORTAL_OPEN_COUNTER_ENABLE),A ; Update portal open counter enabler to disabled as the portal is open
SKIP_PORTAL_ENABLER_COUNTER2:
SKIP_PORTAL_ENABLER_COUNTER:
LD A,(PORTAL_APPEAR_COUNTER) ; Get Portal appear counter
OR A ; Is it 0?
JR Z,CONTINUE_AFTER_OPEN_CLOSE_PORTAL_CHECK ; If so then skip open/close portal
LD HL,PORTAL_GRAPHIC_LOOKUP_TABLE-2; Point to Portal graphic lookup address table
; LD B,A ; B=Portal appear counter to choose graphic
;SELECT_PORTAL_GRAPHIC_LOOP:
; INC HL ; Add 2 to HL to move to next 16 bit address in table
; INC HL ;
; DJNZ SELECT_PORTAL_GRAPHIC_LOOP ; Jump back until at the correct part of the table
ADD A,A ;
LD E,A ;
LD D,0 ;
ADD HL,DE ;
LD A,(HL) ; Get data first byte into A
INC HL ; Move to next address in table
LD B,(HL) ; Get data of second byte into B
LD L,A ; Move first byte data to L
LD H,B ; Move second byte data to H
PUSH HL ; Place address onto stack
POP IX ; Restore from stack into IX
CALL DISPLAY_LARGE_GRAPHIC ; Display large graphic
CONTINUE_AFTER_OPEN_CLOSE_PORTAL_CHECK:
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Opens/closes/animates portal
SELECT_PORTAL:
LD HL,PORTAL_APPEAR_COUNTER ;
LD A,(PORTAL_OPEN_CLOSE) ; Get portal Open/Close status
CP 255 ; Portal status open?
JR NZ,SKIP_OPEN_PORTAL ; If not then skip opening portal
; Check to open portal
LD A,(HL) ; Get portal appear counter
CP 12 ; Is it at 12?
JR Z,SKIP_ADD_TO_PORTAL ; If so then jump adding more to portal appear counter
INC (HL) ; Add 1 to update portal appear counter
JP SKIP_PORTAL_APPEAR ; Jump to end to update portal appear counter
SKIP_ADD_TO_PORTAL:
LD (HL),9 ; Set for updating portal appear counter
JP SKIP_PORTAL_APPEAR ; Jump to update portal appear counter
SKIP_OPEN_PORTAL:
; Check to close portal
OR A ; CP 0 Portal status closed?
JR NZ,SKIP_PORTAL_APPEAR ; If status is not set to close then skip
LD A,(HL) ; Get portal appear counter
OR A ; CP 0 Is it 0?
JR Z,SKIP_PORTAL_APPEAR ; Skip making any changes if set to zero
DEC (HL) ; Take 1 from A to update portal appear counter
SKIP_PORTAL_APPEAR:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check to see if Alien head is required
; ALIEN_HEAD_ENABLED =0 for disabled, 1 for coming out, 2 for going away, 3 for displaying, 4 for exploding
LD A,(ALIEN_HEAD_ENABLED) ; Get alien head enabled status
OR A ; CP 0 ; If disabled then skip alien head
JP Z,SKIP_DISPLAY_ALIEN_HEAD ; Skip alien head if so
; Is alien head exploding?
CP 4 ; Is alien head out and exploding?
JR Z,EXPLODE_ALIENHEAD ; If so then explode alien head
; Is alien head out and in display mode?
CP 3 ; Is alien head out and in display mode?
JR NZ,SKIP_3 ; If not then skip display mode
LD HL,413 ; HL=413 to set amount of points to draw full alien head
LD (LARGE_ALIEN_LENGTH+1),HL ; Set loop for alien head draw to HL
LD HL,SKIP_ADDING_A_ROW ; HL=address of code to jump to skip adding a row to alien head to speed up drawing
LD (ROW_JUMP+1),HL ; Set the jump at ROW_JUMP to the address to jump to
LD HL,ALIEN_HEAD_CIRCLE_LOCATOR ; Point at alien head circle data pointer
INC (HL) ; Move pointer forward 1 address
INC (HL) ; Move pointer forward 1 address
LD HL,ALIEN_HEAD_MOVE_COUNTER ; Point at alien head move counter
INC (HL) ; Add 1 to alienhead move counter
LD A,(HL) ; Get alienhead move counter into A for testing
CP 39 ; Is it at 39?
JR C,SKIP_RESETTING_ALIENHEAD_MOVE_COUNTER;
LD (HL),0 ; Reset alien move counter
LD HL,CIRCLE_MOVE_DATA ; Point HL at alien head circle data
LD (ALIEN_HEAD_CIRCLE_LOCATOR),HL ; Store alien head circle data pointer
SKIP_RESETTING_ALIENHEAD_MOVE_COUNTER:
JP DISPLAY_ALIEN_HEAD ; Jump to displaying alien head
SKIP_3:
; Is alien head going away?
CP 2 ; Is alien head going away?
JR NZ,SKIP_2 ; If not then skip going away
LD HL,200 ; HL=200 to set amount of points to draw alien head going away
LD (LARGE_ALIEN_LENGTH+1),HL ; Set loop for alien head draw to HL
LD HL,ADD_ANOTHER_ROW ; HL=address of code to jump to add a row to alien head to speed up drawing
LD (ROW_JUMP+1),HL ; Set the jump at ROW_JUMP to the address to jump to
JP SKIP_BRINGING_OUT_ALIEN_HEAD ; Jump to displaying alien head
SKIP_2:
; Is alien head coming out?
CP 1 ; Is alien head coming out?
JR NZ,SKIP_1 ; If not then skip coming out
LD HL,200 ; HL=200 to set amount of points to draw alien head going away
LD (LARGE_ALIEN_LENGTH+1),HL ; Set loop for alien head draw to HL
JP BRING_OUT_ALIEN_HEAD ; If not then skip alien head coming out
LD HL,ADD_ANOTHER_ROW ; HL=address of code to jump to add a row to alien head to speed up drawing
LD (ROW_JUMP+1),HL ; Set the jump at ROW_JUMP to the address to jump to
SKIP_1:
JP SKIP_DISPLAY_ALIEN_HEAD ; Skip alien head
BRING_OUT_ALIEN_HEAD:
; Alien head is coming out
LD HL,ALIEN_HEAD_MOVEMENT_COUNTER; Get alien head movement counter
INC (HL) ; Add 1 to alien head counter
LD A,(HL) ; Get alien head counter
CP 50 ; Is alien head fully out?
JR NZ,DISPLAY_ALIEN_HEAD ; Skip setting alien head to display
LD (HL),0 ; Reset alien head movement counter
LD A,3 ; A=3 for display
LD (ALIEN_HEAD_ENABLED),A ; Set alien head enabled status to display
JP DISPLAY_ALIEN_HEAD ; Alien head is out so jump other alien head modes
SKIP_BRINGING_OUT_ALIEN_HEAD:
;Alien head is going away?
LD HL,ALIEN_HEAD_MOVEMENT_COUNTER; Get alien head movement counter
INC (HL) ; Add 1 to alien head counter
LD A,(HL) ; Get alien head counter
CP 45 ; Is alien head fully away?
JR NZ,SKIP_PUTTING_AWAY_ALIEN_HEAD; Skip setting alien head to disabled
XOR A ; A=0 to disable alien head
LD (HL),A ; Reset alien head movement counter
LD (ALIEN_HEAD_ENABLED),A ; Set alien head enabled status to disabled
JP MOVE_TO_NEXT_LEVEL ; Go to next level
EXPLODE_ALIENHEAD:
; Explode alien head
LD HL,200 ; HL=200 to set amount of points to draw alien head going away
LD (LARGE_ALIEN_LENGTH+1),HL ; Set loop for alien head draw to HL
LD HL,ADD_ANOTHER_ROW ; HL=address of code to jump to add a row to alien head to speed up drawing
LD (ROW_JUMP+1),HL ; Set the jump at ROW_JUMP to the address to jump to
LD HL,ALIEN_HEAD_MOVEMENT_COUNTER; Point to alien head movement counter
INC (HL) ; Add 1 to alien head counter
LD A,(HL) ; Get alien head counter
CP 50 ; Is alien head fully out?
JR NZ,DISPLAY_ALIEN_HEAD ; Skip resetting alien head
LD A,0 ; A=0 for off
LD (HL),A ; Reset alien head movement counter
LD (ALIEN_HEAD_ENABLED),A ; Set alien head enabled status to off
JP MOVE_TO_NEXT_LEVEL ; Go to next level
SKIP_PUTTING_AWAY_ALIEN_HEAD:
DISPLAY_ALIEN_HEAD:
; Alien head in display mode
; Live data
; X Y
; | | X Y Default data
; DEFB 0,0,5,138
DI ;
LD IX,ALIEN_HEAD_DATA ; Point at Alien head data
LARGE_ALIEN_LENGTH: LD BC,413 ; 413 ; 998 blocks of data for eack point
DISPLAY_ALIEN_HEAD_LOOP:
PUSH BC ; Save alien head draw loop
SKIP_RESET_ALIEN_HEAD_FINISHB:
; Process point
LD A,(ALIEN_HEAD_ENABLED) ; Get alien head enabled status
CP 3 ; Is Alien Head status 3?
JR Z,DISPLAY_FULL_ALIEN ; If so then Alien Head is fully displayed so no need to move it
; Display coming out and going in alien head
LD A,175 ;
SUB (IX+1) ; Get second byte of current point up/down coordinate
LD D,A ;
LD E,(IX+0) ; Get third byte of current point left/right coordinate
JP SKIP_DISPLAY_FULL_ALIEN ;
DISPLAY_FULL_ALIEN:
; Display the full alien mode 3
LD HL,(ALIEN_HEAD_CIRCLE_LOCATOR); Point to current alien head circle coordinate table
LD A,(HL) ; Get left/right coordinate from circle table
ADD (IX+2) ; E; Add to left/right dot coordinate
SUB 108 ; Place central to screen
LD E,A ; Update E with left/right coordinate
LD (ALIENHEAD_CHECK_HIT_Y+1),A ; Set alien head coordinate for hit by player missiles
SUB 8 ; Move missile 8 pixels left to line it up with screen centre
LD (ALIENHEAD_MISSILE_X+3),A ; Set alienhead missile X coordinate
LD (ALIENHEAD_BONUS_X+1),A ; Set alienhead bonus X coordinate
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
INC HL ; Move to next alien head circle coordinate table
LD A,175 ; Top of screen
; Get second byte of current point up/down coordinate
ADD (IX+3) ; Subtract from top of screen
LD D,A ; D=up/down pixel coordinate
LD A,(HL) ; Get up/down coordinate from circle table
SUB D ; Take from current dot up/down coordinate
LD D,A ; Update D with up/down coordinate
LD (ALIENHEAD_CHECK_HIT_X+1),A ; Set alien head coordinate for hit by player missiles
LD (ALIENHEAD_MISSILE_Y+3),A ; Set alienhead missile Y coordinate
LD (ALIENHEAD_BONUS_Y+1),A ; Set alienhead bonus Y coordinate
SKIP_DISPLAY_FULL_ALIEN:
PUSH DE ; Save point coordinates
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Get screen address for pixel
LD A,D ; 175 ;Test that the y co-ordinate (in SUB B B) is not greater than 116.
; SUB D
AND A ; A holds b7b6b5b4b3b2b1b0,
RRA ; The bite of B. And now 0b7b6b5b4b3b2b1.
SCF ;
RRA ; Now 10b7b6b5b4b3b2.
AND A ;
RRA ; Now 010b7b6b5b4b3.
XOR D ;
AND 248 ; Finally 010b7b6b2b1b0, so that
XOR D ; H becomes 64 + 8*INT (B/64) +
OR 96 ; Move to screen buffer
LD H,A ; B (mod 8), the high byte of the
LD A,E ; pixel address. C contains X.
RLCA ; A starts as c7c6c5c4c3c2c1c0.
RLCA ;
RLCA ; And is now c2c1c0c7c6c5c4c3.
XOR D ;
AND 199 ;
XOR D ; Now c2c1b5b4b3c5c4c3.
RLCA ;
RLCA ; Finally b5b4b3c7c6c5c4c3, so
LD L,A ; that L becomes 32*INT (B(mod
LD A,E ; 64)/8) + INT(x/8), the low byte.