Invert is a utility that flips the TS2068’s character set upside-down by rearranging the pixel rows within each glyph. It reads the current font address from system variables at addresses 23606–23607, then copies all 96 characters (each 8 bytes tall) into a buffer at address 30000, reversing the 8 pixel rows of each glyph during the copy. After processing, poking the font pointer to 30000 (encoded as low byte 48, high byte 116) redirects the display to the modified character set. Restoring the original font is achieved by poking 23606 and 23607 back to their default values (0 and 60, giving address 15360), pointing to the ROM font. The program uses CLEAR 29999 to protect the workspace at 30000 and above from being overwritten by BASIC.
Program Overview
This utility modifies the active character set by reversing the vertical pixel order of every glyph. It works entirely in BASIC, manipulating system variables that control which memory address the display hardware reads font data from. No machine code is used despite the introductory message claiming otherwise — the “few minutes to process” refers to the nested BASIC loops iterating over 96 × 8 = 768 POKE/PEEK operations.
Program Structure
| Lines | Purpose |
|---|---|
| 1–4, 8 | User instructions and INPUT pause before processing begins |
| 9 | CLEAR 29999 — protects addresses 30000+ from BASIC heap use |
| 10 | Read the current font base address from system variables 23606–23607 |
| 20–60 | Nested loops copy and vertically-flip each of the 96 character glyphs |
| 70–80 | Point font pointer to the new buffer at 30000 (116×256+48), then STOP |
| 9000–9001 | SAVE with LINE 0 autostart, then STOP |
| 9995–9996 | Recovery routine: restores default font pointer (60×256+0 = 15360) |
Font Address Arithmetic
Line 10 reads the two-byte font pointer stored at system variables 23606 (low byte) and 23607 (high byte), computing c = PEEK 23606 + 256 * PEEK 23607 + 256. The +256 offset is significant: the system variable actually stores the font base address minus 256 (since character codes start at 32, skipping the first 32 undefined glyphs). Adding 256 corrects for this so that c points directly to the glyph for character 0 in the font table.
The recovery routine at line 9996 pokes 0 and 60, giving 60×256 = 15360 as the raw stored value, which with the implicit −256 offset resolves to the ROM font at address 15616 — the correct default.
Glyph Flip Algorithm
Each character occupies 8 consecutive bytes, one per pixel row. The outer loop (j, lines 20–60) iterates over all 96 characters; the inner loop (p, lines 30–50) iterates over the 8 rows. The destination address is computed as 30000 + (7 - p) + 8 * j, which writes row p of the source glyph into position 7 - p of the destination — effectively mirroring each glyph vertically. This produces characters that appear upside-down but not horizontally mirrored, so text reads as vertically inverted rather than fully rotated 180°.
Activating and Deactivating the Inverted Font
Line 70 pokes 48 and 116 into addresses 23606–23607. The stored value 116×256+48 = 29744, which with the +256 offset the system applies gives 30000 — the exact base of the copied buffer. From this point on, all text rendered to the screen uses the flipped glyphs. Running line 9996 restores the pointer to the ROM font without requiring a restart or data reload.
Content
Source Code
1 PRINT " HEY GUY, THIS PROGRAM WILL TURNYOUR DISPLAY UP-SIDE-DOWN AND BACKWARDS.":PRINT ""
2 PRINT " THE ACTUAL MACHINE CODE WILL TAKE A FEW MINUTES TO PROCESS.":PRINT ""
3 PRINT " ONCE PROCESSED, GOTO 70 WILL PROVIDE AN INVERTED DISPLAY, ANDGOTO 9995 WILL PROVIDE A NORMAL DISPLAY.":PRINT ""
4 PRINT "PRESS ENTER TO START "
8 INPUT A$
9 CLEAR 29999
10 LET c= PEEK 23606+256* PEEK 23607+256
20 FOR j=0 TO 95
30 FOR p=0 TO 7
40 POKE 30000+7-p+8*j, PEEK (c+p+8*j)
50 NEXT p
60 NEXT j
70 POKE 23606,48:POKE 23607,116
80 STOP
9000 SAVE "INVERT" LINE 0
9001 STOP
9995 REM recovery
9996 POKE 23606,0:POKE 23607,60
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

