Attr Table

Developer(s): Roger Valentine
Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Utility

This program displays a visual reference table of all 64 paper/ink color attribute combinations available on the Timex 2068. It uses nested FOR loops to iterate through all eight paper colors (outer loop, variable j) and all eight ink colors (inner loop, variable k), printing the two-digit attribute byte value (8*j+k) styled with the corresponding PAPER and INK colors at calculated screen positions. The column headers show color swatches for paper colors across the top and down the left side using CHR$ 32 (space) filled with the appropriate paper color. The attribute value string is right-aligned to two characters using STR$ and a leading space inserted when the value is a single digit.

Entered from Roger Valentine’s book The Timex Sinclair 2068.


Program Analysis

Program Structure

The program is a short display utility organized into three logical phases:

  1. Setup (lines 15): Sets BRIGHT mode, clears the screen, and prints a header row with “PAPER”, “INK” labels and color swatches.
  2. Main table generation (lines 20–90): Two nested FOR loops render color swatches along the axes and the attribute byte values in all 64 paper/ink combinations.
  3. Termination and save (lines 100, 9998–9999): Halts execution normally; the high-numbered lines handle saving and verifying the program.

Screen Layout Logic

The outer loop variable j (0–7) represents the paper color and drives the column index. The inner loop variable k (0–7) represents the ink color and drives the row index. Each cell is positioned using AT k*2+5, j*3+6, placing rows at every other screen row (starting at row 5) and columns at every third character position (starting at column 6). This spacing ensures each two-character attribute value fits without overlap.

Lines 30 and 40 draw the axis labels: line 30 prints two space characters (CHR$ 32) with the appropriate paper color at the top of each column, and line 40 prints a single paper-colored space on the left side of each row, forming a simple color-coded axis.

Key BASIC Idioms

  • Attribute byte calculation: The formula 8*j+k correctly computes the attribute byte value for a given paper (j) and ink (k) combination, since paper occupies bits 3–5 (multiplied by 8) and ink occupies bits 0–2.
  • String right-alignment: Line 60 uses STR$ to convert the numeric value to a string, then prepends a space if the length is 1, ensuring all values display as two characters for clean column alignment.
  • BRIGHT 0 override: Each PRINT statement explicitly sets BRIGHT 0 to suppress the global BRIGHT 1 set at line 15, preventing bright attribute colors from interfering with the displayed swatches.
  • CHR$ 32 for colored blocks: Rather than printing a visible character, CHR$ 32 (space) is printed with a specific PAPER color to render a solid color swatch without any foreground glyph.

Variable Summary

VariableRole
jOuter loop counter; paper color index (0–7)
kInner loop counter; ink color index (0–7)
a$Formatted two-character string of the attribute byte value

Notable Techniques

The header line at line 15 uses embedded block graphic characters (the '''''''''"I"''"N"''"K" sequence) as a visual separator or decorative element alongside the “PAPER” and “INK” labels. The use of TAB 15 centers the header approximately over the table columns.

The SAVE "ATTR TABLE" LINE 10 at line 9998 stores the program with an auto-run start address of line 10, bypassing the REM comment header lines and jumping directly into the display initialization at line 15 (since line 10 does not exist and execution falls through to the next available line).

Bugs and Anomalies

There are no significant bugs. The STOP at line 100 cleanly halts the program after the table is drawn, which is appropriate since there is no user interaction loop. The program faithfully implements its stated purpose as a printed reference tool from the book The Timex Sinclair 2068 by Roger Valentine.

Content

Appears On

Capital Area Timex Sinclair User Group’s Library Tape.
One of a series of library tapes. Programs on these tapes were renamed to a number series. This tape contained

Related Products

Related Articles

Image Gallery

Attr Table

Source Code

    1 REM 
    2 REM 
    3 REM     ATTRIBUTES TABLE
    4 REM    FOR THE TIMEX 2068   
    6 REM    TAKEN FROM THE BOOK
    7 REM        "THE TIMEX
    9 REM       SINCLAIR 2068"
   10 REM 
   11 REM    BY ROGER VALENTINE   
   12 REM        ENTERED BY
   13 REM      G.F. CHAMBERS
   14 REM 
   15 BRIGHT 1: CLS : PRINT TAB 15;" PAPER "'''''''''"I"''"N"''"K"
   20 FOR j=0 TO 7
   30 PRINT AT 2,j*3+6; PAPER j; BRIGHT 0;CHR$ 32;CHR$ 32
   40 PRINT AT j*2+5,2; PAPER j; BRIGHT 0;CHR$ 32
   50 FOR k=0 TO 7
   60 LET a$=STR$ (8*j+k): IF LEN a$=1 THEN LET a$=CHR$ 32+a$
   70 PRINT PAPER j; INK k; BRIGHT 0;AT k*2+5,j*3+6;a$
   80 NEXT k
   90 NEXT j
  100 STOP 
 9998 SAVE "ATTR TABLE" LINE 10
 9999 VERIFY ""

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

Scroll to Top