Characters

This file is part of Timex Sinclair Public Domain Library Tape 1003 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Demo

This program prints every character in the character set by iterating through all 256 character codes (0–255) using CHR$ and displaying each one consecutively on screen. The loop is built with a simple counter variable A, a PRINT with a semicolon suppressor to keep output continuous, and an IF/GOTO construct to repeat. The STOP at line 50 halts execution after all characters have been displayed. The SAVE line includes an inverse-video digit in the filename, and a RUN statement follows to allow immediate re-execution after loading.


Program Analysis

Program Structure

The program is a minimal character set display utility. It uses a linear flow across just five active lines:

  1. 10 — Initialises counter A to 0.
  2. 20 — Prints the character corresponding to A with a trailing semicolon to suppress newlines and keep output continuous.
  3. 30 — Increments A by 1.
  4. 40 — Tests whether A < 256; if so, loops back to line 20.
  5. 50 — Halts execution with STOP once all 256 codes have been printed.

Lines 60 and 70 are utility lines for saving and re-running the program and are not part of the display logic.

Loop Mechanics

The loop iterates through values 0–255 inclusive. The condition A < 256 at line 40 means the loop body at line 20 executes for every value of A from 0 to 255, giving exactly 256 iterations. After A reaches 255, it is incremented to 256 at line 30, the condition at line 40 fails, and execution falls through to STOP.

Key BASIC Idioms

  • Semicolon in PRINT: PRINT CHR$ A; suppresses the automatic newline, so all 256 characters appear as a continuous stream filling the screen row by row.
  • IF/GOTO loop: A classic counted loop pattern using a plain variable and a conditional branch, equivalent to a FOR…NEXT but slightly more explicit about the termination condition.
  • CHR$: Converts an integer code to its corresponding display character, making this an exhaustive visual index of the entire character ROM.

Character Coverage

Codes 0–31 on Sinclair machines are control characters (space, cursor movements, etc.) and will produce non-printing or screen-effect results rather than visible glyphs. Codes 32–127 cover the standard printable ASCII-like set. Codes 128–143 are block graphics, 144–164 are UDG slots (displaying default patterns if unprogrammed), and 165 onwards includes the keyword tokens. The output therefore gives a live map of all these regions at once.

Notable Techniques and Observations

  • Using A < 256 rather than A <> 256 or A <= 255 is safe here because A is incremented by exactly 1 each iteration and cannot skip the boundary value.
  • A FOR A=0 TO 255 : PRINT CHR$ A; : NEXT A construct would have been functionally equivalent and slightly more idiomatic, but the IF/GOTO approach works correctly and was common in early listings.
  • No CLS precedes the loop, so any previous screen content remains until overwritten by the printed characters.
  • The REM at line 1 serves only as a title label (“CHARACTERS”) and has no effect on execution.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10122 – 10175.

Related Products

Related Articles

Related Content

Image Gallery

Characters

Source Code

   1 REM "CHARACTERS"
  10 LET A=0
  20 PRINT CHR$ A;
  30 LET A=A+1
  40 IF A<256 THEN GOTO 20
  50 STOP 
  60 SAVE "1017%4"
  70 RUN 

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

People

No people associated with this content.

Scroll to Top