--- title: "GPIX" id: 70785 type: "computer_media" slug: "gpix" url: "http://localhost/computer_media/gpix/" markdown_url: "http://localhost/computer_media/gpix.md" published_at: "2026-08-23T15:08:08+00:00" modified_at: "2026-08-23T19:41:32+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/08/gpix-1.png" alt: "GPIX screen" excerpt: "A machine code UDG pixel editor that lets you design custom characters with cursor keys and save them to any of the 21 UDG slots." 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: "User Defined Graphics" slug: "user-defined-graphics" taxonomy: "genre" url: "http://localhost/type/user-defined-graphics/" 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/GPIX%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/gpix-1.png" alt: "GPIX screen" media_type_tags: "User Defined Graphics" --- # GPIX GPIX is a graphical pixel editor for designing UDG (User Defined Graphics) characters, stored as machine code at address 23296. The program uses RANDOMIZE USR 26971 to launch the machine code editor routine, which allows cursor movement via keys 5, 6, 7, and 8, and saving UDGs at the cursor position using keys A through U. The title screen features a CIRCLE command for decorative effect along with colored PAPER and INK attributes in the banner. The editor binary is saved separately as a CODE file alongside the BASIC loader, allowing it to be reloaded independently with LOAD “GPIX” CODE followed by RAND USR 23296. *** ### Program Structure The program is a short BASIC loader/demonstrator for a machine code UDG editor. It consists of just a handful of lines: 1. `Line 1` — A REM statement containing the machine code binary for the editor routine (the bulk of the program data lives here). 2. `Line 9` — Draws a decorative circle at screen coordinates (111, 91) with radius 32. 3. `Line 10` — Displays the title “GPIX” in INK 4, plus colored banner rows using PAPER and BRIGHT attributes. 4. `Line 20` — Plays a musical fanfare sequence using a series of BEEP commands with varying durations and pitches, ending on a low note at pitch -9. 5. `Line 30` — Executes the machine code via `RANDOMIZE USR 26971`. 6. `Line 40` — Saves both the BASIC loader and the machine code block: `SAVE "GPIX"` followed by `SAVE "GPIX" CODE 23296,256`. 7. `Lines 50–80` — Prints usage instructions on screen. ### Machine Code Usage The machine code for the editor is embedded in the `REM` statement at line 1. This is a classic technique: the REM line is never executed by BASIC but serves as safe, addressable storage for binary data. The entry point is called via `RANDOMIZE USR 26971` at line 30, which jumps directly into the REM data. The code is separately saved as a 256-byte CODE block starting at address 23296 (the system UDG area or a buffer near it), so users can reload it independently without the BASIC loader. ### Save Strategy Line 40 performs two saves in sequence. The first `SAVE "GPIX"` saves the entire BASIC program (loader + REM-embedded code). The second `SAVE "GPIX" CODE 23296,256` saves the 256-byte machine code block that the editor installs at address 23296. End users are instructed to `LOAD "GPIX" CODE` and then invoke the editor with `RAND USR 23296`, bypassing the BASIC loader entirely for subsequent sessions. ### Title Screen and Audio The title screen uses layered PRINT AT statements with explicit PAPER, INK, and BRIGHT attributes to create a colored banner effect. The `CIRCLE 111,91,32` at line 9 draws a decorative circle as a logo element. The fanfare in line 20 combines fixed BEEP calls for a melodic intro with a `FOR` loop (`FOR i=1 TO 16: BEEP .1,i+14: NEXT i`) that sweeps upward through 16 semitones, adding a rising scale effect before the final sequence resolves. ### Editor Controls According to the on-screen instructions printed in lines 70–80, the machine code editor uses: - Keys **5, 6, 7, 8** for cursor movement (the standard directional keys). - Keys **A through U** to save the currently designed UDG into one of the 21 UDG slots. The 21 UDG slots (characters \a through \u) correspond exactly to keys A–U, giving an intuitive one-key assignment model entirely handled within the machine code routine. ### Notable Techniques - Using a `REM` line as machine code storage avoids the need for DATA/READ loops and POKE sequences, saving both code and execution time. - Dual SAVE on a single line (line 40) ensures both the loader and the binary are written in one run, reducing the chance of mismatched saves. - `RANDOMIZE USR` rather than `GO TO` or a direct call is used to invoke machine code, which silently discards the USR return value without causing an error. - The `FOR` loop in the fanfare (line 20) demonstrates compact pitch generation rather than listing every BEEP individually. ## Source Code ``` 1 REM NEXT !;\\ THEN VAL$ STEP INKEY$[ STEP EXP [ STEP BRIGHT [ STEP 8 STEP THEN [ CLS <> RESTORE OR STEP LLIST STR$ LLIST :;\\ THEN o( RESTORE THEN CODE 2;\\:\\ RETURN 58 INK RETURN 905 RETURN 5 RETURN 6 RETURN 7 RETURN 8 STEP THEN [ THEN y(8>\a0\k RETURN A8\m RETURN V0 VERIFY Aa8 PAUSE RETURN v0 VERIFY a VERIFY \a8 PAUSE RETURN X COPY ▜▜▜▀_ RESTORE !LEN [ OR GO SUB VAL STR$ LLIST NOT [ OR STEP VERIFY y_STR$ <> RESTORE OR RESTORE STEP RUN [ READ FREE READ w# LLIST STR$ LLIST <> RESTORE OR RESTORE STEP RUN [ READ READ FREE # READ w FOR OR RESTORE STEP IF [FREE INPUT COPY w! +STICKASN CLS LLIST STR$ <>!LEN [<>![h[ GO SUB VAL <>.... 9 CIRCLE 111,91,32 10 PRINT AT 10,12; INK 4;"GPIX": PRINT AT 19,0; BRIGHT 1; PAPER 3;" ": PRINT AT 20,0; INK 3; BRIGHT 1; PAPER 5;"FEB. 1987 © Edwin L. Schoen ": PRINT PAPER 2;" " 20 BEEP 1,10: BEEP .5,22: BEEP .20,19: BEEP .20,18: BEEP .2,17: FOR i=1 TO 16: BEEP .1,i+14: NEXT i: BEEP 1,15: BEEP .5,1: BEEP .5,2: BEEP 1,3: BEEP 2,-9 30 RANDOMIZE USR 26971 40 SAVE "GPIX": SAVE "GPIX"CODE 23296,256 50 PRINT AT 12,0;"To Use: LOAD ""GPIX"" CODE " 60 PRINT "RAND USR 23296" 70 PRINT "Move Cursor with 5,6,7 and 8 " 80 PRINT "Save UDGs at cursor by keys A-U" ```