--- title: "OverDemo" id: 56309 type: "computer_media" slug: "overdemo" url: "http://localhost/computer_media/overdemo/" markdown_url: "http://localhost/computer_media/overdemo.md" published_at: "2024-08-04T10:49:54+00:00" modified_at: "2026-03-30T21:44:23+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/08/SCR-20240803-hqfe.png" excerpt: "Enter a line count and toggle OVER mode to draw radial spoke patterns that can either build up or cancel themselves out on screen." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Art" slug: "art" taxonomy: "genre" url: "http://localhost/type/art/" - name: "Demo" slug: "demo" taxonomy: "genre" url: "http://localhost/type/demo/" media_contents: - id: 56277 title: "Timex Sinclair Public Domain Library Tape 2001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-2001/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/OverDemo%20%28198x%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/08/SCR-20240803-hqfe.png" media_type_tags: "Art, Demo" --- # OverDemo 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. ## 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 ```