--- title: "UNSCREEN" id: 70854 type: "computer_media" slug: "unscreen" url: "http://localhost/computer_media/unscreen/" markdown_url: "http://localhost/computer_media/unscreen.md" published_at: "2026-08-23T15:07:57+00:00" modified_at: "2026-08-23T23:52:36+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/08/udscreen.png" alt: "UNSCREEN screen" excerpt: "A handy utility that tucks an entire screen image inside a BASIC REM line — and pulls it back out again — using two machine code entry points." 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/" indiv: - name: "Edwin Schoen" slug: "edwin-schoen" taxonomy: "indiv" url: "http://localhost/indiv/edwin-schoen/" genre: - name: "Utility" slug: "utility" taxonomy: "genre" url: "http://localhost/type/utility/" media_type: "Program" programmers: - name: "Edwin Schoen" slug: "edwin-schoen" taxonomy: "indiv" url: "http://localhost/indiv/edwin-schoen/" download_url: "https://archive.org/download/timex-sinclair-software-archive/UNSCREEN%20%281987%29%28Schoen%2C%20Edwin%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "1987" images: - url: "http://localhost/wp-content/uploads/2026/08/udscreen.png" alt: "UNSCREEN screen" media_type_tags: "Utility" --- # UNSCREEN UDSCREEN is a utility that transfers data between the display file (screen memory) and a BASIC REM line, using two machine code entry points. Calling RAND USR 26715 copies the current screen into line 9999’s REM statement, while RAND USR 26767 reverses the operation, restoring the screen from that REM data. The screen data block is 6,919 bytes long, with the actual pixel and attribute data beginning 6 bytes into the REM line’s payload. Line 9000 uses PEEK 23637 and PEEK 23638 to calculate and display the address of line 9999 by reading the PROG system variable area. *** ### Program Structure The program is primarily a loader and documentation stub. Its BASIC lines serve only to describe the utility’s purpose and usage; the actual work is performed by machine code located at addresses 26715 and 26767, which must reside elsewhere in memory (presumably loaded alongside this BASIC listing or appended to it). | Line | Purpose | | --- | --- | | `1` | REM block containing machine code (heavily tokenized garbage in the listing) | | `20` | REM title/author label | | `30–60` | CLS, display title, and print full usage instructions; ends with PAUSE and STOP | | `9000` | Diagnostic: prints the address of line 9999 using system variables, then STOPs | ### Machine Code Entry Points Two RAND USR calls are documented for the user: - `RAND USR 26715` — copies the 6,912-byte display file into a BASIC line 9999 REM statement. The REM payload is 6,919 bytes total, with screen data starting at offset +6 within the line. - `RAND USR 26767` — reverses the operation, writing the REM line’s screen data back to the display file, restoring the saved picture. The machine code itself is embedded in line `1`‘s REM statement. The tokenized garbage visible in the listing is the raw binary of the machine code being interpreted as BASIC tokens by the editor — a standard technique for storing executable code inside a REM line. ### System Variable Usage Line `9000` reads two consecutive system variable bytes to locate line 9999 in memory: - `PEEK 23637` — low byte of PROG (the address of the start of the BASIC program area) - `PEEK 23638` — high byte of PROG The expression `PEEK 23637 + 256 * PEEK 23638` reconstructs the 16-bit address. This is used diagnostically so the user can verify where line 9999 resides after the screen transfer, since the machine code must locate that line dynamically. ### REM Line as Data Storage Storing binary data in a BASIC REM line is a well-known technique. The REM statement’s content is never interpreted by the BASIC interpreter, making it safe storage for arbitrary bytes including those that would otherwise be treated as keywords or control codes. The machine code routines at 26715 and 26767 directly manipulate the BASIC program area to create, find, and update line 9999, bypassing the interpreter entirely. ### Notable Techniques - Use of `TAB 0` after a semicolon to simulate a newline-and-left-align within a single PRINT statement, keeping line count low. - `PAUSE 40000` before `STOP` on line 60 gives the user time to read the instructions without requiring a keypress handler. - The 6,919-byte REM payload accounts for 6,912 bytes of display file data plus a 6-byte line header (line number, length, and REM token), consistent with the standard BASIC line structure. ### Potential Issues The machine code entry points at 26715 and 26767 are fixed absolute addresses. If the program is loaded at a different address or if other programs alter memory layout, these addresses will be invalid. Users must ensure the program loads in the expected memory configuration for the routines to function correctly. ## Source Code ``` 1 REM *K\RESTORE OR STEP >=hLLIST PIGO SUB RMOVE FOR 6'#6#s#r#6REM #6@#FOR +++RESTORE STR$ !@GO SUB VAL FOR 6 20 REM UDSCREEN by Edwin L. Schoen © 1987 30 CLS :PRINT AT 2,10;"UDSCREEN"; TAB 5;"by Edwin L. Schoen"; AT 21,10;"©1987"; AT 4,0; 40 PRINT "Program Purpose"; TAB 0;"To move the screen file into a BASIC REM line or visa versa" 50 PRINT :PRINT "Program operation:"; TAB 0;"LOAD this program and then"; TAB 0;"LOAD a SCREEN$ file"; TAB 0;"RAND USR 26715 will move the "; TAB 0;"picture to line 9999 REM@..."; TAB 0;"RAND USR 26767 will move the "; TAB 0;"first REM@ line into the "; TAB 0;"display file" 60 PRINT "GOTO 9000 will show address of"; TAB 0;"line 9999"; TAB 0;"It is 6919 bytes long"; TAB 0;"Screen data begins at +6":PAUSE 40000:STOP 9000 PRINT PEEK 23637+256* PEEK 23638:STOP ```