--- title: "TED" id: 70936 type: "computer_media" slug: "ted" url: "http://localhost/computer_media/ted/" markdown_url: "http://localhost/computer_media/ted.md" published_at: "2026-08-24T12:01:40+00:00" modified_at: "2026-08-24T12:02:53+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/08/ted.png" alt: "TED screen" excerpt: "A looping screen-transition demo drives seven machine code effects — panning, zooming, fading, and flipping — through tidy DEF FN wrappers calling into a 900-byte routine." 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_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/TED%20%28198x%29%28-%29%28TS2068%29%28US%29%28Program%29.zip" tsrun_member: "TED (198x)(-)(TS2068)(US)(Program).tap" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2026/08/ted.png" alt: "TED screen" media_type_tags: "Demo" --- # TED TED is a ZX Spectrum screen-transition demo that showcases a suite of machine code routines for manipulating the SCREEN$ display in real time. Seven distinct effects — panning, zoom in, zoom out, corner zoom, fading, flip horizontal, and flip vertical — are driven by seven DEF FN wrappers (lines 10–70), each calling a USR entry point spaced five bytes apart starting at address 60000. Two picture files (“ted D” and “ted E”) are loaded from tape to addresses 46000 and 53000 respectively, serving as the source images for the transitions. The 900-byte machine code block at address 60000 (saved as “ted C”) provides all the manipulation routines, and RANDOMIZE USR is used throughout to invoke them without disturbing program flow. The demo loops continuously from line 130, cycling through all effects and finishing with a combined sequence before restarting. *** ### Program Structure The program is divided into two logical phases. Lines 540–610 form the loader/introduction sequence: they set up memory with `CLEAR 38999`, load the 900-byte machine code block (“ted C”) to address 60000, display explanatory text, and wait for a keypress before jumping to `RUN 10`. Lines 10–530 are the actual demo, defining the function wrappers, loading the two picture files, and executing the transition loop. The main demo loop runs from line 130 and ends with `GO TO 130` at line 450, making the demo repeat indefinitely. A subroutine at line 520 handles on-screen effect labeling, printing the current effect name centered on the lower status line using `PRINT #0` with padding spaces, then waiting for a keypress via `PAUSE 0` before returning. Lines 460–510 appear to be unreachable dead code — they are never called by a `GO SUB` or jumped to by any `GO TO` in the active loop, suggesting they are leftover development fragments or an abandoned alternate sequence. ### Machine Code Interface The 900-byte machine code block is loaded to address 60000 (“ted C”). Seven entry points are exposed, each five bytes apart: | DEF FN | Address | Effect | | --- | --- | --- | | `FN S(A)` | 60000 | Unknown (used once, with S3) | | `FN L(A)` | 60005 | Panning | | `FN H(A)` | 60010 | Unknown (used for initial load and reset) | | `FN F(A)` | 60015 | Fading | | `FN I(A)` | 60020 | Zoom In | | `FN O(A)` | 60025 | Zoom Out | | `FN T(A)` | 60030 | Corner Zoom | Two additional addresses are stored as numeric variables: `FH` (60035) for flip horizontal and `FV` (60040) for flip vertical. These are called directly via `RANDOMIZE USR FH` and `RANDOMIZE USR FV` rather than through DEF FN wrappers, likely because they do not take a source-buffer argument. ### Memory Layout Three memory addresses are used as image buffers, stored in `S1`, `S2`, and `S3`: - `S1 = 46000` — “ted D” picture (first image) - `S2 = 53000` — “ted E” picture (second image) - `S3 = 39000` — third buffer (used only in the combined sequence at lines 420–500) The `CLEAR 38999` at line 540 protects the machine code at 60000 and places the BASIC stack safely below the S3 buffer region. ### Key BASIC Idioms - `RANDOMIZE USR` / `RANDOMIZE FN` — used throughout to call machine code routines and discard the return value without triggering errors, a standard Spectrum technique. - `DEF FN` wrappers around `USR` — allow the machine code entry points to accept a parameter (the source buffer address `A`) via the function argument, even though the dummy parameter is formally required by BASIC syntax. The actual value of `A` passed is the buffer address. - `PAUSE 0` at line 530 — used as a keypress gate before each effect transition, giving the user control over pacing. - Centering formula at line 520: `(32 - LEN A$) / 2` calculates the correct column for a 32-column display. ### Tape File Structure The program saves and loads four separate tape files: 1. **“TED”** — the BASIC program itself, saved with `LINE 540` to auto-run from the introduction. 2. **“ted C”** — 900 bytes of machine code at address 60000. 3. **“ted D”** — first screen image loaded to 46000. 4. **“ted E”** — second screen image loaded to 53000. ### Anomalies and Notes - Line 430 contains `RANDOMIZE FV` (without `USR`), which simply randomizes the random number seed to the value stored in `FV` (60040) rather than calling the machine code. This is almost certainly a bug — it should be `RANDOMIZE USR FV` as used elsewhere. - Lines 460–510 are unreachable from the main demo loop and appear to be dead code, possibly a discarded alternate sequence. - The DEF FN parameter `A` in lines 10–70 is syntactically required but its role as the actual buffer address passed to machine code depends entirely on the Z80 routine reading the BC or HL register set up by the `USR` call — a common convention for parameterized USR routines on this platform. ## Source Code ``` 10 DEF FN S(A)= USR 60000 20 DEF FN L(A)= USR 60005 30 DEF FN H(A)= USR 60010 40 DEF FN F(A)= USR 60015 50 DEF FN I(A)= USR 60020 60 DEF FN O(A)= USR 60025 70 DEF FN T(A)= USR 60030 80 LET FH=60035 90 LET FV=60040 100 LET S1=46000:LET S2=53000:LET S3=39000 110 LOAD "ted D"CODE S1 120 LOAD "ted E"CODE S2 130 RANDOMIZE FN L(S1) 140 LET A$="PANNING":GO SUB 520 150 RANDOMIZE FN H(S2) 160 GO SUB 520:RANDOMIZE FN H(S1) 170 FOR I=1 TO 2 180 LET A$="ZOOM OUT":GO SUB 520 190 RANDOMIZE FN O(S2) 200 LET A$="ZOOM IN":GO SUB 520 210 RANDOMIZE FN I(S1) 220 NEXT I 230 LET A$="CORNER ZOOM":GO SUB 520 240 RANDOMIZE FN T(S2) 250 GO SUB 520 260 RANDOMIZE FN T(S1) 270 LET A$="FADING":GO SUB 520 280 RANDOMIZE FN F(S2) 290 GO SUB 520 300 RANDOMIZE FN F(S1) 310 LET A$="FLIP HORIZONTAL":GO SUB 520 320 RANDOMIZE USR FH 330 PAUSE 0 340 RANDOMIZE USR FH 350 LET A$="FLIP VERTICAL":GO SUB 520 360 RANDOMIZE USR FV 370 PAUSE 0 380 RANDOMIZE USR FV 390 LET A$="AND ALL OF THEM":GO SUB 520 400 LET D=25 410 RANDOMIZE FN O(S1):PAUSE D:RANDOMIZE FN I(S2):PAUSE D 420 RANDOMIZE USR FH:RANDOMIZE FN S(S3) 430 RANDOMIZE USR FV:PAUSE D:RANDOMIZE FV:PAUSE D 440 RANDOMIZE FN F(S1):PAUSE D:RANDOMIZE FN F(S2):PAUSE D:RANDOMIZE FN F(S1):PAUSE D 450 RANDOMIZE USR FV:PAUSE 50:GO TO 130 460 RANDOMIZE FN H(S2):PAUSE 0 470 RANDOMIZE USR FH:RANDOMIZE FN H(S2):PAUSE 0 480 RANDOMIZE FN O(S3):PAUSE D 490 RANDOMIZE FN O(S2):PAUSE D 500 RANDOMIZE FN O(S3):PAUSE D 510 GO TO 410 520 PRINT #0; AT 1,(32- LEN A$)/2;" ";A$;" "; 530 PAUSE 0:RETURN 540 CLEAR 38999:LOAD "ted C"CODE :PRINT "Ted," 550 PRINT '" The following program is from Your Spectrum and is a demo illustrating the features of a" 560 PRINT "machine code routine which","manipulates SCREEN$ in various ways." 570 PRINT '" After the program has loaded just press ENTER to see each of the effects." 580 PRINT '" There are no pokes needed to include any of these in your ownprograms. What is necessary is the 900 bytes of M/C at address 60000 and the DEF FN lines at the beginning of this program. There are only 2 pictures in","this demo (from Paint+) but","more could be added." 590 PRINT #1; INVERSE 1; AT 1,2;"Press any Key for a live Demo":PAUSE 0:RUN 10 600 SAVE "TED" LINE 540 610 SAVE "ted C"CODE 60000,900 ```