Moonlander has you land a craft on the craggy surface of the moon. The controls are 7 to rotate left, 8 to rotate right and 9 for thrust. A status line shows vertical and horizontal speed, fuel and lives. Landing pads are marked with flashing crosses; a soft landing on an allowed pad scores and moves you to the next scene, while some pads are “RESTRICTED”. Running out of fuel or crashing costs a life, and landing on all the pads ends the game with your score.
It is on CATS Library Tape 1 of the Capital Area Timex Sinclair Users Group, and on the CATS library disks for the Zebra disk drive; both copies list the same. Its REM reads “moonlander”; no author is named. It is related to the SINCUS Moon Lander, but about half the lines differ, and it is written entirely in BASIC with user-defined graphics for the lander.
Program Analysis
The lander is drawn with a UDG chosen by its orientation; subroutine 9000 defines the graphics from DATA. Speed and position are updated each pass of the main loop from line 100, with separate routines for changing scene (500), landing (600), leaving the screen (700) and crashing (800).
- The TAP is saved without an autostart line, so type RUN after loading.
Source Code
10 REM moonlander
11 PRINT : PRINT : PRINT "In MOONLANDER you must bring your craft to a safe landing on the craggy surface of the moon. Your controls are -- 7 - rotate left, 8 - rotate right, and 9 - thrust. Good luck!"
12 PRINT : PRINT : PRINT "Press any key to begin....."
13 IF INKEY$="" THEN GO TO 13
20 PAPER 0: BORDER 0: CLS : INK 4
30 LET lv=.5: LET sc=0: LET z=3: LET l=0: LET vs=30: LET hs=21
35 GO SUB 9000
36 LET pad=0: LET f=3000: DIM c(30)
40 LET ls=9530: LET h=0: LET d=0: LET line=2: LET col=10: LET drift=3: LET gs=147: LET down=4: LET s=0
60 GO SUB 9500
70 PRINT AT 14,4; FLASH 1;"x";AT 20,9;"x";AT 17,15;"x";AT 15,21;"x";AT 19,24;"x"
100 REM program
110 INK 7
115 PRINT AT 0,0; INVERSE 1; INK 6;"v/speed: ";vs;" ";AT 0,15;"h/speed ";hs;" ";AT 0,31;z;#0; INVERSE 1; INK 6;AT 0,0;"fuel: ";f;" "
116 IF INT line=h-2 AND (INT col=d OR INT (col+.5)=d) THEN GO TO 600
120 PRINT AT line,col;CHR$ gs
125 IF ATTR (line+SGN vs,col+SGN drift)=4 OR ATTR (line,col+SGN drift)=4 THEN GO TO 800
130 LET pc=col: LET pl=line
140 LET col=col+SGN drift
145 LET line=line+lv*SGN vs*(ATTR (line+SGN vs,col)<>132)
150 LET drift=drift+(INKEY$="9" AND gs=146)-(INKEY$="9" AND gs=144)
155 LET down=SGN (down+(INKEY$="9" AND gs=145)-(INKEY$="9" AND gs=147)-down*(INKEY$=""))
160 LET gs=gs+(INKEY$="7")-(INKEY$="8")
170 IF gs=148 THEN LET gs=144
180 IF gs=143 THEN LET gs=147
190 IF INKEY$="9" THEN LET f=f-10
195 IF INKEY$="9" THEN BEEP .08,20
200 IF col>=30 THEN GO TO 700
210 IF col>=0 AND col<1 THEN GO TO 760
220 IF line=1 THEN LET line=2
230 LET vs=vs+5+15*down: LET hs=drift*7
235 IF s<>0 THEN GO TO 250
240 IF line>=12 AND s=0 THEN GO TO 505
250 IF s=1 AND line<=2 THEN RESTORE 9530: LET col=(col/3.1)+22*(ls=9580)+19*(ls=9570)+11*(ls=9560)+6*(ls=9550): LET ls=9530: CLS : INK 4: LET line=11: LET s=0: GO TO 60
270 IF l=6 THEN BEEP .08,40: LET l=0
275 LET l=l+1
280 IF line<=2 THEN LET line=2
290 IF f=0 THEN GO TO 950
400 PRINT AT pl,pc;" "
410 GO TO 100
500 REM change scene
505 LET col=INT col
510 LET ls=9530+10*(col>0 AND col<7)+20*(col>6 AND col<13)+30*(col>12 AND col<18)+40*(col>17 AND col<22)+50*(col>21 AND col<31)
520 CLS : INK 4: LET line=2: RESTORE ls
530 GO SUB 9500
540 LET h=6*(col>0 AND col<7)+21*(col>6 AND col<13)+16*(col>12 AND col<18)+9*(col>17 AND col<22)+21*(col>21 AND col<31)
550 LET d=12*(col>0 AND col<7)+9*(col>6 AND col<13)+12*(col>12 AND col<18)+16*(col>17 AND col<22)+6*(col>21 AND col<31)
560 PRINT AT h,d; FLASH 1;"X"
565 LET col=col-6*(col>21)-5*(col>17)-5*(col>12)-6*(col>6)
570 LET col=col*3.1: LET s=1
580 GO TO 100
600 REM landing
620 IF gs<>147 OR vs>10 THEN GO TO 800
630 IF c(line+col)<>1 THEN GO TO 680
640 PRINT AT 21,0;"RESTRICTED LANDING PAD. GO AWAY."
650 FOR i=1 TO 500
660 IF INKEY$="9" THEN LET h=0: GO TO 100
670 NEXT i: GO TO 800
680 PRINT AT 10,7;"GREAT LANDING";AT 11,6;"CONGRATULATIONS!"
690 LET c(line+col)=1: FOR i=1 TO 4: FOR j=0 TO 10: BEEP .08,j: NEXT j: NEXT i: RESTORE 9530: CLS : INK 4
693 LET sc=sc+100
695 LET pad=pad+1: IF pad=5 THEN GO TO 900
696 GO TO 40
700 REM crossing bounds
710 IF ls=9530 THEN LET col=1: GO TO 400
720 LET ls=ls+10
730 IF ls=9590 THEN LET ls=9540
740 CLS : RESTORE ls: INK 4
750 LET col=(ls=9540)+8*(ls=9550)+13*(ls=9560)+18*(ls=9570)+22*(ls=9580): GO TO 530
760 IF ls=9530 THEN LET col=29: GO TO 400
770 LET ls=ls-10
780 IF ls=9530 THEN LET ls=9580
790 CLS : RESTORE ls: INK 4
795 LET col=6*(ls=9540)+12*(ls=950)+17*(ls=9560)+21*(ls=9570)+29*(ls=9580): GO TO 530
800 REM crash
820 PRINT AT line-1,col-1;"/`?";AT line,col-1;"-*.";AT line+1,col-1;"^:*"
830 BEEP .08,0: BEEP .08,5: BEEP .08,3
840 PRINT AT line-1,col-1;" ";AT line,col-1;" ";AT line+1,col-1;" "
850 PRINT AT 10,7;"CRASH LANDED": LET z=z-1: IF z=0 THEN GO TO 870
860 RESTORE 9530: PAUSE 200: CLS : INK 4: GO TO 40
870 PRINT AT 2,10;"Your score: ";sc
875 PRINT AT 10,0;" GAME OVER ";AT 11,11;"Press any key"
880 IF INKEY$<>"" THEN GO TO 880
890 IF INKEY$="" THEN GO TO 890
895 RUN
900 REM finish
905 LET sc=sc+f
910 CLS : INK 7: PRINT AT 5,1;"Well done, you have landed on all the pads with a score of ";AT 8,12; FLASH 1;sc
920 IF z=0 THEN PRINT AT 12,3;"Press any key to start": PAUSE 0: RUN
930 LET z=z+1: LET lv=lv+.5
940 PAUSE 200: CLS : INK 4: GO TO 36
950 PRINT AT 10,7;"OUT OF FUEL": LET Z=0: PAUSE 200
960 GO TO 870
9000 REM lander graphic
9010 FOR i=1 TO 4: READ n$: FOR j=0 TO 7: READ n: POKE USR n$+j,n: NEXT j: NEXT i
9020 DATA "a",BIN 00000101,BIN 00001111,BIN 01101101,BIN 11111100,BIN 11111100,BIN 01101101,BIN 00001111,BIN 00000101
9030 DATA "b",BIN 11100111,BIN 01000010,255,BIN 01111110,BIN 00011000,BIN 00111100,BIN 00111100,BIN 00011000
9040 DATA "c",BIN 10100000,BIN 11110000,BIN 10110110,BIN 00111111,BIN 00111111,BIN 10110110,BIN 11110000,BIN 10100000
9050 DATA "d",BIN 00011000,BIN 00111100,BIN 00111100,BIN 00011000,BIN 01111110,255,BIN 01000010,BIN 11100111
9060 RETURN
9500 REM moonscapes
9510 READ x,y: PLOT x,y
9520 FOR n=0 TO 25: READ h,v: DRAW h,v: NEXT n
9530 DATA 0,31,16,0,16,32,8,0,8,8,16,-48,8,-8,8,0,8,16,16,8,8,16,8,-16,8,0,2,8,2,0,4,8,16,16,8,-24,8,8,8,0,16,-32,8,0,16,40,8,-8,16,-8,8,16,6,-8
9540 DATA 0,31,48,0,48,96,24,0,24,24,48,-128,24,-16,24,0,8,16,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,0,0,0,0,0,0
9550 DATA 0,153,48,-128,22,-18,24,0,24,48,48,24,24,48,24,-48,24,0,6,12,4,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,0,0,0
9560 DATA 0,31,48,24,24,48,22,-56,24,0,6,12,6,0,6,24,48,48,24,-72,24,24,16,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
9570 DATA 0,55,6,24,6,0,12,24,48,48,24,-72,24,24,24,0,48,-96,24,0,32,104,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,0,0
9580 DATA 0,103,40,-96,24,0,56,120,24,-24,48,-24,24,48,32,-24,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,0,0,0,0,0,0,0,0
9999 RETURNNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.