Charecter4

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Font

This program implements a character font selection menu, allowing users to choose from four custom lettering styles: Normal, Tech, Stencil, and RSVP. Font switching is accomplished by POKEing pairs of values into system variables 23606 and 23607, which hold the base address of the current character set, effectively redirecting the ROM font pointer to one of several machine code character tables. The machine code font data is stored at address 61653 and spans 3105 bytes, loaded and saved via the LOAD/SAVE CODE commands at lines 9997–9998. The program is designed as a utility stub: user code occupies lines 1 through 9979, with line 9990’s GO TO 1 intended to be changed to the user’s actual program start line.


Program Analysis

Program Structure

The listing is organized as a self-contained utility occupying the high end of the BASIC line space, deliberately leaving lines 1–9979 free for the host program. The flow is:

  1. Lines 1–2: Author/credit REMs.
  2. Line 3: Usage instruction REM.
  3. Line 9979: STOP — acts as a hard boundary between user code and the menu system.
  4. Lines 9980–9988: The interactive font-selection menu loop.
  5. Line 9989: REM explaining the customization point.
  6. Line 9990: GO TO 1 — returns control to the user’s program after font selection.
  7. Lines 9997–9999: Tape save/verify utilities.

Font Switching Mechanism

The core technique relies on POKEing the system variables at addresses 23606 and 23607, which together form a 16-bit offset added to 65536 to locate the current character set. By storing different values in this pair, the program redirects the display system to one of four custom font tables held in the machine code block. The four font configurations are:

ChoiceNamePOKE 23606POKE 23607
1Normal Lettering213239
2Tech Lettering238248
3Stencil Lettering231245
4RSVP Lettering222242

The value pair encodes a two’s-complement offset: the effective address is 65536 + (PEEK 23607 * 256 + PEEK 23606) - 256 * 32, pointing 256 bytes before the start of the relevant font’s glyph data (since the font table begins at the space character, code 32).

Machine Code Data Block

Line 9997 loads a block of machine code (font data) with LOAD "CHAR/CODE" CODE 61653,3105. The 3105-byte block at address 61653 holds the raw 8×8 pixel glyph data for all four custom fonts. This address is in the upper RAM area, safely above the typical BASIC and display file region. Line 9998 saves both the BASIC program (auto-starting at line 9997) and the code block back to tape.

Menu Display Technique

The menu at line 9980 makes an interesting use of the font-switching POKEs mid-display: it temporarily switches to each font to print that font’s name as a live preview, then restores the “normal” pointer (POKE 23606,0: POKE 23607,60) for the surrounding menu text. This gives the user a visual sample of each style without needing any additional graphics or label strings.

Input Handling and Looping

Line 9983 uses INPUT "SELECT CHOISE";C$ (note the misspelling of “CHOICE”) to collect the user’s selection as a string. Lines 9984–9987 test C$ against "1" through "4"; a valid match clears the screen, sets the appropriate font POKEs, and jumps to line 9990. An invalid entry falls through to line 9988, which loops back to line 9980 and redraws the full menu — a clean, if slightly expensive, input validation loop.

Tape Verification

Line 9999 prints a rewind prompt to the lower screen (PRINT #1) and then issues two bare VERIFY commands — one for the BASIC program and one for the code block — confirming both saves were written correctly. The bare VERIFY ""CODE at the end is syntactically incomplete as listed (missing the address and length arguments), which may cause an error if actually executed, but likely reflects a truncated listing rather than intended behavior.

Notable Idioms and Anomalies

  • POKE 23609,60 at line 9980 sets the margin/scroll count system variable, preventing the scroll prompt from interrupting the display.
  • POKE 23658,8 enables the 48K keyboard mode flag.
  • The design pattern of reserving lines 9980–9999 for a utility and leaving 1–9979 for user code is a well-known Spectrum programming convention for bolt-on utilities.
  • The misspelling “CHARECTER” (also in the save filename "CHARECTER4") and “CHOISE” are consistent throughout, suggesting they originate with the author rather than a transcription error.
  • Line 9990’s GO TO 1 is explicitly flagged by the REM at line 9989 as the customization point, making this a template rather than a standalone program.

Content

Appears On

The biggest LIST tape yet — play poker accompanied by chip-tune renditions of classic songs, diagnose illnesses with a Bayesian expert system, master Z80 opcodes with a quiz, or unscramble anagrams before the cauldron boils over. Four custom fonts included.

Related Products

Related Articles

Every 2068 user should know by now that they can define their own graphics characters, but did you know that...

Related Content

Image Gallery

Source Code

    1 REM    BASIC PROGRAM WAS                 PRESENTED BY                  "SYNCWARE  NEWS"                   WRITTEN BY                  KENNETH E. MAJORS.   ********************************
    2 REM  MODIFIED AND ADAPTED                   BY                         ALGIS E. GEDRIS     ################################
    3 REM  YOUR PROGRAM SHOULD            ACCUPY LINES  BETWEEN              (1) AND (9979)
 9979 STOP 
 9980 POKE 23609,60: POKE 23658,8: BORDER 2: PAPER 6: INK 0: CLS : POKE 23606,213: POKE 23607,239: POKE 23606,238: POKE 23607,248: PRINT AT 5,3;"C H A R E C T E R   M E N U": POKE 23606,0: POKE 23607,60: PRINT AT 10,6;"1..NORMAL LETTERING": PRINT TAB 6;"2..";: POKE 23606,238: POKE 23607,248: PRINT TAB 9;"TECH LETTERING": POKE 23606,0: POKE 23607,60: PRINT TAB 6;"3..";: POKE 23606,231: POKE 23607,245: PRINT TAB 9;"STENCIL LETTERING": POKE 23606,0: POKE 23607,60
 9981 PRINT TAB 6;"4..";: POKE 23606,222: POKE 23607,242: PRINT TAB 9;"RSVP LETTERING": POKE 23606,0: POKE 23607,60
 9983 INPUT "SELECT CHOISE";C$
 9984 IF C$="1" THEN CLS : POKE 23606,213: POKE 23607,239: GO TO 9990
 9985 IF C$="2" THEN CLS : POKE 23606,238: POKE 23607,248: GO TO 9990
 9986 IF C$="3" THEN CLS : POKE 23606,231: POKE 23607,245: GO TO 9990
 9987 IF C$="4" THEN CLS : POKE 23606,222: POKE 23607,242: GO TO 9990
 9988 GO TO 9980
 9989 REM   IN LINE 9990 CHANGE              "GOTO 1"  TO YOUR              PROGRAM START  LINE
 9990 GO TO 1
 9997 LOAD "CHAR/CODE"CODE 61653,3105: GO TO 9980
 9998 SAVE "CHARECTER4" LINE 9997: SAVE "CHAR/CODE"CODE 61653,3105
 9999 PRINT #1;AT 0,0;"****REWIND THE TAPE AND PLAY****    *******TO  VERIFY*******": VERIFY "": VERIFY ""CODE 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

Scroll to Top