Space Crisis is an educational quiz game in which players must correctly name planets of the solar system to decelerate a starship from 18,000 MPH to 1,000 MPH before the ship’s calculated speed also drops to 1,000 MPH — a race against a dual-speed countdown that determines whether the crew survives or crashes on Moonbase 2. The program draws a schematic starfield/ship display using individual PLOT commands to render horizontal and vertical boundary lines on the low-resolution graphics screen. Question selection uses a computed GOTO via LET Q=1200+(QR*4) followed by GOTO Q, routing to one of 27 question blocks covering all nine classical planets (including Pluto). The narrative is delivered through a subroutine at line 2000 that clears the ship’s interior text area by printing blank strings across rows 2–15 in FAST mode, preserving the plotted border graphics. A replay flag variable P at line 18 is used to skip the introductory story sequence on subsequent playthroughs.
Program Analysis
Program Structure
The program is divided into clearly separated narrative and gameplay phases, linked by subroutines and computed jumps. The main flow is:
- Initialisation (lines 18–44): All variables zeroed;
SA(actual speed) andSC(calculated speed) both set to 18000. - Screen setup and starfield drawing (lines 165–320): Plots border and grid lines using nested
FOR/NEXTloops with individualPLOTcalls. - Introductory story sequence (lines 322–550): Multi-screen narrative in SLOW mode with
PAUSEdelays; skipped on replay via flagP=1. - Question loop (lines 990–1465): Core gameplay — question selection, display, answer input, speed adjustment, win/loss detection.
- Subroutines: screen-clear (2000), crash message (2500), improper-input handler (3000), play-again (3500).
Computed GOTO for Question Dispatch
The most technically notable feature is the question-routing mechanism. A random number QR is drawn from 1–27, and the correct planet name string Q$ is set by a chain of IF tests (lines 1025–1065). The target line number is then computed:
LET Q=1200+(QR*4) followed by GOTO Q
This maps each of the 27 question slots to a line in the range 1204–1308 in steps of 4, giving three questions per planet. The line numbers 1200, 1204, 1208… 1308 must therefore exist exactly at those values, which they do. This is an efficient dispatch table implemented entirely in BASIC arithmetic.
Dual-Speed Countdown Mechanic
Two speed variables drive the win/loss condition:
| Variable | Label | Starting Value | Decrement |
|---|---|---|---|
SA | SPEED(ACT) — actual speed | 18000 | −1000 per correct answer |
SC | SPEED(CAL) — calculated speed | 18000 | −500 per question (right or wrong) |
The win condition at line 1390 is SA<=1000 AND SC>=1000 — the player must reduce actual speed to 1000 MPH before the calculated speed falls below 1000 MPH. Since SC drops twice as fast per question as SA drops per correct answer (500 vs 1000), wrong answers are especially costly: the calculated speed still drops while the actual speed does not. The player therefore has at most 34 questions before SC reaches 1000 (18000/500 = 36 steps minus the initial pause steps), requiring at least 17 correct answers.
Screen-Clear Subroutine
Rather than using CLS (which would erase the plotted border graphics), the subroutine at line 2000 blanks only rows 2–15 by printing a 29-space string at each row in FAST mode. The loop increments H from 2 upward and exits at H>=16. This preserves the PLOT-drawn frame while refreshing the text area for each new narrative screen.
Replay Mechanism
The flag variable P is set to 1 at line 3570 when the player chooses to replay. On re-entry at line 20, the initialisation resets speeds and counters but not P itself (it is reset to 0 in the main init block at line 20, then re-checked at line 323: IF P=1 THEN GOTO 990). However, P is set to 0 at line 20 (LET A=0… LET P=0), so the skip will never trigger — this is a bug. The intent was presumably to jump past the long story sequence on subsequent plays, but because P is zeroed before the check, the full intro always replays.
Question Repeat Prevention
Line 1015 checks IF QR=K THEN GOTO 1010, where K holds the previous question number. This prevents the same question from appearing twice in a row, though it does not prevent longer-range repeats across the game session.
Key BASIC Idioms
FAST/SLOWmode switching is used extensively — FAST for PLOT-intensive drawing and text-clearing loops, SLOW for narrativePRINTandPAUSEsequences.- The improper-input handler at line 3000 is a subroutine called from multiple input validation points (lines 920, 3550), providing a consistent “IMPROPER INPUT” response.
INPUT B$followed by string comparison against “Y”/”N” is the standard ZX81 menu idiom used at lines 880–930 and 3520–3560.- The
TABkeyword withinPRINTstatements (lines 322, 398) is used to align the three-column status bar at the bottom of the screen.
Anomalies and Notes
- Line 1360 (
IF A$<>Q$ THEN GOTO 1390) is redundant — after line 1355 branches away on equality, execution always reaches 1360 when the answer is wrong, making the conditional unnecessary. - Line 1450 (
IF SC<1000 THEN GOSUB 2500at line 1440) is followed byGOSUB 3500at line 1445 without aRETURNguard, meaning the play-again sequence always runs after a crash, which is correct behaviour. - Lines 3585–3600 (
CLEAR,SAVE,RUN) are unreachable dead code, never called from any branch in the program. - The variable
His reused for two unrelated purposes: row counter in the starfield drawing loops (lines 339–392) and row counter in the screen-clear subroutine (line 2020). This is safe because the subroutine reinitialisesH=2at entry.
Content
Source Code
1 REM "SPACE CRISIS"
2 REM
3 REM RONALD DUGUID
4 REM SYNC MAGAZINE
5 REM JANUARY/FEBRUARY 1983
6 REM
18 LET P=0
20 LET A=0
22 LET G=0
24 LET H=0
26 LET J=0
28 LET K=0
32 LET M=0
34 LET N=0
38 LET Q=0
40 LET SA=18000
42 LET SC=18000
44 LET QR=0
165 CLS
170 FAST
175 FOR A=1 TO 60
180 PLOT A,41
185 NEXT A
190 FOR A=1 TO 60
195 PLOT A,10
200 NEXT A
205 FOR A=1 TO 60
210 PLOT A,4
215 NEXT A
220 FOR A=1 TO 60
225 PLOT A,0
230 NEXT A
235 FOR A=1 TO 4
240 PLOT 1,A
245 NEXT A
250 FOR A=1 TO 4
255 PLOT 22,A
260 NEXT A
265 FOR A=1 TO 4
270 PLOT 44,A
275 NEXT A
280 FOR A=1 TO 4
285 PLOT 60,A
290 NEXT A
295 FOR A=1 TO 31
300 PLOT 1,10+A
305 NEXT A
310 FOR A=1 TO 31
315 PLOT 60,10+A
320 NEXT A
322 PRINT AT 18,1;"SPEED(ACT)";TAB 12;"SPEED(CAL)";TAB 23;"CONTROL"
323 IF P=1 THEN GOTO 990
324 PRINT AT 20,1;"HYPER-WARP";TAB 12;"HYPER-WARP";TAB 23;"ALEC"
325 PAUSE 750
330 SLOW
333 PRINT AT 3,2;"ALEC HERE-PREPARE TO LEAVE"
334 PRINT AT 4,2;"HYPER-WARP. NORMAL SPACE"
335 PRINT AT 5,2;"IN 27 SECONDS"
337 PAUSE 350
338 FAST
339 LET H=1
340 FOR G=1 TO 29
342 LET J=INT (RND*10)+1
344 IF J=1 THEN GOTO 350
346 IF J>=2 THEN GOTO 355
350 PRINT AT H,G;"%*"
352 GOTO 360
355 PRINT AT H,G;"% "
360 IF G<=28 THEN GOTO 390
370 LET H=H+1
375 IF H>=17 THEN GOTO 392
380 GOTO 340
390 NEXT G
396 LET C$="BRIDGE"
398 PRINT AT 20,1;SA;TAB 6;"/MPH ";TAB 12;SC;TAB 17;"/MPH ";TAB 23;C$
400 PAUSE 500
405 SLOW
410 PRINT AT 2,2;"ALEC HERE-WE HAVE EMERGED"
420 PRINT AT 3,2;"FROM HYPER-WARP AND ARE"
430 PRINT AT 4,2;"NOW MOVING AT A SUB-LIGHT"
440 PRINT AT 5,2;"SPEED OF 18000/MPH. WE ARE"
450 PRINT AT 6,2;"APPROACHING OUR SOLAR"
460 PRINT AT 7,2;"SYSTEM. I WILL TAKE"
470 PRINT AT 8,2;"CONTROL OF THE SHIP FOR"
480 PRINT AT 9,2;"DECELERATION TO DOCKING"
490 PRINT AT 10,2;"APPROACH FOR MOON BASE 2."
495 PRINT AT 20,23;"ALEC "
500 PRINT AT 11,2;"I WILL DE-CONTROL AT 1000"
510 PRINT AT 12,2;"MPH TO LET THE DOCKING"
520 PRINT AT 13,2;"COMPUTER TAKE CONTROL OF"
530 PRINT AT 14,2;"THE SHIP. OUR ETA IS--AWK?"
540 PRINT AT 15,2;"**MARY HAD A??1+1=2//BLEEP??"
550 PAUSE 1500
553 LET H=2
555 GOSUB 2000
640 PRINT AT 2,2;"PROFESSOR CYPHER HERE-ALEC,"
650 PRINT AT 3,2;"YOU HAVE NOT BEEN STUDYING"
660 PRINT AT 4,2;"YOUR INFORMATION TAPES."
670 PRINT AT 5,2;"YOU HAVE WRONG ANSWERS ON"
680 PRINT AT 6,2;"ALL THE QUESTIONS ABOUT"
690 PRINT AT 7,2;"OUR SOLAR SYSTEM. YOU WILL"
700 PRINT AT 8,2;"HAVE TO DO THEM OVER."
710 PRINT AT 10,2;"CAN THE CREW HELP ME?"
720 PRINT AT 12,2;"OF COURSE THEY CAN. AND, IF"
730 PRINT AT 13,2;"THE ANSWERS ARE CORRECT, YOU"
740 PRINT AT 14,2;"CAN CONTROL THE SHIP."
750 PAUSE 1000
760 GOSUB 2000
770 PRINT AT 2,2;"YES, PROFESSOR, AND FOR A"
780 PRINT AT 3,2;"CORRECT ANSWER, I WILL"
790 PRINT AT 4,2;"DECELERATE THE SPEED BY"
800 PRINT AT 5,2;"1000 MPH. THEY MUST REDUCE"
810 PRINT AT 6,2;"THE SHIP SPEED TO 1000 MPH"
820 PRINT AT 7,2;"BEFORE THE CALCULATED SPEED"
830 PRINT AT 8,2;"REACHES 1000 MPH, OR THEY"
840 PRINT AT 9,2;"WILL CRASH ON MOONBASE 2."
850 PRINT AT 11,2;"QUESTIONS ARE ANSWERED BY"
860 PRINT AT 12,2;"ENTERING A PLANET NAME."
870 PRINT AT 14,2;"ARE YOU READY CREW? Y OR N"
880 INPUT B$
890 IF B$="Y" THEN GOTO 990
900 IF B$="N" THEN GOTO 940
920 IF B$<>"N" THEN GOSUB 3000
930 GOTO 870
940 GOSUB 2500
950 GOTO 3500
990 PRINT AT 20,23;" "
992 PRINT AT 20,1;SA;TAB 6;"/MPH ";TAB 12;SC;TAB 17;"/MPH ";TAB 23;"ALEC"
1000 GOSUB 2000
1003 PRINT AT 2,1;"NAME THE PLANET THAT:"
1010 LET QR=INT (RND*27)+1
1015 IF QR=K THEN GOTO 1010
1020 LET K=QR
1025 IF QR<=3 THEN LET Q$="MERCURY"
1030 IF QR>3 AND QR<=6 THEN LET Q$="VENUS"
1035 IF QR>6 AND QR<=9 THEN LET Q$="EARTH"
1040 IF QR>9 AND QR<=12 THEN LET Q$="MARS"
1045 IF QR>12 AND QR<=15 THEN LET Q$="JUPITER"
1050 IF QR>15 AND QR<=18 THEN LET Q$="SATURN"
1055 IF QR>18 AND QR<=21 THEN LET Q$="URANUS"
1060 IF QR>21 AND QR<=24 THEN LET Q$="NEPTUNE"
1065 IF QR>24 AND QR<=27 THEN LET Q$="PLUTO"
1070 LET Q=1200+(QR*4)
1075 GOTO Q
1200 REM %S%O%L%A%R% %Q%U%E%S%T%I%O%N%S% % % % % % % %
1204 PRINT AT 3,2;"IS FIRST IN LINE FROM THE"
1205 PRINT AT 4,2;"SUN."
1207 GOTO 1350
1208 PRINT AT 3,2;"REVOLVES AROUND THE SUN ONCE"
1209 PRINT AT 4,2;"EVERY 88 DAYS."
1211 GOTO 1350
1212 PRINT AT 3,2;"HAS A SURFACE TEMPERATURE OF"
1213 PRINT AT 4,2;"430 DEG. C ON THE DAY SIDE;"
1214 PRINT AT 5,2;"-170 C ON THE NIGHT SIDE."
1215 GOTO 1350
1216 PRINT AT 3,2;"IS 2ND IN LINE FROM THE SUN."
1219 GOTO 1350
1220 PRINT AT 3,2;"IS COVERED WITH THICK CLOUDS"
1221 PRINT AT 4,2;"OF SULFURIC ACID."
1223 GOTO 1350
1224 PRINT AT 3,2;"REVOLVES AROUND THE SUN ONCE"
1225 PRINT AT 4,2;"EVERY 225 DAYS."
1227 GOTO 1350
1228 PRINT AT 3,2;"IS 3RD IN LINE FROM THE SUN."
1231 GOTO 1350
1232 PRINT AT 3,2;"IS THE ONLY PLANET KNOWN TO"
1233 PRINT AT 4,2;"SUPPORT LIFE."
1235 GOTO 1350
1236 PRINT AT 3,2;"IS 149,600,000 KM FROM THE"
1237 PRINT AT 4,2;"SUN. (APPROX. 93 MILLION"
1238 PRINT AT 5,2;"MILES.)"
1239 GOTO 1350
1240 PRINT AT 3,2;"IS 4TH IN LINE FROM THE SUN."
1243 GOTO 1350
1244 PRINT AT 3,2;"IS KNOWN AS-THE RED PLANET."
1247 GOTO 1350
1248 PRINT AT 3,2;"HAS A VARIABLE SURFACE"
1249 PRINT AT 4,2;"TEMPERATURE AVERAGING MINUS"
1250 PRINT AT 5,2;"50 DEG C."
1251 GOTO 1350
1252 PRINT AT 3,2;"IS 5TH IN LINE FROM THE SUN."
1255 GOTO 1350
1256 PRINT AT 3,2;"REVOLVES AROUND THE SUN ONCE"
1257 PRINT AT 4,2;"EVERY 11.86 YEARS."
1259 GOTO 1350
1260 PRINT AT 3,2;"HAS A MAJOR MOON NAMED-"
1261 PRINT AT 4,2;"EUROPA."
1263 GOTO 1350
1264 PRINT AT 3,2;"IS 6TH IN LINE FROM THE SUN."
1267 GOTO 1350
1268 PRINT AT 3,2;"IS THE 2ND LARGEST PLANET IN"
1269 PRINT AT 4,2;"OUR SOLAR SYSTEM."
1271 GOTO 1350
1272 PRINT AT 3,2;"HAS SEVEN RINGS."
1275 GOTO 1350
1276 PRINT AT 3,2;"IS 7TH IN LINE FROM THE SUN."
1279 GOTO 1350
1280 PRINT AT 3,2;"HAS NINE RINGS."
1283 GOTO 1350
1284 PRINT AT 3,2;"HAS A TEMPERATURE OF -215"
1285 PRINT AT 4,2;"DEG. C AT THE CLOUD TOPS."
1287 GOTO 1350
1288 PRINT AT 3,2;"IS 8TH IN LINE FROM THE SUN."
1291 GOTO 1350
1292 PRINT AT 3,2;"HAS A MOON NAMED-TRITON."
1295 GOTO 1350
1296 PRINT AT 3,2;"REVOLVES AROUND THE SUN ONCE"
1297 PRINT AT 4,2;"EVERY 165 YEARS."
1299 GOTO 1350
1300 PRINT AT 3,2;"IS 9TH IN LINE FROM THE SUN."
1303 GOTO 1350
1304 PRINT AT 3,2;"IS THE SMALLEST PLANET IN"
1305 PRINT AT 4,2;"OUR SOLAR SYSTEM."
1307 GOTO 1350
1308 PRINT AT 3,2;"HAS A MOON NAMED-CHARON."
1350 INPUT A$
1353 PRINT AT 8,2;" YOUR ANSWER-";A$
1354 PRINT AT 10,2;"CORRECT ANSWER-";Q$
1355 IF A$=Q$ THEN GOTO 1365
1360 IF A$<>Q$ THEN GOTO 1390
1365 LET SA=SA-1000
1375 PRINT AT 20,1;" "
1385 PRINT AT 20,1;SA
1390 IF SA<=1000 AND SC>=1000 THEN GOTO 1500
1400 LET SC=SC-500
1420 PRINT AT 20,12;" "
1430 PRINT AT 20,12;SC
1433 PAUSE 500
1435 IF SC>=1000 THEN GOTO 1450
1440 IF SC<1000 THEN GOSUB 2500
1445 GOSUB 3500
1460 GOSUB 2000
1465 GOTO 1003
1500 REM %S%A%F%E% %L%A%N%D%I%N%G% % % % % % % % % % %
1510 PRINT AT 20,23;"DOCKING"
1520 PAUSE 250
1535 GOSUB 2000
1540 PRINT AT 2,2;"******CONGRATULATIONS******"
1550 PRINT AT 4,2;"YOU HAVE SURVIVED THE"
1560 PRINT AT 5,2;"CRISIS. PREPARE, NOW, FOR A"
1570 PRINT AT 6,2;"SAFE LANDING ON MOONBASE 2."
1580 PAUSE 1000
1590 GOSUB 3500
1998 REM %N%E%X%T% %L%I%N%E% %E%N%D%S% %P%R%O%G%R%A%M%
1999 STOP
2000 REM %C%L%E%A%R% %S%H%I%P%"%S% %S%C%R%E%E%N% % % %
2010 FAST
2020 LET H=2
2030 PRINT AT H,1;" "
2040 LET H=H+1
2050 IF H>=16 THEN GOTO 2085
2060 GOTO 2030
2085 SLOW
2090 RETURN
2500 REM %C%R%A%S%H% %M%E%S%S%A%G%E% % % % % % % % % %
2505 GOSUB 2000
2510 PRINT AT 2,2;"ALL HOPE IS GONE."
2512 PRINT AT 3,2;"PREPARE FOR DISASTER."
2515 PAUSE 100
2520 PRINT AT 6,2;"GOODBY GOODBY GOODBY"
2530 PAUSE 500
2540 PRINT AT 14,11;"**CRASH**"
2545 PAUSE 250
2550 RETURN
3000 REM %I%M%P%R%O%P%E%R% %I%N%P%U%T% %R%O%U%T%I%N%E%
3001 GOSUB 2000
3010 PRINT AT 2,2;"*IMPROPER INPUT-PLEASE WAIT*"
3020 PAUSE 500
3030 GOSUB 2000
3040 RETURN
3500 CLS
3510 PRINT "DO YOU WISH TO PLAY AGAIN?"
3515 PRINT "Y OR N"
3520 INPUT B$
3530 IF B$="Y" THEN GOTO 3570
3540 IF B$="N" THEN GOTO 1999
3550 IF B$<>"N" THEN GOSUB 3000
3560 GOTO 3500
3570 LET P=1
3580 GOTO 20
3585 CLEAR
3590 SAVE "1000%9"
3600 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

