--- title: "Star Trek" id: 57778 type: "computer_media" slug: "star-trek-4" url: "http://localhost/computer_media/star-trek-4/" markdown_url: "http://localhost/computer_media/star-trek-4.md" published_at: "2024-10-26T17:18:23+00:00" modified_at: "2026-03-30T21:16:28+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/7_StrTrk.png" excerpt: "Command the Enterprise across a 5×5 galaxy grid, hunting 15 Klingons with torpedoes, phasers, and impulse drive before time and energy run out." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" - name: "Games" slug: "games" taxonomy: "category" url: "http://localhost/category/software/games/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Game" slug: "game" taxonomy: "genre" url: "http://localhost/type/game/" media_contents: - id: 57780 title: "CassFile2" type: "computer_media" url: "http://localhost/computer_media/cassfile2-2/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/CassFile2%20%28198x%29%28Various%29%28TS1000%29%28US%29%28Program%29.zip/CassFile2%20%28198x%29%28Various%29%28TS1000%29%28US%29%28Program%29%2FB%20Side%2F7_StrTrk.tzx" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/7_StrTrk.png" media_type_tags: "Game, Software" --- # Star Trek This is a text-based Star Trek strategy game in which the player commands the starship Enterprise across a 5×5 sector grid to destroy 15 Klingon cruisers before stardate 3290. The sector map is stored in a two-dimensional array G(N,M) encoding stars, Klingons, and starbases as packed decimal digits (hundreds=starbases, tens=Klingons, units=stars), which are decoded at lines 1220–1250. Player movement uses INKEY$ polling with A/W/D/X keys for impulse drive, while a collision check reads the display file directly via PEEK of system variables at addresses 16398–16399. Commands 1–6 are dispatched by computing a line number from the key’s character code at line 3130. Condition status cycles through GREEN, AMBER, RED, and CRITICAL based on enemy presence and energy levels. *** ## Program Structure The program is divided into clearly separated functional blocks: 1. Lines 50–120: Initialisation, title screen, setup calls, main entry point 2. Lines 600–630: “Press NEWLINE to continue” subroutine used throughout instructions 3. Lines 1000–1199: Game initialisation — dimensions, energy, arrays, random placement of objects 4. Lines 1200–1210: Random coordinate generator (returns A, B in range 1..N, 1..M) 5. Lines 1220–1560: Sector population — decodes packed G(X,Y) value into starbases, Klingons, stars; places them in S(I,J) 6. Lines 2000–2248: Short range scan display 7. Lines 3000–3160: Main command loop — condition display, INKEY$ polling, impulse movement 8. Lines 3200–3292: Warp drive (command 1) 9. Lines 3300–3399: Long range scan (command 2) 10. Lines 3400–3499: Photon torpedo fire (command 3) 11. Lines 3500–3599: Phaser fire (command 4) 12. Lines 3600–3610: Shield energy management (command 5) 13. Lines 3700–3790: Command key display trigger (command 6 path) 14. Lines 3800–3999: Title/splash screen and full instruction set 15. Lines 4000–4090: Klingon attack subroutine 16. Lines 4100–4106: Screen clear (rows 13–21) subroutine 17. Lines 4200–4290: Command key reference display 18. Lines 5000–5049: Docking with starbase (refuel/rearm) 19. Lines 5050–5060: Enterprise crash (collision with non-starbase object) 20. Lines 5100–5110: Time-out game-over message 21. Lines 5500–5525: Zero-energy game-over message 22. Lines 6000–6022: Victory screen and score calculation 23. Lines 6500–6510: Loop back for new game ## Packed Decimal Sector Encoding Each cell of the galaxy array `G(N,M)` stores all three object counts as a single integer using a packed decimal scheme. Hundreds digit = starbases, tens digit = Klingons, units digit = stars. Objects are added at initialisation: stars add 1 (×40 loops), Klingons add 10 (×15 loops), starbases add 100 (×2 loops). Decoding at lines 1220–1240: - `SB = INT(G(X,Y)/100)` — starbase count - `KL = INT((G(X,Y) - SB*100)/10)` — Klingon count - `SA = G(X,Y) - (SB*100 + KL*10)` — star count This is a classic space of the 1970s BASIC Trek encoding, compressing three values into one array slot without using string manipulation. ## Command Dispatch via Computed GOTO At line 3130, numeric command keys 1–6 are dispatched using an arithmetic expression on the key’s character code: `IF CODE(A$)>27 AND CODE(A$)<36 THEN GOTO (((CODE(A$)-29)*100)+3200)` This maps character codes 28–35 to line numbers 3200 (warp), 3300 (LRS), 3400 (torpedoes), 3500 (phasers), 3600 (shields), 3700 (command key). It is an efficient single-line dispatch replacing a chain of IF/GOTO statements, exploiting the contiguous character code layout of digit keys. ## Collision Detection via Display File PEEK Rather than checking the logical `S()` array directly for movement collisions, the program at line 3150 reads the display file directly: `IF PEEK(PEEK 16398 + 256*PEEK 16399) <> 0 THEN GOTO 5000` System variables at addresses 16398–16399 hold the address of the display file cursor (the attribute/character position last targeted by `PRINT AT`). PEEKing that address detects whether the cell is non-blank. This is a low-level technique that bypasses the `S()` array logic, though it duplicates information already present in `S()`. ## Impulse Drive Movement Movement uses a compact INKEY$ idiom at lines 3140–3142: `LET X1=X1+(INKEY$="D" AND X11)` Boolean expressions in Sinclair BASIC evaluate to 1 (true) or 0 (false), so adding/subtracting them adjusts the coordinate in one statement with bounds checking included. The same pattern handles Y movement with W/X keys. ## Condition Status Logic The ship condition variable `C` is set during the short range scan rendering loop (lines 2222–2248). It starts at 1 (GREEN), upgrades to 3 (RED) if a Klingon `S(J,I)=3` is present, to 2 (AMBER) if a starbase `S(J,I)=4` is present (logic appears inverted — RED triggers before AMBER is checked due to `IF C>2` guard at line 2222), and forced to 4 (CRITICAL) at line 2248 if energy `E<50`. CRITICAL triggers the game-over branch at line 3050. ## Notable Bugs and Anomalies - **Line 3430 typo:**`S(TX,T%Y)` contains a spurious `%` character mid-variable name. In Sinclair BASIC this would cause a syntax error or be misread; it should be `S(TX,TY)`. This means hitting a starbase with a torpedo cannot correctly trigger the Spock message and starbase destruction. - **Line 3535 typo:**`GOTO 359\61` contains a ZX81 block graphic escape sequence mid-line-number, likely intended as `GOTO 3591` or `GOTO 3595`. This phaser star-hit branch may jump to an unexpected line. - **Condition colour ordering:** The guard `IF C>2 THEN GOTO 2230` at line 2222 means once RED (C=3) is set, AMBER (C=2) can never be assigned in the same scan, making the condition logic partially one-directional within a single scan pass. - **Shield validation at line 3603:**`IF S<0 OR S>100 AND E>10` has ambiguous precedence — `AND` binds tighter than `OR` in Sinclair BASIC, so this reads as `S<0 OR (S>100 AND E>10)`, meaning negative shield values are always rejected but over-100 values are only rejected when energy is above 10, which is likely not the intended logic. - **Line 3499:**`GOTO 2150` appears after an unconditional `GOTO 3495` chain — it is unreachable dead code. - **Instruction text at line 3930:** spells “INSTRUCIONS” (missing T) in the prompt. - **High score preservation:** Variable `HI` is initialised at line 80 outside the new-game loop (line 6510 returns to line 90), so it correctly persists across multiple plays in the same session. ## Screen and Display Techniques The `%` escape prefix is used extensively throughout `PRINT` statements to produce bright or highlighted characters, giving the game a distinctive appearance. Block graphic characters (`\@@`, `\##`) form the border lines of the short and long range scan grids. The Klingon attack routine at lines 4052–4056 rapidly alternates `FAST`/`SLOW` mode in a short loop to create a screen-flicker effect simulating damage. ## Key Variables Summary | Variable | Purpose | | --- | --- | | `G(N,M)` | Galaxy map — packed decimal encoding of objects per sector | | `S(N,M)` | Current sector contents: 0=empty, 1=Enterprise, 2=star, 3=Klingon, 4=starbase | | `X,Y` | Current sector coordinates | | `X1,Y1` | Enterprise position within sector | | `E` | Energy level (starts 500) | | `T` | Torpedo count (starts 5) | | `S1` | Shield energy level | | `K` | Total Klingons destroyed | | `KL` | Klingons in current sector | | `C` | Condition: 1=GREEN, 2=AMBER, 3=RED, 4=CRITICAL | | `SD` | Stardate counter (game turn count) | | `SX` | Maximum stardates allowed (set to 90) | | `HI` | High score, persists across sessions | ## Source Code ``` 50 SLOW 60 LET SX=90 70 GOSUB 3800 80 LET HI=0 90 FAST 100 GOSUB 1000 110 GOSUB 1220 120 GOTO 2000 600 PRINT AT 21,0;"% % % %P%R%E%S%S% %N%E%W%L%I%N%E% %T%O% %C%O%N%T%I%N%U%E% % % % " 610 INPUT Z$ 620 CLS 630 RETURN 1000 LET E=500 1002 LET ZX=20 1005 LET SD=0 1006 LET K=0 1010 LET S1=0 1020 LET C=1 1021 LET N=5 1022 LET M=N 1024 GOSUB 1200 1030 LET X=A 1040 LET Y=B 1050 LET X1=A 1060 LET Y1=B 1070 LET T=5 1074 RAND 1080 DIM G(N,M) 1090 DIM S(N,M) 1100 FOR I=1 TO 40 1110 GOSUB 1200 1120 LET G(A,B)=G(A,B)+1 1130 NEXT I 1140 FOR I=1 TO 15 1150 GOSUB 1200 1160 LET G(A,B)=G(A,B)+10 1165 NEXT I 1170 FOR I=1 TO 2 1180 GOSUB 1200 1190 LET G(A,B)=G(A,B)+100 1195 NEXT I 1199 RETURN 1200 LET A=INT (RND*N)+1 1202 LET B=INT (RND*M)+1 1210 RETURN 1220 LET SB=INT (G(X,Y)/100) 1230 LET KL=INT ((G(X,Y)-SB*100)/10) 1240 LET SA=G(X,Y)-(SB*100+KL*10) 1250 FOR I=1 TO N 1260 FOR J=1 TO M 1270 LET S(I,J)=0 1280 NEXT J 1290 NEXT I 1300 LET S(X1,Y1)=1 1310 IF SB=0 THEN GOTO 1400 1320 FOR I=1 TO SB 1330 GOSUB 1200 1340 IF S(A,B)<>0 THEN GOTO 1330 1350 LET S(A,B)=4 1360 NEXT I 1400 IF KL=0 THEN GOTO 1500 1410 FOR I=1 TO KL 1420 GOSUB 1200 1430 IF S(A,B)<>0 THEN GOTO 1420 1440 LET S(A,B)=3 1450 NEXT I 1500 IF SA=0 THEN GOTO 2000 1510 FOR I=1 TO SA 1520 GOSUB 1200 1530 IF S(A,B)<>0 THEN GOTO 1520 1540 LET S(A,B)=2 1550 NEXT I 1560 RETURN 2000 CLS 2010 FAST 2100 PRINT AT 0,0;"%S%H%O%R%T% %R%A%N%G%E% %S%C%A%N% % % % % % " 2130 IF K=15 THEN GOTO 6000 2140 PRINT "\@@\@@%1\@@%2\@@%3\@@%4\@@%5\@@\@@" 2150 LET C=1 2151 FOR I=1 TO N 2152 PRINT AT I*2-1,0;"\@@\@@";AT I*2-1,11;"\@@\@@" 2160 PRINT AT I*2,0;I;"\@@";AT I*2,11;"\@@";I 2170 FOR J=1 TO M 2180 IF S(J,I)=0 THEN PRINT AT I*2,J*2;" "; 2190 IF S(J,I)=1 THEN PRINT AT I*2,J*2;"%E"; 2200 IF S(J,I)=2 THEN PRINT AT I*2,J*2;"*"; 2210 IF S(J,I)=3 THEN PRINT AT I*2,J*2;"+"; 2220 IF S(J,I)=4 THEN PRINT AT I*2,J*2;"X"; 2222 IF C>2 THEN GOTO 2230 2225 IF S(J,I)=3 THEN LET C=3 2226 IF S(J,I)=4 THEN LET C=2 2230 NEXT J 2240 NEXT I 2245 PRINT AT 11,0;"\@@\@@%1\@@%2\@@%3\@@%4\@@%5\@@\@@" 2248 IF E<50 THEN LET C=4 3000 PRINT AT 0,ZX;"%C%O%N%D%I%T%I%O%N% % % "; 3002 LET SD=SD+1 3003 PRINT AT 1,20;"% % % % % % % % % % % % ";AT 2,20;"\@@\@@\@@\@@\@@\@@\@@\@@\;;\@@\@@\@@";AT 9,20;"\@@\@@\@@\@@\@@\@@\@@\@@\@@\@@\@@\@@" 3010 IF C=1 THEN PRINT AT 1,20;"%G%R%E%E%N" 3020 IF C=2 THEN PRINT AT 1,20;"%A%M%B%E%R" 3030 IF C=3 THEN PRINT AT 1,20;"%R%E%D" 3040 IF C=4 THEN PRINT AT 1,20;"%C%R%I%T%I%C%A%L" 3050 IF C=4 THEN GOTO 5500 3060 PRINT AT 3,20;"%E%N%E%R%G%Y% % ";INT (E) 3070 PRINT AT 4,20;"%S%H%E%I%L%D%S% ";S1 3080 PRINT AT 5,20;"%T%O%R%P%E%D%O%E%S";T 3090 PRINT AT 6,20;"%S%E%C%T%O%R% % ";X;"\##";Y 3100 PRINT AT 7,20;"%S%T%A%R%D%A%T%E";SD+3200 3110 PRINT AT 8,20;"%K%L%I%N%G%O%N%S";15-K;" " 3111 IF SD>SX THEN GOTO 5100 3112 SLOW 3113 IF K=15 THEN GOTO 6000 3114 GOSUB 4100 3120 LET A$=INKEY$ 3130 IF CODE (A$)>27 AND CODE (A$)<36 THEN GOTO (((CODE (A$)-29)*100)+3200) 3135 PRINT AT Y1*2,X1*2;" " 3136 LET S(X1,Y1)=0 3140 LET X1=X1+(INKEY$="D" AND X11) 3142 LET Y1=Y1+(INKEY$="X" AND Y11) 3145 PRINT AT Y1*2,X1*2; 3150 IF PEEK (PEEK 16398+256*PEEK 16399)<>0 THEN GOTO 5000 3154 PRINT AT Y1*2,X1*2;"%E" 3155 LET E=E-1 3156 LET S(X1,Y1)=1 3157 PRINT AT 3,28;INT E;" " 3158 IF E<1 THEN GOTO 5500 3159 IF RND>.7 AND C=3 THEN GOSUB 4000 3160 GOTO 3120 3200 PRINT AT 17,0;"%W%A%R%P% %D%R%I%V%E% %E%N%G%A%G%E%D" 3201 PRINT "%E%N%T%E%R% %S%E%C%T%O%R% %C%O%O%R%D%I%N%A%T%E%S" 3210 INPUT A 3220 LET X=INT (A/10) 3230 LET Y=A-X*10 3240 IF X<1 OR X>M OR Y<1 OR Y>N THEN GOTO 3000 3250 LET E=E-5 3260 GOSUB 1200 3270 LET X1=A 3280 LET Y1=B 3290 GOSUB 1220 3292 GOTO 2000 3300 CLS 3301 FAST 3302 PRINT "%L%O%N%G% %R%A%N%G%E% %S%C%A%N" 3310 PRINT "\@@\@@\@@\@@\@@%1\@@\@@\@@\@@%2\@@\@@\@@\@@%3\@@\@@\@@\@@%4\@@\@@\@@\@@%5\@@\@@\@@\@@\@@\@@" 3320 FOR I=1 TO N 3321 PRINT AT I*2-1,0;"\@@\@@\@@";AT I*2-1,30;"\@@\@@" 3330 PRINT AT I*2,0;"\@@";I;"\@@";AT I*2,30;"\@@\@@" 3340 FOR J=1 TO M 3350 PRINT AT I*2,J*5;G(J,I); 3355 IF G(J,I)<100 THEN PRINT " "; 3360 IF G(J,I)<10 THEN PRINT " "; 3370 NEXT J 3380 NEXT I 3381 PRINT AT 11,0;"\@@\@@\@@\@@\@@%1\@@\@@\@@\@@%2\@@\@@\@@\@@%3\@@\@@\@@\@@%4\@@\@@\@@\@@%5\@@\@@\@@\@@\@@\@@" 3382 PRINT AT 20,0;"%E%N%T%E%R%P%R%I%S%E% %I%N% %S%E%C%T%O%R% ";X;"\##";Y 3383 PRINT AT 16,0;"%K%E%Y% %T%O% %T%O%N%G% %R%A%N%G%E% %S%C%A%N%N%E%R";AT 17,0;"123 = 1 STARBASE, 2 KLINGONS AND 3 STARS IN THIS SECTOR." 3385 SLOW 3390 PAUSE 1000 3399 GOTO 2000 3400 IF T>0 THEN GOTO 3405 3402 PRINT AT 17,0;"%O%U%T% %O%F% %P%H%O%T%O%N% %T%O%R%P%E%D%O%E%S" 3404 GOTO 3494 3405 LET T=T-1 3406 PRINT AT 15,0;"%P%H%O%T%O%N% %T%O%R%P%E%D%O% %A%R%M%E%D" 3407 PRINT AT 15,22;"4";AT 16,21;"3:5";AT 17,20;"2-X-6";AT 18,21;"1:7";AT 19,22;"0" 3408 PRINT AT 17,0;"%E%N%T%E%R% %L%A%U%N%C%H% %A%N%G%L%E" 3409 INPUT A 3410 IF A<0 OR A>7 THEN GOTO 3409 3412 PRINT "%T%R%A%C%K%I%N%G% %T%O%R%P%E%D%O" 3415 LET TX=X1 3416 LET TY=Y1 3420 PRINT TX;"%>";TY;"%/"; 3422 IF S(TX,TY)<2 THEN GOTO 3450 3424 IF S(TX,TY)=2 THEN PRINT AT 21,0;"%S%T%A%R% %H%I%T" 3425 IF S(TX,TY)=2 THEN GOTO 3495 3426 IF S(TX,TY)=3 THEN PRINT AT 21,0;"%K%L%I%N%G%O%N% %D%E%S%T%R%O%Y%E%D" 3427 IF S(TX,TY)=3 THEN LET G(X,Y)=G(X,Y)-10 3428 IF S(TX,TY)=3 THEN LET KL=KL-1 3429 IF S(TX,TY)=3 THEN LET K=K+1 3430 IF S(TX,T%Y)=4 THEN GOSUB 4100 3432 IF S(TX,TY)=4 THEN PRINT AT 14,0;"%S%P%O%C%K% %T%O% %C%A%P%T%A%I%N%:% %Y%O%U% %H%A%V%E% %J%U%S%T% %D%E%S%T%R%O%Y%E%D% %A% %F%E%D%E%R%A%T%I%O%N% %S%T%I%R%B%A%S%E% %I%S% %T%H%I%S% %A% %P%L%O%Y% %T%O% %F%O%O%L% %T%H%E% % % % % % %K%L%I%N%G%O%N%S% % %O%R% %H%A%S% %T%H%E% %S%T%R%A%I%N% %O%F% % %B%E%I%N%G% %A% %S%T%A%R%S%H%I%P% %C%A%P%T%A%I%N% %D%R%I%V%E%N% %Y%O%U% %M%A%D%.%.%." 3435 IF S(TX,TY)=4 THEN LET G(X,Y)=G(X,Y)-100 3440 LET S(TX,TY)=0 3441 GOTO 3495 3450 LET TX=TX+(A=5)+(A=6)+(A=7)-(A=1)-(A=2)-(A=3) 3455 LET TY=TY+(A=0)+(A=1)+(A=7)-(A=3)-(A=4)-(A=5) 3460 IF TY<1 OR TY>N OR TX<1 OR TX>M THEN GOTO 3490 3465 GOTO 3420 3490 PRINT AT 21,0;"%M%I%S%S%E%D" 3493 IF KL>0 THEN GOSUB 4000 3494 GOTO 3000 3499 GOTO 2150 3500 PRINT AT 17,0;"%P%H%A%S%E%R%S% %R%E%A%D%Y" 3502 PRINT "%E%N%T%E%R% %T%A%R%G%E%T% %A%N%G%L%E" 3503 PRINT AT 15,22;"4";AT 16,21;"3:5";AT 17,20;"2-X-6";AT 18,21;"1:7";AT 19,22;"0" 3505 INPUT A 3506 IF A<0 OR A>7 THEN GOTO 3505 3520 LET TX=X1 3522 LET TY=Y1 3524 LET E=E-15 3528 IF S(TX,TY)<2 THEN GOTO 3550 3530 IF S(TX,TY)=2 THEN PRINT "%S%T%A%R% %H%I%T" 3535 IF S(TX,TY)=2 THEN GOTO 359\61 3538 IF S(TX,TY)>3 THEN PRINT "%S%T%A%R% %B%A%S%E% %H%I%T" 3539 IF S(TX,TY)>3 THEN GOTO 3595 3540 PRINT "%K%L%I%N%G%O%N% %H%I%T% "; 3541 IF RND>.5 THEN GOTO 3549 3542 PRINT "%A%N%D% %D%E%S%T%R%O%Y%E%D" 3543 LET KL=KL-1 3544 LET S(TX,TY)=0 3545 LET G(X,Y)=G(X,Y)-10 3546 LET K=K+1 3547 GOTO 2150 3549 GOTO 3595 3550 LET TX=TX+(A=5)+(A=6)+(A=7)-(A=1)-(A=2)-(A=3) 3555 LET TY=TY+(A=0)+(A=1)+(A=7)-(A=3)-(A=4)-(A=5) 3560 IF TY<1 OR TY>N OR TX<1 OR TX>M THEN GOTO 3590 3565 GOTO 3528 3590 PRINT "%M%I%S%S%E%D" 3595 IF KL>0 AND RND>.4 THEN GOSUB 4000 3599 GOTO 3000 3600 PRINT AT 17,0;"%E%N%T%E%R% %E%N%E%R%G%Y% %S%U%P%P%L%I%E%D% %T%O% %S%H%E%I%L%D%S" 3602 INPUT S 3603 IF S<0 OR S>100 AND E>10 THEN GOTO 3602 3604 LET E=E+(S1-S) 3605 LET S1=S 3606 PRINT AT 4,28;INT S1;" " 3608 PRINT AT 3,28;INT (E);" " 3610 GOTO 3000 3700 GOSUB 4200 3710 GOTO 3114 3790 RETURN 3800 CLS 3918 PRINT AT 0,12;"%S%T%A%R%T%R%E%K";AT 10,4;"%T%H%E% %S%T%A%R%S%H%I%P% %E%N%T%E%R%P%R%I%S%E" 3919 PRINT AT 5,6;"-\.:\@@%E\@@\;;\;;\:. \. \:'% % % ";AT 4,7;" \.'\''\''\''\'.";AT 6,8;"\'.\!!\!!\!!% % \:. \.:% \!!\!!\~~";AT 7,13;"\~~\;;\;;\;;\~~\~~" 3930 PRINT AT 21,0;"%D%O% %Y%O%U% %W%A%N%T% %I%N%S%T%R%U%C%I%O%N%S% %(%Y% %O%R% %N%)" 3932 INPUT Z$ 3934 IF Z$<>"Y" THEN RETURN 3950 CLS 3951 PRINT "%S%T%A%R%T%R%E%K% %I%N%S%T%R%U%C%T%I%O%N%S" 3952 PRINT AT 3,0;"YOU,AS CAPTAIN OF THE FEDERATIONSTARSHIP %E%N%T%E%R%P%R%I%S%E, MUST RID THE GALAXY OF 15 INVADING KLINGON SPACE CRUISERS." 3953 GOSUB 600 3954 PRINT "YOUR COMMANDS ARE ENTERED AS A NUMBER. THEY ARE AS FOLLOWS:" 3956 PRINT "1. WARP DRIVE. ENTER THE COORDINATES OF THE SECTOR YOU WISH TO GO TO AS A 2 DIGIT NO. X COORDINATE THEN Y COORDINATE. EG:23(NEWLINE) FOR SECTOR 2,3" 3958 GOSUB 600 3960 PRINT "2. LONG ZANGE SCAN SHOWS THE GALAXY AS A 5 BY 5 SERIES OF SECTORS. FOR EACH SECTOR, THERE IS A NUMBER. THE DIGIT AT THE RIGHT IS THE NUMBER OF STARS IN THE SECTOR. IF THERE IS A DIGIT TO THE LEFT OF THIS, IT IS THE NUMBER OF KLINGONS IN THE SECTORIF THERE IS A FURTHER NUMBER TO THE LEFT,IT IS THE NUMBER OF STARBASES IN THE SECTOR." 3961 PRINT 3962 PRINT "THUS 231 MEANS 1 STAR,3 KLINGONS AND 2 STARBASES AND 25 MEANS 5 STARS AND 2 KLINGONS." 3963 GOSUB 600 3965 PRINT "3.PHOTON TORPEDOES. ENTER THE ANGLE YOU WISH TO FIRE YOUR TORPEDO IN ACCORDANCE WITH THE CHART DISPLAYED. A HIT WITH A TORPEDO WILL ALWAYS DESTROY THE TARGET." 3966 PRINT "REMEMBER YOU ONLY HAVE A LIMITED NUMBER OF TORPEDOES." 3967 PRINT AT 15,22;"4";AT 16,21;"3:5";AT 17,20;"2-X-6";AT 18,21;"1:7";AT 19,22;"0" 3968 GOSUB 600 3970 PRINT "4. PHASERS. THESE ARE ENERGY WEAPONS AND DO NOT ALWAYS DESTROY THE TARGET. ENTER THE ANGLE YOU WISH TO FIRE IN THE SAME WAY AS TORPEDOES." 3972 PRINT 3974 PRINT "5. SHIELDS. ENTER THE ENERGY YOUWANT TO DIVERT TO YOUR DEFENSIVE SHIELDS BETWEEN 0 AND 100 UNITS." 3975 GOSUB 600 3976 PRINT "6. COMMAND KEY. THIS IS AN AID FOR REMEMBERING THE COMMANDS AVAILABLE. PRESS 6 AND THE FOLLOWING IS DISPLAYED." 3977 GOSUB 4100 3978 GOSUB 4200 3979 GOSUB 600 3980 PRINT "MOST COMMANDS DRAIN ENERGY AND YOU WILL USE ENERGY JUST TO MAINTAIN LIFE SUPPORT SYSTEMS. THE GAME ENDS IF YOU RUN OUT OF ENERGY OR TIME OR IF YOU DESTROY ALL THE KLINGONS." 3981 PRINT 3982 PRINT "YOU CAN MOVE AROUND THE SECTOR AS SHOWN ON THE SHORT RANGE SCAN BY USING KEYS A,D,W,X TO PROVIDE IM\75ULSE DRIVE. THIS MAY BE NECESSARY TO ACHIEVE A GOOD POSITION FROM WHICH TO ATTACK." 3983 GOSUB 600 3985 PRINT "WHEN YOU MOVE USING IMPULSE DRIVE AVOID COLLISIONS WITH STARS * AND KLINGONS +. IF YOU MOVE ONTO A STARBASE YOU WILL BEREFUELLED AND REARMED AND YOUR ENERGY CELLS WILL BE REPLENISHED" 3986 PRINT 3987 PRINT "%W%A%R%N%I%N%G% %K%L%I%N%G%O%N%S% %A%T%T%A%C%K% %W%I%T%H%O%U%T% %P%R%O%V%O%C%A%T%I%O%N%." 3988 PRINT "KEY TO SYMBOLS IN SHORT RANGE SCAN. %E ENTERPRISE + KLINGON * STAR X STARBASE" 3989 GOSUB 600 3990 PRINT "INITIALLY AND DURING MANOEUVRES AND SCANNING THE SCREEN WILL BLANK.PLEASE WAIT FOR DISPLAY TO REAPPEAR." 3992 PRINT 3995 PRINT "THE COMMAND KEYS WILL BE SLOW TO RESPOND SO HOLD DOWN UNTIL THE ENTERPRISE RESPONDS." 3996 GOSUB 600 3997 PRINT "YOUR MISSION CAPTAIN IS NOT EASYTO SUCCEED YOU MUST USE YOUR SHIP AND STARBASES EFFICIENTLY AND MAKE QUICK DECISIONS. YOU HAVE UNTIL STARDATE ";3200+SX;" TO\' DESTROY THE EVIL KLINGONS. %G%O%O%D% %L%U%C%K" 3998 GOSUB 600 3999 RETURN 4000 PRINT AT 14,0;"%K%L%I%N%G%O%N% %S%H%I%P% %F%I%R%I%N%G% " 4020 PRINT "%D%A%M%A%G%E% %S%U%S%T%A%I%N%E%D% "; 4030 LET D=INT (RND*65+5-S1/2) 4040 IF D<5 THEN LET D=5 4050 PRINT D;"% %U%N%I%T%S" 4052 FOR J=1 TO 6 4054 FAST 4055 SLOW 4056 NEXT J 4060 LET E=E-D 4070 GOSUB 4100 4090 RETURN 4100 FOR J=21 TO 13 STEP -1 4102 PRINT AT J,0;"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % " 4105 NEXT J 4106 RETURN 4200 PRINT AT 13,0;"\##\##\##%C%O%M%M%A%N%D% %K%E%Y\##\##\##" 4210 PRINT "\##%1\##%W%A%R%P% %D%R%I%V%E% \##%2\##%L%O%N%G% %R%A%N%G%E% %S%C%A%N" 4220 PRINT "\##%3\##%T%O%R%P%E%D%O%E%S% % \##%4\##%P%H%A%S%E%R%S" 4230 PRINT "\##%5\##%E%N%E%R%G%Y% %D%I%V%E%R%T%E%D% %T%O% %S%H%I%E%L%D%S" 4240 PRINT "\##%6\##%C%O%M%M%A%N%D% %K%E%Y%S% %A%V%A%I%L%A%B%L%E" 4250 PRINT "\##%7\##%S%H%I%P%S% %O%P%E%R%A%T%I%N%G% %M%A%N%U%A%L% % % " 4251 PRINT "%A%,%X%,%D%,%W% %I%M%P%U%L%S%E% %D%R%I%V%E% %O%N%L%Y% % % % % % " 4252 PRINT "%S%Y%M%B%O%L%S%:%E%=%E%N%T%E%R%P%R%I%S%E% %+%=%K%L%I%N%G%O%N% % % % % % % % % % %*%=%S%T%A%R% % % % % % % %X%=%S%T%A%R%B%A%S%E" 4270 PAUSE 1000 4290 RETURN 5000 IF S(X1,Y1)<>4 THEN GOTO 5050 5001 LET T=5 5002 LET E=500 5003 PRINT AT 14,0;"%E%N%T%E%R%P%R%I%S%E% %D%O%C%K%E%D%,%R%E%A%R%M%E%D% %A%N%D% % % %R%E%F%U%E%L%L%E%D%.% %R%E%A%D%Y% %T%O% %C%O%N%T%I%N%U%E% % % % %M%I%S%S%I%O%N%." 5010 LET SD=SD+10 5020 LET S1=0 5030 LET S=0 5049 GOTO 3000 5050 PRINT AT 14,0;"% %E%N%T%E%R%P%R%I%S%E% %C%R%A%S%H%E%D% " 5060 GOTO 6010 5100 PRINT AT 13,0;"%Y%O%U% %H%A%V%E% %R%U%N% %O%U%T% %O%F% %T%I%M%E% %A%N%D% % % % %A%S% %A% %R%E%S%U%L%T% %O%F% %Y%O%U%R% %F%A%I%L%U%R%E% %T%H%E% %K%L%I%N%G%O%N%S% %H%A%V%E% %O%V%E%R%R%U%N% %T%H%I%S% % % % % % %Q%U%A%D%R%A%N%T% %O%F% %T%H%E% %G%A%L%A%X%Y%." 5110 GOTO 6010 5500 PRINT AT 13,0;"%Z%E%R%O% %E%N%E%R%G%Y% %S%T%A%T%U%S% %L%I%F%E% %S%U%P%P%O%R%T% %S%Y%S%T%E%M%S% %F%A%I%L%U%R%E%." 5512 PRINT "KLINGONS DESTROYED ";K 5515 PRINT "%T%H%E% %R%E%M%A%I%N%I%N%G% %K%L%I%N%G%O%N%S% %W%I%L%L% %O%V%E%R%R%U%N% %T%H%E% %G%A%L%A%X%Y%." 5525 GOTO 6010 6000 CLS 6005 PRINT "%C%O%N%G%R%A%T%U%L%A%T%I%O%N%S%.% %Y%O%U% %C%O%M%P%L%E%T%E%D% % %Y%O%U%R% %M%I%S%S%I%O%N% %A%N%D% %S%A%V%E%D% %T%H%E% % % % % % %F%E%D%E%R%A%T%I%O%N% %F%R%O%M% %T%H%E% %T%Y%R%A%N%N%Y% %O%F% % %T%H%E% %E%V%I%L% %K%L%I%N%G%O%N%S%." 6020 PRINT "%Y%O%U%R% %S%C%O%R%E% %C%A%P%T%A%I%N% %W%A%S% ";(100-SD)*K 6021 IF HI<((100-SD)*K) THEN LET HI=((100-SD)*K) 6022 PRINT "%H%I%G%H%E%S%T% %S%C%O%R%E%=";HI 6500 GOSUB 600 6510 GOTO 90 ```