Rockets

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Demo

This program draws an ASCII-art rocket on screen using a sequence of BORDER and BEEP calls to create a countdown effect before the rocket appears. After rendering the rocket with character-graphics lines (nose cone, body, and exhaust flames using backslashes and exclamation marks), it scatters 40 randomly positioned stars across the screen using PRINT AT with RND-generated row and column values. The program ends with a “HURRAY!” message and loops back via GO SUB to repeat the border-color and beep sequence. Line 15’s STOP is bypassed on auto-run because execution begins at line 20, leaving line 15 as a manual-run guard.


Program Analysis

Program Structure

The program is divided into three logical phases. Lines 10–90 implement a countdown using alternating BORDER color changes and BEEP tones with increasing PAUSE durations (60, 120, 180 frames). Lines 100–270 draw the rocket entirely with ASCII characters via successive PRINT statements. Lines 280–370 scatter random stars, print a victory message, then loop back to line 10 via GO SUB 10 to repeat the light-and-sound sequence indefinitely.

Rocket Drawing Technique

The rocket is drawn starting at AT 21,16 — near the bottom-right of the screen — and uses the double-comma (,,) idiom at the end of each PRINT statement. In Sinclair BASIC, a trailing comma after a PRINT item moves to the next print zone; two commas together effectively advance to the start of the next line at the same horizontal tab position, stacking the rocket body vertically in a column. The rocket consists of 17 lines: a pointed nose cone, rectangular body, and flame exhaust using /, \, and ! characters.

Star Field Generation

Lines 320–340 use a FOR loop to place 40 asterisks at random screen positions. INT(RND*32) generates a column in the range 0–31 and INT(RND*22) generates a row in 0–21, covering the full 32×22 character display. These are passed directly to PRINT AT Z,A;"*", which can overwrite parts of the previously drawn rocket — a minor cosmetic anomaly.

Control Flow and the GO SUB Idiom

GO SUB 10 at line 360 jumps back into the countdown sequence but never formally returns via RETURN, since the countdown falls through into the rocket-drawing and star-scattering code again. This creates an infinite animation loop rather than a true subroutine call, and the return address pushed onto the GOSUB stack is never consumed, which will eventually exhaust stack space after many iterations.

Notable Techniques and Anomalies

  • Line 15 contains a STOP statement that is skipped during normal auto-run execution (which begins at line 20), acting as a safeguard if the program is manually RUN from line 1.
  • PAPER 0 and INK 7 at lines 315–317 set black background and white ink before the star field, providing contrast for the asterisks but potentially altering the appearance of the already-drawn rocket text.
  • The increasing PAUSE durations (60, 120, 180) create an accelerating countdown feel despite being evenly spaced musically.
  • The BEEP pitches rise by one semitone each step (3, 4, 5, then 6), giving an ascending scale effect synchronized with the border color changes.
  • The trailing STOP at line 370 is unreachable in normal execution flow due to the unconditional GO SUB 10 at line 360.

Line Reference Table

LinesFunction
10–90Countdown: cycling BORDER colors, BEEP tones, PAUSE delays
100–270ASCII rocket drawing via stacked PRINT statements
280–310Post-draw border/beep flash
315–317Set PAPER/INK attributes for star field
320–340Random star field loop (40 stars)
350–370Victory message, loop via GO SUB, unreachable STOP

Content

Appears On

Library tape of the Indiana Sinclair Timex User’s Group.

Related Products

Related Articles

Related Content

Image Gallery

Rockets

Source Code

    5 REM PROGRAM *** "ROCKETS"
   10 BORDER 1
   15 STOP 
   20 CLS : BEEP 1,3
   30 PAUSE 60
   40 BORDER 2
   50 BEEP 1,4
   60 PAUSE 120
   70 BORDER 3
   80 BEEP  1,5
   90 PAUSE 180
  100 PRINT AT 21,16;"   *   ",,
  120 PRINT "  ***  ",,
  130 PRINT " ***** ",,
  140 PRINT "*******",,
  150 PRINT "*     *",,
  160 PRINT "*     *",,
  170 PRINT "*     *",,
  180 PRINT "*     *",,
  190 PRINT "*     *",,
  200 PRINT "*     *",,
  210 PRINT "*     *",,
  220 PRINT "*******",,
  230 PRINT "*******",,
  240 PRINT "/ \ / \",,
  250 PRINT "!!! !!!",,
  260 PRINT "!!! !!!",,
  270 PRINT "!!! !!!"
  280 BORDER 4
  290 BEEP 1,6
  300 PAUSE 60
  310 BORDER 5
  315 PAPER 0
  317 INK 7
  320 FOR L=1 TO 40
  325 LET A=INT (RND*32)
  330 LET Z=INT (RND*22)
  335 PRINT AT Z,A;"*"
  340 NEXT L
  350 PRINT "HURRAY!";
  360 GO SUB 10
  370 STOP 
 9998 SAVE "ROCKETS" LINE 20

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top