--- title: "Super Screen" id: 56718 type: "computer_media" slug: "super-screen" url: "http://localhost/computer_media/super-screen/" markdown_url: "http://localhost/computer_media/super-screen.md" published_at: "2024-09-22T23:31:54+00:00" modified_at: "2026-03-30T21:21:28+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/09/SCR-20241029-spib.png" excerpt: "A machine-code-powered screen-scroll utility lets you define custom margins and shift window contents in real time, all driven from a compact BASIC front end." 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: "Maxsoft" slug: "maxsoft" taxonomy: "post_tag" url: "http://localhost/tag/maxsoft/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Banner" slug: "banner" taxonomy: "genre" url: "http://localhost/type/banner/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/Super%20Screen%20%281984%29%28Maxsoft%29%28TS1000%29%28US%29%28Cassette%29.zip" mediadate: "1984" producer_company: - id: 26909 title: "Maxsoft" type: "company" url: "http://localhost/company/maxsoft/" images: - url: "http://localhost/wp-content/uploads/2024/09/SCR-20241029-spib.png" - url: "http://localhost/wp-content/uploads/2024/09/SCR-20241029-spfn.png" - url: "http://localhost/wp-content/uploads/2024/09/Super-Screen.jpg" related_products: - id: 26911 title: "Super Screen" type: "product" url: "http://localhost/product/super-screen/" media_type_tags: "Banner" --- This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation. *** ## Program Analysis ### Program Structure The program divides cleanly into three layers: a machine code payload hidden in the `REM` at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24). 1. **Lines 1:** REM containing raw Z80 machine code — the scroll engine. 2. **Lines 2–11:** CLS and three INPUT prompts storing margin values via POKE. 3. **Lines 12–15:** Screen fill — 11 rows of a 64-character pattern. 4. **Lines 16–24:** Command dispatch loop accepting single-character commands. ### Machine Code in REM Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are `0x00` (NOPs if ever executed sequentially), followed immediately by `0xC3 0x22 0x41` — a `JP 0x4122` instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at `USR 16528` (0x4090 + offset), consistent with the `RAND USR 16528` call at line 20. A second entry point at `USR 16525` (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll. Key Z80 instructions visible in the REM data include: - `ED 5B nn nn` — `LD rr,(nn)`: loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers) - `ED B0` — `LDIR`: block memory copy, the core of the scroll operation - `ED 52` / `ED 4A` / `ED 42` — `SBC HL,DE` / `ADC HL,BC` / `SBC HL,BC`: 16-bit arithmetic for computing source/destination addresses and byte counts - `10 FC` — `DJNZ`: loop control for iterating over display lines - `C9` — `RET`: returns control to BASIC at both exit points ### POKE-Based Parameter Passing Margin values are passed to the machine code via three memory locations: | Address | POKE Line | Parameter | | --- | --- | --- | | 16514 | 5 | Lines to leave at top | | 16515 | 8 | Lines to leave at bottom | | 16516 | 11 | Columns to leave at left | These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design. ### Command Dispatch Loop Lines 16–24 form a simple interactive loop. `INPUT D$` reads a string, then three `IF` tests dispatch on single-character commands: - `"X"` → `RUN`: restarts the entire program from line 2 - `"S"` → `STOP`: halts execution - `"C"` → `GOTO 23`: calls the copy/clear entry point at `USR 16525` - Any other input → `RAND USR 16528` (scroll), then `PRINT D$`, then loop back to line 16 The `PRINT D$` after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism. ### Screen Fill Pattern Lines 13–15 use a `FOR`/`NEXT` loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks (`"--------------------------------************************"`). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration. ### Notable Techniques - **Dual entry points:** Two `RAND USR` addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code. - **Self-referential parameter storage:** Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage. - **RAND USR idiom:**`RAND USR addr` is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored. - **JP at offset 11:** The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the `USR` call addresses computed from the line’s storage position. ## Source Code ``` 1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9 2 CLS 3 PRINT "LEAVE LINES TOP?" 4 INPUT D 5 POKE 16514,D 6 PRINT "LEAVE LINES BOTTOM?" 7 INPUT D 8 POKE 16515,D 9 PRINT "LEAVE COLUMNS LEFT?" 10 INPUT D 11 POKE 16516,D 12 CLS 13 FOR X=1 TO 11 14 PRINT "--------------------------------********************************" 15 NEXT X 16 INPUT D$ 17 IF D$="X" THEN RUN 18 IF D$="S" THEN STOP 19 IF D$="C" THEN GOTO 23 20 RAND USR 16528 21 PRINT D$ 22 GOTO 16 23 RAND USR 16525 24 GOTO 16 ```