--- title: "Olympiad" id: 55009 type: "computer_media" slug: "olympiad" url: "http://localhost/computer_media/olympiad/" markdown_url: "http://localhost/computer_media/olympiad.md" published_at: "2024-06-10T07:03:30+00:00" modified_at: "2026-03-30T21:44:21+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/06/Olympiad-screen.png" excerpt: "A faithful recreation of the Olympic fanfare complete with five-ring graphics and a custom animated character that tracks each note as the melody plays." 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: 55021 title: "Long Island Sinclair Timex (LIST) User Group Library Tape #2" type: "computer_media" url: "http://localhost/computer_media/list-lib-2/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/06/Olympiad-screen.png" media_type_tags: "Demo" --- This program displays a title screen for “Olympiad XXIII” and plays the Olympic fanfare melody using BEEP commands. It draws five interlocking Olympic rings using the CIRCLE command, rendered with double-thickness by looping twice with radii 21 and 22. A custom UDG character “A” is defined via POKE USR to render a smiley-face icon that tracks note positions across a 30-character display string. The melody data is stored in DATA statements and read in multiple passes, including a RESTORE to repeat the first section before continuing to the second half of the tune. *** ## Program Analysis ### Program Structure The program is organized into several functional blocks: initialization and screen setup (lines 1–20), Olympic ring drawing (lines 30–90), border decoration (lines 100–140), title text display (lines 160), UDG definition (lines 170–240), main melody loop (lines 900–1910), a display subroutine (lines 2000–2030), and melody DATA (lines 3000–3001), with a SAVE/VERIFY sequence at lines 9998–9999. ### Screen Setup and Graphics Lines 1–11 set the color scheme (yellow paper, blue ink, yellow border) and display a decorative REM banner using block graphic characters `█` around the title “OLYPIAD XXIII” — note the missing “M” in the REM at line 10 is a minor typo in the banner text, though line 160 correctly prints “OLYMPIAD”. Lines 100–140 draw a border of `CHR$ 143` (the full block graphic) around the entire 22×32 display area. The five Olympic rings are drawn with `CIRCLE` at lines 30–90; the loop runs twice with radii 21 and 22 to produce thicker outlines. ### UDG Definition Lines 170–240 define UDG “A” (character code 144) by POKEing eight bytes into `USR "A"`. The bit pattern describes a smiley face: a circle outline with eyes and a smile. This character is used in the melody display subroutine as a moving position indicator. ### Melody Playback The DATA at lines 3000–3001 encodes the Olympic fanfare as pairs of (note, duration) values, where each note is a semitone offset and each duration is in seconds. The outer loop at line 950 runs twice (variable `I`), playing 15 notes, then a `RESTORE` at line 1050 rewinds the DATA pointer to repeat the opening phrase before proceeding to the second half at lines 1200–1350. After completing the full fanfare, a `PAUSE 200` at line 1900 precedes a `GO TO 950` to loop indefinitely. ### Note Indicator Subroutine The subroutine at lines 2000–2030 animates the UDG “A” marker across row 19 in sync with each note. It copies the 30-character string `A$` into `B$`, places `CHR$ 144` (UDG A) at position `A+10` within the string, and prints it at `AT 19,1`. Before each call, the previous position is erased with a space printed at `AT 19,A+10`. This gives the visual impression of a cursor moving left-to-right across the screen as each note is played. ### Notable Techniques - Double-pass `CIRCLE` drawing (loop variable adds 1 or 2 to radius) for visually thicker rings without machine code. - Using a full-width string `A$(30)` as a scratch buffer to position a single UDG character without clearing the whole row. - `PAUSE B` with `B=4` (a fixed ~0.23 second pause) between notes provides rhythmic spacing independent of BEEP duration. - `RESTORE` is used mid-sequence to replay the opening phrase, implementing the repeated A-section of the fanfare without duplicating DATA. - The `LET A=0` at line 20 and later at line 1360 resets the note position variable, but `A` is also reused as the note-pitch variable throughout the DATA read loop — the initial zero is quickly overwritten by `READ A`. ### Bugs and Anomalies - Line 1200 uses `FOR I=N TO 28`, where `N` retains the value 16 (one past the last value in the inner loop at line 1000 which runs 1 to 15). This means the second DATA segment reads items 16 through 28 — a deliberate but implicit use of loop variable persistence. - Line 9997 (`STOP`) is present to prevent the interpreter from accidentally running into the `SAVE`/`VERIFY` lines during normal execution. - The REM banner at line 10 reads “OLYPIAD XXIII” (missing “M”), which is a typo in the decorative border text only; the actual printed title at line 160 is spelled correctly. - At line 1310, `LET A=3: GO SUB 2000` hardcodes the indicator position to column 13 for the penultimate notes, bypassing the READ loop — a manual adjustment to keep the marker within bounds for the final phrase. ### Data Organization | Lines | DATA items | Notes played | Purpose | | --- | --- | --- | --- | | 3000 | 30 pairs (60 values) | 30 notes | Main fanfare body | | 3001 | 4 pairs (8 values) | 4 notes | Closing phrase extension | ## Source Code ``` 1 BORDER 5: PAPER 6: INK 1 9 REM \::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\:: 10 REM \::\::OLYPIAD XXIII\::\:: 11 REM \::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\:: 20 CLS : LET A=0 30 FOR I=1 TO 2 40 CIRCLE 75,100,20+I 50 CIRCLE 100,75,20+I 60 CIRCLE 125,100,20+I 70 CIRCLE 150,75,20+I 80 CIRCLE 175,100,20+I 90 NEXT I 100 FOR N=0 TO 31 110 PRINT AT 0,N;CHR$ 143;AT 21,N;CHR$ 143 120 IF N>21 THEN GO TO 140 130 PRINT AT N,0;CHR$ 143;AT N,31;CHR$ 143 140 NEXT N 150 DIM A$(30) 160 PRINT AT 2,8;"O L Y M P I A D";AT 4,11;"X X I I I" 170 POKE USR "A",BIN 00111100 180 POKE USR "A"+1,BIN 01000010 190 POKE USR "A"+2,BIN 10100101 200 POKE USR "A"+3,BIN 10000001 210 POKE USR "A"+4,BIN 11000011 220 POKE USR "A"+5,BIN 10111101 230 POKE USR "A"+6,BIN 01000010 240 POKE USR "A"+7,BIN 00111100 900 LET B=4 950 FOR I=1 TO 2 1000 FOR N=1 TO 15 1010 PRINT AT 19,A+10;" ": READ A: READ C 1020 GO SUB 2000 1030 BEEP C,A: PAUSE B 1040 NEXT N: IF I=2 THEN GO TO 1100 1050 RESTORE 1060 PAUSE 10 1070 NEXT I 1100 PAUSE 10 1200 FOR I=N TO 28 1210 PRINT AT 19,A+10;" ": READ A: READ C 1220 GO SUB 2000 1230 BEEP C,A: PAUSE B 1240 NEXT I 1250 PAUSE 10 1260 RESTORE 1270 FOR N=1 TO 13 1280 PRINT AT 19,A+10;" ": READ A: READ C 1290 GO SUB 2000 1300 BEEP C,A: PAUSE B 1310 NEXT N: LET A=3: GO SUB 2000 1320 BEEP .1,A: PAUSE B 1330 PRINT AT 19,A+10;" ": GO SUB 2000 1340 BEEP .8,3: PAUSE B 1350 PRINT AT 19,A+10;" " 1360 LET A=0 1370 RESTORE 1900 PAUSE 200 1910 GO TO 950 2000 LET B$=A$ 2010 LET B$(A+10)=CHR$ (144) 2020 PRINT AT 19,1;B$ 2030 RETURN 3000 DATA 10,.8,3,.8,5,.3,7,.1,8,.1,7,.3,3,.4,5,.3,7,.1,8,.1,7,.3,3,.3,5,.6,-2,.8,5,.8,10,.6,8,.1,7,.3,5,.3,3,.3,2,.2,0,.8,12,.4,10,.1,8,.2,7,.2,5,.6 3001 DATA 10,.1,8,.2,7,.2,5,.6 9997 STOP 9998 SAVE "OLYMPIAD" LINE 1 9999 CLS : PRINT AT 10,6;"REWIND TO VERIFY": PAUSE 200: VERIFY "OLYMPIAD" ```