-
Notifications
You must be signed in to change notification settings - Fork 0
/
LANDER.MAC;24
1466 lines (1175 loc) · 23.1 KB
/
LANDER.MAC;24
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
; *************************************************************
; * *
; * LUNAR LANDER, BY MEYER A. BILLMERS *
; * *
; * THIS PROGRAM IMPLEMENTS, ON THE VT100, A VERSION OF *
; * DIGITAL EQUIPMENT CORPS CLASSIC GRAPHIC GAME, LUNAR *
; * LANDER. THE PLAYER IS THE PILOT OF A LUNAR ENTRY MODULE *
; * WITH CONTROLS THAT CONTROL THE FIRING OF ROCKETS *
; * THE THRUST OF THE ROCKETS. THE OBJECT IS TO MAKE A *
; * SOFT LANDING ON THE LUNAR SURFACE. *
; * *
; * GOOD LUCK! *
; * *
; *************************************************************
.TITLE LUNAR LANDER, BY MEYER A BILLMERS
.MCALL QIO$C,QIOW$S,ALUN$C,EXIT$S,MRKT$C,ASTX$S
; SYMBOL DEFINITIONS
TERRCH = 55
; MACRO DEFINITIONS
; REGISTER, STACK MACROS
.MACRO PUSH A
MOV A,-(SP)
.ENDM
.MACRO POP A
MOV (SP)+,A
.ENDM
.MACRO SAVREG
PUSH R0
PUSH R1
PUSH R2
PUSH R3
PUSH R4
PUSH R5
.ENDM
.MACRO RESREG
POP R5
POP R4
POP R3
POP R2
POP R1
POP R0
.ENDM
; VT100 SCREEN MACROS
; SEND A CHARACTER
.MACRO SNDCHR A
MOVB A,WRKST1
PUSH R0
MOV #WRKST1,R0
JSR PC,TYPE
POP R0
.ENDM
; INITIATE AN ESCAPE SEQUENCE (ESC [)
.MACRO ESCSEQ
SNDCHR #33
SNDCHR #133
.ENDM
; POSITION THE CURSOR AT A,B
.MACRO CURPOS A,B
MOV A,R0
MOV B,R1
JSR PC,POSCUR
.ENDM
; CLEAR THE SCREEN
.MACRO CLRSCR
CURPOS #1,#1
ESCSEQ
SNDCHR #60
SNDCHR #112
.ENDM
; TYPE A STRING
.MACRO SNDSTR A
MOV A,R0
JSR PC,TYPE
.ENDM
; TYPE A NUMBER (SIGNED)
.MACRO SNDNUM A
MOV A,R1
MOV #WRKSTR,R0
JSR PC,NUMSTR
JSR PC,TYPE
.ENDM
; TYPE A NUMBER (UNSIGNED)
.MACRO SNDABS A
INC ABSFLG
SNDNUM A
CLR ABSFLG
.ENDM
; LIGHT LED A (A = 0 => ALL LEDS OFF)
.MACRO LEDS A
ESCSEQ
SNDCHR A
SNDCHR #161
.ENDM
; MISCELLANEOUS MACROS
; DEPOSIT N ROCKS AT ALTITUDE A
.MACRO ROCK N,A
.REPT N
A,1,0
.ENDR
.ENDM
; DEPOSIT N FLAT SPACES AT ALTITUDE A
.MACRO FLAT N,A
.REPT N
A,0,0
.ENDR
.ENDM
START: ALUN$C 1,TI
QIO$C IO.ATA,1,,,,,<TTYINT>
MRKT$C 2,1,1,CLKINT
SNDSTR #INITMS
INC COLFLG
JMP MAINLP
NEWGAM: CLR TICKS
MOV FUELMX,FUEL
MOV XVELI,XVEL ; KEEPING TWEAKABLE CONSTANTS IN VARIABLES, SO WE
MOV YVELI,YVEL ; CAN CHANGE THEM USING THE MACHINES SWITCHES AT RUN TIME
MOV #1,XPREV
MOV #1,YPREV
MOV #1,XRPREV
MOV #1,YRPREV
MOV THRSTI,THRUST
MOV #2,ENGIN
; ENGINES ARE NUMBERED AS FOLLOWS:
; 5
; 6 4
; 7 L 3
; 8 2
; 1
; NOTE THAT THE NUMBER OF AN ENGINE IS ALSO THE INDEX INTO THE SIN AND COS TABLES
; CORRESPONDING TO THE X AND Y COMPONENTS OF THRUST DUE TO THAT ENGINE.
MOV XPOSI,XPOS
MOV YPOSI,YPOS
MAINLP: TST COLFLG ; COLLISION?
BEQ NOCOL
1$: TST RESFLG
BEQ 1$ ; TIME TO RESUME NEW GAME?
CLR RESFLG
CLR COLFLG
INC HDRFLG
JMP NEWGAM
NOCOL: SUB THRUST,FUEL ; UNITS OF FUEL ARE THRUST PER TICK
BGT 1$ ; OUT OF FUEL?
CLR THRUST
CLR FUEL
1$: ADD GRAV,YVEL ; NOTE THAT GRAVITY MUST BE SIGNED, MAY BE POSITIVE!
MOV THRUST,R1
MOV ENGIN,R0
DEC R0
ASL R0
MUL SINTAB(R0),R1 ; COMPUTE THE X COMPONENT OF ROCKET THRUST
ASH #-9.,R1 ; AND TABLE ENTRIESS FOR SIN,COS ARE IN OCTAL 1000THS
ADD R1,XVEL
MOV THRUST,R1
MUL COSTAB(R0),R1
ASH #-9.,R1
ADD R1,YVEL ; SAME FOR Y COMPONENT
ADD XVEL,XPOS
ADD YVEL,YPOS
POSCHK: CMP XPOS,#50000.
BLO POSCH1 ; OFF THE SIDES OF THE WORLD
CURPOS #1,#3
SNDSTR #SIDEMS
JMP COLLIS
POSCH1: JSR PC,ALT ; GET ALTITUDE
MOV R0,TEMP
TST R1
BGT POSCH2
SUB R1,YPOS
CURPOS #1,#3
CMP XVEL,#5 ; SOFT LANDING IS XVEL, YVEL < 5
BGT 1$
CMP XVEL,#-5
BLT 1$
CMP YVEL,#5
BGT 1$
CMP YVEL,#-5
BLT 1$
TST VIEW
BNE 2$
SNDSTR #NOSRMS ; CAN'T LAND WHERE NO SHORT RANGE VIEW EXISTS
JMP COLLIS
2$: CMP TEMP,#1 ; LANDIN ON A ROCK
BNE 3$
SNDSTR #ROCKMS
JMP COLLIS
3$: TST SUBR ; IS THERE A SUBROUTINE TO EXECUTE
BEQ 4$
JSR PC,@SUBR
JMP POSOK ; NOTE WE DON'T GO TO COLLIS BECAUSE SUBR MIGHT DO STUFF.
4$: SNDSTR #LANDMS ; SOFT LANDING!!
JMP COLLIS
1$: SNDSTR #COLMS ; CRASH!!!
JMP COLLIS
POSCH2: CMP YPOS,#24000. ; OFF TOP?
BLT POSOK
CURPOS #1,#3
SNDSTR #TOPMS
COLLIS: INC COLFLG ; OFF ANY EDGE IS TREATED AS A COLLISION
CLR RESFLG
CLR THRUST
POSOK: JSR PC,DISPLY
1$: CMP CLKCNT,#30
BLT 1$ ; WAIT FOR 1/2 SEC. TO ELAPSE
INC TICKS
INC TICROT ; ROTATING TICK COUNT
CLR CLKCNT
JMP MAINLP
; DISPLAY THE WORLD
DISPLY: CLR R2 ; COMPUTE VIEW TO BE DISPLAYED IN R2
JSR PC,ALT
MOV R1,ALTUDE
CMP R1,#1000.
BGE 1$
MOV XPOS,R1
CLR R0
DIV #1000.,R0
ASL R0
MOV ALTSR(R0),R2
1$: CMP R2,VIEW ; IF VIEW CHANGED, WE RE-DISPLAY
BEQ DISP0
INC HDRFLG
MOV R2,VIEW
DISP0: TST HDRFLG ; DO WE NEED TO RE-DISPLAY HEADERS
BNE DISPL0
JMP DISP1
DISPL0: MOV #1,XPREV
MOV #1,YPREV
MOV #1,XRPREV
MOV #1,YRPREV
CLRSCR
CLR HDRFLG
SNDSTR #WBMS
SNDSTR #XVELMS
SNDSTR #YVELMS
SNDSTR #THRMS
SNDSTR #XPOSMS
SNDSTR #YPOSMS
SNDSTR #ALTMS
SNDSTR #FUELMS
MOV #49.,R5
TST VIEW
BNE DISPL2 ; WHICH VIEW TO DISPLAY, LONG OR SHORT RANGE
DISPL1: MOV R5,R1
ASL R1
MOV ALTLR(R1),R3 ; LOOP TO DISPLAY THE SURFACE (LONG RANGE VIEW.)
CLR R2
DIV #1000.,R2 ; CONVERT TO SCREEN UNITS (1 S.U. IS 1000 LUNAR UNITS).
SUB #24.,R2
NEG R2
MOV R2,R4
CURPOS R5,R4
SNDCHR #TERRCH ; SEND THE TERRAIN CHARACTER
DEC R5
BEQ DSPL1A
JMP DISPL1
DSPL1A: JMP DISP1
DISPL2: MOV R5,R1 ; LOOP TO DISPLAY THE SURFACE (SHORT RANGE VIEW).
MUL #6,R1
ADD VIEW,R1
MOV (R1)+,R3
MOV (R1),TEMP ; SAVE THE TERRAIN CHARACTER IN TEMP
MOV TEMP,R1
MOVB TERTBL(R1),TEMP
CLR R2
DIV #40.,R2
SUB #24.,R2
NEG R2
MOV R2,R4
CURPOS R5,R4
SNDCHR TEMP
DEC R5
BEQ DISP1
JMP DISPL2
DISP1: CURPOS XPREV,YPREV
SNDCHR #40 ; BLANK OUT OLD SHIP POSITION
CURPOS XRPREV,YRPREV
SNDCHR #40 ; AND OLD ROCKET INDICATOR.
DISP1B: TST VIEW
BEQ 6$
MOV #40.,TEMP1
MOV #20.,TEMP2
BR 7$
6$: MOV #1000.,TEMP1
MOV #1000.,TEMP2
7$: MOV XPOS,R0 ; GET POSITIONS MODULO 1000.
TST VIEW
BEQ 8$
JSR PC,MODULO
8$: MOV R0,R3
CLR R2
DIV TEMP2,R2 ; CONVERT SHIP POSITION TO SCREEN COORDINATES.
MOV R2,R4
MOV YPOS,R0
DEC R0
BGE 10$
CLR R0
10$: TST VIEW
BEQ 9$
JSR PC,MODULO
9$: CLR R2
MOV R0,R3
BEQ 11$
ADD TEMP1,R3
SXT R2
DIV TEMP1,R2
11$: SUB #24.,R2
NEG R2
MOV R2,R5
TST R4
BGT 1$
MOV #1,R4
1$: CMP R4,#49.
BLE 2$
MOV #49.,R4
2$: TST R5
BGT 3$
MOV #1,R5
3$: CMP R5,#24.
BLE 4$
MOV #24.,R5
4$: JSR PC,ALT
CURPOS R4,R5 ; SEND OVER THE SHIP
SNDCHR #114 ; AS AN "L"
5$: MOV R4,XPREV
MOV R5,YPREV
TST FUEL
BEQ DISP2 ; IF NO FUEL LEFT, DON'T DISPLAY ROCKET INDICATOR.
DISP1A: MOV ENGIN,R0
DEC R0
ASL R0
MOV SINTAB(R0),R3
SXT R2
DIV #552,R2 ; TAKING THE INTEGER FUNCTION OF SIN, COS
SUB R2,R4 ; TO COMPUTE WHICH INDICATOR TO DISPLAY
MOV COSTAB(R0),R3
SXT R2
DIV #552,R2
ADD R2,R5
JSR PC,ALT
CMP R1,TEMP1
BLT DISP2
CURPOS R4,R5
SNDCHR #56 ; SEND A "." AS ROCKET FIRING INDICATOR
MOV R4,XRPREV
MOV R5,YRPREV
DISP2: CMP TICROT,DELCT ; TIME TO SEND OVER VITAL STATS?
BGE DISP2A
JMP DSPEND
DISP2A: CLR TICROT ; SENDING OVER VITAL STATISTICS ABOUT THE SHIP
CURPOS #68.,#6.
MOV XVEL,TEMP
ASL TEMP
SNDNUM TEMP
SNDSTR #SPC
CURPOS #68.,#7.
MOV YVEL,TEMP
ASL TEMP
SNDNUM TEMP
SNDSTR #SPC
CURPOS #68.,#9.
MOV THRUST,TEMP
ASL TEMP
SNDNUM TEMP
SNDSTR #SPC
CURPOS #68.,#11.
SNDABS XPOS
SNDSTR #SPC
CURPOS #68.,#12.
SNDNUM YPOS
SNDSTR #SPC
CURPOS #68.,#13.
SNDNUM ALTUDE
SNDSTR #SPC
CURPOS #68.,#15.
SNDNUM FUEL
SNDSTR #SPC
CURPOS #99.,#99.
DSPEND: RTS PC
; COMPUTE THE ALTITUDE OF THE SHIP. RETURNS ALTITUDE IN R1, TERRAIN CHARACTER IN R0
; RETURNS SUBR TO CALL IF LANDED IN SUBR.
ALT: PUSH R2
PUSH R3
PUSH R4
PUSH R5
MOV XPOS,R1
CLR R0
DIV #1000.,R0
MOV R0,R3
MOV YPOS,R1
ASL R0
SUB ALTLR(R0),R1
CMP R1,#1000.
BGE ALTDN
MOV ALTSR(R0),R2
BEQ ALTDN
MUL #1000.,R3
MOV XPOS,R5
SUB R3,R5
CLR R4
DIV #20.,R4
MOV R4,R3
MUL #6,R3
ADD R3,R2
SUB (R2)+,R1
MOV (R2)+,R0
MOV (R2),SUBR
ALTDN: POP R5
POP R4
POP R3
POP R2
RTS PC
; COMPUTE THE VALUE OF R0 MOD 1000., RETURNS RESULT IN R0
MODULO: PUSH R2
PUSH R3
MOV R0,R3
CLR R2
DIV #1000.,R2
MOV R2,R3
MUL #1000.,R3
SUB R3,R0
POP R3
POP R2
RTS PC
; TYPE AN ASCIZ STRING POINTED TO BY R0
TYPE: CLR BUFCTR
MOV R0,BUFPTR
1$: TSTB (R0)+
BEQ 2$
INC BUFCTR
BR 1$
2$: QIOW$S #IO.WVB,#1,#1,,,,<BUFPTR,BUFCTR>
RTS PC
; CONVERT A NUMBER TO AN ASCIZ STRING. NUMBER IN R1,POINTER TO STRING
; TO RETURN IN R0. PRINTS UNSIGNED NUMBERS IF ABSFLG IS SET.
NUMSTR: PUSH R0
PUSH R2
PUSH R3
CLR -(SP)
CLR NEGFL
TST ABSFLG
BNE 1$
TST R1
BPL 1$
INC NEGFL
NEG R1
1$: MOV R1,R3
CLR R2
NS1: DIV #10.,R2
ADD #60,R3
PUSH R3
TST R2
BEQ NS2
MOV R2,R3
CLR R2
BR NS1
NS2: TST NEGFL
BEQ NS3
MOVB #55,(R0)+
NS3: POP R2
MOVB R2,(R0)+
TSTB R2
BNE NS3
POP R3
POP R2
POP R0
RTS PC
MAC1: SNDSTR #MACMS
CLR CLKCNT
1$: CMP CLKCNT,#360.
BLT 1$
MOV #10.,YVEL
MOV #12.,THRUST
MOV #1,ENGIN
CLR XVEL
ADD #10.,YPOS
SNDSTR #MACMS2
RTS PC
MAC2: SNDSTR #MACMS3
INC COLFLG
CLR RESFLG
CLR FUEL
CLR THRUST
RTS PC
WBS1: SNDSTR #WBSMS
INC COLFLG
CLR RESFLG
CLR FUEL
CLR THRUST
RTS PC
WBS2: SNDSTR #WBSMS2
INC COLFLG
CLR RESFLG
CLR FUEL
CLR THRUST
RTS PC
GAS1: SNDSTR #GASMS
CLR CLKCNT
1$: CMP CLKCNT,#240.
BLT 1$
MOV #10.,YVEL
MOV #12.,THRUST
MOV #1,ENGIN
CLR XVEL
MOV #2000.,FUEL
ADD #10.,YPOS
SNDSTR #GASMS2
RTS PC
GAS2: SNDSTR #GASMS3
INC COLFLG
CLR RESFLG
CLR FUEL
CLR THRUST
RTS PC
; POSITION IN R0, R1 (X, Y). POSITION THE CURSOR THERE.
POSCUR: PUSH R2
PUSH R5
MOV #CPMS1,R2
MOV R0,R5
MOV #WRKSTR,R0
JSR PC,NUMSTR
TSTB WRKSTR
BEQ PC1
MOVB WRKSTR,(R2)+
TSTB WRKSTR+1
BEQ PC1
MOVB WRKSTR+1,(R2)+
PC1: MOVB #73,(R2)+
MOV R5,R1
MOV #WRKSTR,R0
JSR PC,NUMSTR
TSTB WRKSTR
BEQ PC2
MOVB WRKSTR,(R2)+
TSTB WRKSTR+1
BEQ PC2
MOVB WRKSTR+1,(R2)+
PC2: MOVB #146,(R2)+
CLRB (R2)+
SNDSTR #CPMS
POP R5
POP R2
RTS PC
MTNTOP: SNDSTR #MTNMS
CLR THRUST
INC COLFLG
CLR RESFLG
RTS PC
; ***************************************
; * *
; * AST INTERRUPT ROUTINES *
; * *
; ***************************************
CLKINT: INC CLKCNT
TST (SP)+
MRKT$C 2,1,1,CLKINT
ASTX$S
TTYINT: PUSH R0
MOV 2(SP),R0
BIC #177400,R0
CMP R0,#3
BNE TTYI1
CLRSCR ; HERE FOR CNTRL-C TO RETURN TO MCR
SNDSTR #VT52
EXIT$S
TTYI1: CMP R0,#101
BNE TTYI2
INC THRUST ; UP-ARROW INCREASES THRUST
CMP THRUST,#15.
BLE 1$
MOV #15.,THRUST
1$: JMP TTYIDN
TTYI2: CMP R0,#102 ; DOWN-ARROW INCREASES THRUST
BNE TTYI3
DEC THRUST
BGT 1$
MOV #1,THRUST
1$: JMP TTYIDN
TTYI3: CMP R0,#103 ; RIGHT-ARROW ROTATES ENGINE COUNTER-CLOCKWISE
BNE TTYI4
INC ENGIN
CMP ENGIN,#8.
BLE 1$
MOV #1,ENGIN
1$: JMP TTYIDN
TTYI4: CMP R0,#104 ; LEFT-ARROW ROTATES ENGINE CLOCKWISE
BNE TTYI5
DEC ENGIN
BGT 1$
MOV #8.,ENGIN
1$: JMP TTYIDN
TTYI5: CMP R0,#40
BNE TTYI6
INC RESFLG
JMP TTYIDN
TTYI6: CMP R0,#61
BLT TTYIDN
CMP R0,#71
BGT TTYIDN
SUB #60,R0
MOV R0,DELCT
TTYIDN: POP R0
TST (SP)+
ASTX$S
; **********************************
; * *
; * VARIABLES, ARRAYS, DATA *
; * *
; **********************************
WRKSTR: .BLKB 30
WRKST1: 0
BUFPTR: 0
BUFCTR: 0
FUELMX: 2000. ; INITIAL FUEL ALLOCATION
FUEL: 0 ; CURRENT FUEL REMAINING
XPOSI: 1000. ; INITIAL X POSITION
XPOS: 0 ; CURRENT X POSITION
YPOSI: 24000. ; INITIAL Y POSITION
YPOS: 0 ; CURRENT Y POSITION
XVELI: 600. ; INITIAL X VELOCITY
XVEL: 0 ; CURRENT X VELOCITY
YVELI: -350. ; INITIAL Y VELOCITY
YVEL: 0 ; CURRENT Y VELOCITY
ENGIN: 0 ; WHICH ENGINE IS FIRING?
GRAV: -2 ; ACCELERATION DUE TO GRAVITY
THRSTI: 12. ; INITIAL THRUST
THRUST: 0 ; CURRENT THRUST
COLFLG: 0 ; COLLITION HAS OCCURRED.
TICKS: 0
RESFLG: 0 ; SET TO PLAY A NEW GAME
HDRFLG: 0 ; NEED TO DISPLAY SCREEN HEADERS
XPREV: 0 ; SAVES OLD X POS. OF SHIP
YPREV: 0 ; SAVES OLD Y POS. OF SHIP
XRPREV: 0 ; SAVES OLD X POS. OF ROCKET INDICATOR
YRPREV: 0 ; SAVES OLD Y POS. OF ROCKET INDICATOR
CLKCNT: 0
NEGFL: 0
TEMP: 0
TEMP1: 0
TEMP2: 0
ABSFLG: 0
VIEW: 0 ; ADDRESS OF SHORT RANGE VIEW TABLE, OR 0 IF LONG RANGE VIEW
SUBR: 0 ; CONTAINS SUBROUTINE TO EXECUTE
ALTUDE: 0 ; SAVES THE ALTITUDE
DELCT: 1 ; DELAY COUNT FOR DISPLAYING VITALS STATS (1 IF NON-REMOTE TERMINAL)
TICROT: 0
SINTAB: 0 ; TABLE OF SINES, IN OCTAL, TIMES OCTAL 1000
-552
-1000
-552
0
552
1000
552
COSTAB: 1000 ; TABLE OF COSINES, IN OCTAL, TIMES OCTAL 1000
552
0
-552
-1000
-552
0
552
ALTLR: 4000.,3000.,2000.,2000.,2000.,3000.,4000.,3000.,3000.,3000.,2000.,1000.,1000.,0,0,0,0,0,0,0
0,0,0,2000.,3000.,4000.,3000.,2000.,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,1000.,2000.,3000.,4000.,5000.,5000.,6000.
ALTSR: 0,0,ALT1,ALT2,ALT3,0,0,ALT4,ALT5,ALT6,0,0,0,0,ALT7,ALT8,ALT9,ALT10,ALT11,ALT12
ALT13,ALT14,0,0,0,ALT15,0,0,0,ALT16,ALT17,ALT18,ALT19,ALT20,ALT21,ALT22
ALT23,ALT24,ALT25,ALT26,ALT27,ALT28,0,0,0,0,0,ALT29,ALT30,0
; SHORT RANGE ALTITUDE TABLES. EACH TABLE IS POINTED TO BY AN ENTRY IN ALTSR,
; AND CONSISTS OF 3 WORDS FOR EACH X GRADATION: ALTITUDE, CHARACTER TO DISPLAY
; (THIS SECOND WORD IS AN INDEX INTO TERTBL) AND POINTER TO SUBROUTINE TO CALL
; IF A LANDING OCCURS THERE. AN X GRADATION HERE IS 20, AND A Y GRADATION
; IS 40.
.NLIST BEX
.RADIX 10
ALT1: ROCK 2,280
ROCK 1,240
ROCK 1,200
ROCK 2,160
ROCK 2,120
ROCK 4,80
ROCK 2,40
ROCK 2,80
ROCK 2,40
ROCK 2,80
ROCK 2,120
ROCK 2,80
ROCK 2,40
FLAT 10,40
FLAT 8,0
ROCK 6,40
ALT2: ROCK 10,40
FLAT 8,40
FLAT 7,0
ROCK 1,0
FLAT 3,0
ROCK 2,0
FLAT 4,0
0,0,GAS1
0,0,GAS1
0,0,GAS1
0,0,GAS1
0,0,GAS1
0,4,GAS2
0,0,GAS1
0,0,GAS1
0,0,GAS1
0,0,GAS1
0,0,GAS1
ROCK 4,0
ALT3: ROCK 3,0
FLAT 4,9
ROCK 3,40
FLAT 12,40
ROCK 1,80
FLAT 5,80
ROCK 1,80
FLAT 5,80
ROCK 1,120
ROCK 15,160
ALT4: ROCK 8,240
ROCK 3,200
ROCK 1,160
ROCK 2,120
FLAT 5,80
ROCK 2,80
FLAT 5,40
FLAT 3,0
ROCK 1,40
FLAT 8,40
ROCK 6,80
FLAT 6,80
ALT5: FLAT 5,80
ROCK 2,80
FLAT 3,80
ROCK 6,40
FLAT 2,40
ROCK 2,40
FLAT 4,0
ROCK 1,0
FLAT 7,0
ROCK 2,0
FLAT 5,40
ROCK 2,40
FLAT 9,40
ALT6: ROCK 4,40
FLAT 5,80
ROCK 1,40
FLAT 4,40
ROCK 1,40
FLAT 6,40
ROCK 1,80
FLAT 3,80
ROCK 6,80
FLAT 5,40
ROCK 3,0
FLAT 5,0
ROCK 6,0
ALT7: FLAT 3,0
ROCK 1,0
FLAT 3,0
FLAT 5,40
ROCK 3,40
ROCK 5,80
ROCK 2,40
FLAT 3,40
ROCK 4,0
FLAT 5,0
ROCK 2,40
ROCK 1,80
ROCK 2,120
FLAT 3,120
ROCK 1,120
ROCK 3,80
ROCK 2,40
FLAT 2,40
ALT8: FLAT 3,40
ROCK 4,80
FLAT 3,40
ROCK 1,40
FLAT 10,40
ROCK 1,40
ROCK 1,80
FLAT 6,80
ROCK 3,80
FLAT 11,80
ROCK 2,80
ROCK 2,40
FLAT 3,40
ALT9: FLAT 5,40
ROCK 2,40
FLAT 8,0
ROCK 1,0
FLAT 5,0
ROCK 1,0
ROCK 1,40
ROCK 1,80
ROCK 2,40
FLAT 3,40