OverDemo

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

This program draws a star or polygon figure by plotting lines from the centre of the screen outward to equally spaced points around a circle of radius 85 pixels. The user inputs the number of lines and whether OVER mode is active, allowing overlapping lines to erase each other for interesting visual effects. Each spoke is calculated using trigonometry: angles are distributed evenly as 2π divided by the number of lines requested. The fixed centre point is PLOT 128,88, placing it near the middle of the 256×176 pixel display area.


Program Analysis

Program Structure

The program is short and linear, consisting of an input phase, a single drawing loop, and a cleanup step. There are no subroutines; all logic fits within 12 lines.

  1. Lines 10–15: Collect user inputs for OVER mode (o) and line count (l), then apply OVER o.
  2. Lines 20–30: Copy l into lines and initialise the starting angle a=0 and the angular step angle=2*PI/lines.
  3. Lines 40–100: The main FOR loop iterates lines times, computing an endpoint with COS/SIN, then drawing a spoke from the fixed centre (128,88).
  4. Lines 110–120: Reset OVER 0 to restore normal drawing mode before stopping.

Drawing Geometry

Every spoke starts at pixel (128, 88), which is approximately the centre of the 256×176 display. The endpoint is computed as a displacement:

  • x = 85 * COS a
  • y = 85 * SIN a

A radius of 85 pixels keeps all endpoints well within the screen boundary. Angles are stepped by 2*PI/lines, so the spokes are always perfectly evenly distributed regardless of how many lines are requested.

OVER Mode Usage

The OVER flag controls how drawn pixels interact with existing screen content. With OVER 1, each pixel is XORed against the display, meaning where two lines cross they cancel out, producing distinctive star or asterisk effects. With OVER 0, lines simply overwrite. Resetting OVER 0 at line 110 ensures the graphics mode is left in a clean state after the program ends.

Notable Techniques

  • The redundant variable lines (line 20) mirrors the input l without adding functionality; l could have been used directly in the FOR statement and the angle calculation.
  • Using PLOT followed by DRAW (rather than two PLOT/DRAW calls with absolute coordinates) is a standard idiom for drawing lines from a fixed origin.
  • The angle accumulator a is incremented additively each iteration rather than recomputed as i * angle, which is slightly faster but can accumulate floating-point rounding error over many iterations.

Potential Issues

  • No input validation is performed: entering lines=0 would cause a division-by-zero error at line 30.
  • A large radius of 85 combined with certain angle values may cause DRAW to attempt plotting outside the screen boundary, generating an error. In practice most line counts are safe, but edge cases exist near the corners.
  • The prompt limits OVER to 1 or 0 by convention only; any integer value is accepted by the interpreter.

Content

Appears On

One of a series of library tapes. Programs on these tapes were renamed to a number series. This tape contained

Related Products

Related Articles

Related Content

Image Gallery

OverDemo

Source Code

   10 INPUT " OVER (1 OR 0) ";o: INPUT " LINES ";l
   15 OVER o
   20 LET lines=l
   30 LET a=0: LET angle=2*PI/lines
   40 FOR i=1 TO lines
   50 LET x=85*COS a
   60 LET y=85*SIN a
   70 PLOT 128,88
   80 DRAW x,y
   90 LET a=a+angle
  100 NEXT i
  110 OVER 0
  120 STOP 

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

People

No people associated with this content.

Scroll to Top