--- title: "Bars" id: 55433 type: "computer_media" slug: "bars" url: "http://localhost/computer_media/bars/" markdown_url: "http://localhost/computer_media/bars.md" published_at: "2024-06-23T17:44:16+00:00" modified_at: "2026-03-30T21:41:04+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/06/SCR-20240623-keji.png" excerpt: "A mesmerizing infinite loop of scrolling colored bars fills the screen using only PAPER attributes and blank PRINT statements — no graphics required." 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: "Demo" slug: "demo" taxonomy: "genre" url: "http://localhost/type/demo/" media_contents: - id: 55430 title: "Timex Sinclair Public Domain Library Tape 2004" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-2004/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/06/SCR-20240623-keji.png" media_type_tags: "Demo" --- This program generates a continuously scrolling color bar display by repeatedly printing blank strings with different PAPER colors across the screen. Three colored bands — blue (PAPER 1), red (PAPER 2), and green (PAPER 4) — are printed in sequence across 22 iterations, filling the screen with horizontal stripes. The loop at line 70 restarts unconditionally, causing the bars to scroll upward indefinitely. The PAPER color attributes are set inline before each PRINT statement without using INK or BRIGHT commands, keeping the code compact. The slightly different string lengths (10 vs. 11 spaces) in each PRINT statement cause the color bands to be slightly offset in width. *** ## Program Analysis ### Program Structure The program is a simple infinite display loop with no user interaction. It consists of a setup-free entry point, a `FOR`/`NEXT` loop body, and an unconditional restart jump. The `STOP` at line 80 is unreachable dead code, and the `SAVE` at line 90 stores the program with an auto-run entry point at line 10. 1. **Lines 10–60:** Outer loop iterates 22 times, printing three color-banded rows per iteration. 2. **Line 70:** Unconditional `GO TO 20` restarts the loop forever, producing continuous upward scrolling. 3. **Line 80:** Unreachable `STOP` — never executed. ### Color Bands Each pass through the loop prints three lines using `PAPER` colors set inline: | Line | PAPER Value | Color | String Length | | --- | --- | --- | --- | | 30 | 1 | Blue | 10 spaces | | 40 | 2 | Red | 11 spaces | | 50 | 4 | Green | 11 spaces | The inline `PAPER` color changes apply only to the subsequent `PRINT` statement’s output. Because the screen is 32 characters wide and the printed strings are much shorter (10–11 characters), each `PRINT` fills only part of a line before moving to the next row — the remainder of each row retains its previous attribute. This creates a mixed-attribute appearance rather than full-width solid bands. ### Scrolling Effect The loop iterates 22 times per cycle, printing 3 lines per iteration for a total of 66 lines per cycle. Since the screen displays only 22 rows, the output scrolls continuously upward as new lines push old ones off the top. The `GO TO 20` at line 70 bypasses the `FOR` initialization, restarting the loop variable `x` from 1 each time, which is the correct behavior here since the loop body is what drives the scrolling. ### Notable Techniques and Anomalies - The `PAPER` attribute is set as a standalone statement before `PRINT` rather than embedded within a `PRINT` item list using `PAPER n;` — both are valid but the standalone form changes the persistent stream attribute. - The differing string lengths (10 vs. 11 spaces) between the blue band and the red/green bands appear to be unintentional, resulting in a slight width asymmetry between the blue bar and the other two. - No `CLS` or `BORDER` reset is performed inside the loop, so the `BORDER 0` (black border) set at line 10 persists for the entire run. - The `STOP` at line 80 is dead code — it can never be reached due to the unconditional `GO TO 20` at line 70. ## Source Code ``` 10 BORDER 0 20 FOR x=1 TO 22 30 PAPER 1: PRINT " " 40 PAPER 2: PRINT " " 50 PAPER 4: PRINT " " 60 NEXT x 70 GO TO 20 80 STOP 90 SAVE "Bars" LINE 10 ```