Processor Test

Date: 1985
Type: Program
Platform(s): TS 1000
Tags: Utility

Processor Test displays a grid of nine filled-block characters at fixed screen positions and then calls a machine code routine at address 16514 via USR to perform a processor speed test. The program requires the user to enter a specific passcode (“3EDC7UJMXDR5NHY6”) before proceeding, acting as a simple access gate. Line 1 contains an extensive REM statement that holds the machine code data loaded into memory prior to the test routine. The SLOW command at lines 10 and 130 ensures the display runs in the standard interrupted mode before the USR call benchmarks the processor.


Program Analysis

Program Structure

The program is organized into four logical phases:

  1. Machine code storage (line 1): A REM statement holds binary data in its tail bytes, providing the machine code routine that will be called via USR 16514.
  2. Access control (lines 10–60): The user must enter the exact string 3EDC7UJMXDR5NHY6 before the test proceeds; incorrect input loops back to the prompt.
  3. Instructions (lines 90–120): A brief text screen explains what the test does and how to stop it, followed by a PAUSE 500 delay.
  4. Test loop (lines 130–210): Nine filled-block characters are printed at fixed grid positions and then USR 16514 is called, delegating the actual timing work to machine code.

Machine Code in the REM Statement

Line 1’s REM statement contains a substantial sequence of keyword tokens and characters that encode a Z80 machine code routine. The routine begins at address 16514, which is the address of the second byte of line 1 (the first byte after the REM opcode in the tokenized line). This is the standard technique for embedding machine code in a BASIC program: USR 16514 in line 210 transfers control directly into the REM payload.

The REM content references tokens such as GOSUB, LPRINT, LLIST, LOAD, CHR$, LN, OR, RND, TAN, SGN, VAL, PRINT, EXP, LET, AT, NEW, RETURN, along with numeric literals and block graphic characters — all interpreted not as BASIC keywords but as raw opcode bytes by the Z80 processor.

Display Layout

Line 200 places nine (filled block) characters at a 3×3 grid of screen positions:

RowColumns
10, 15, 31
120, 15, 31
210, 15, 31

These nine markers serve as visual reference points whose “blinking” behavior (caused by the display interrupt interacting with the machine code loop) can be observed and timed to assess processor speed.

Key BASIC Idioms and Techniques

  • Passcode gate: Lines 40–60 use INPUT D$ and a string comparison; any mismatch loops unconditionally back to line 30 via GOTO 30.
  • USR call as benchmark: LET Y=USR 16514 in line 210 both transfers control to machine code and captures any return value in Y, though the return value is not subsequently used in the BASIC portion of the program.
  • SLOW mode enforcement: SLOW appears at lines 10 and 130, ensuring the display interrupt is active — relevant because the visual blinking effect depends on normal interrupted operation.
  • SAVE and auto-restart (lines 9500–9520): After the test logic, a SAVE is followed by SLOW and GOTO 1, creating an infinite restart loop if the program ever returns from the machine code routine back into BASIC.

Notable Anomalies

The GOTO 1 at line 9520 targets line 1, which contains only a REM statement. In practice this is harmless — BASIC will simply advance to the next executable line (line 10) — but it is slightly unusual compared to targeting line 10 directly.

The variable Y assigned from USR 16514 is never read after line 210, suggesting the machine code routine either runs indefinitely (consistent with the instruction that only a reset or power-off will stop it) or its return value is irrelevant to the BASIC program’s logic.

Content

Appears On

Related Products

Related Articles

Related Content

Image Gallery

Source Code

   1 REM  GOSUB #£RNDE(RND GOSUB # FASTAT STR$  LPRINT )WRNDY█ GOSUB [L] LLIST [7]RNDF#><#><7/ LOAD #CHR$ W3#: Y -▘LN  OR RNDC3Y█-~~LN  OR RND4-Y -▘LN  OR RNDC$Y█-~~LN  OR RND4▖▞ £TAN £#[S]CSGN /SGN VAL  PRINT [R]#▘WRND*▟##EXP  #~~#▀~~# LET AT #UORND[>]#UORND[V]4 IF Y█#<=█ NEW▒ RETURN TAN 
  10 SLOW
  20 CLS
  30 PRINT AT 1,3;"HI. I▘M PROCESSOR TESTER.";AT 6,4;"ENTER: 3EDC7UJMXDR5NHY6"
  40 INPUT D$
  50 IF D$="3EDC7UJMXDR5NHY6" THEN GOTO 90
  60 GOTO 30
  90 CLS
 100 PRINT AT 5,0;"THIS TEST ONLY DISPLAYS BLINKING";AT 7,4;"BOXES TO HAVE THEIR SPEED";AT 9,3;"CHECKED. ONLY [R][E][S][E][T]TING OR";AT 11,8;"TURNING POWER [O][F][F]";AT 13,9;"WILL STOP THEM."
 110 PAUSE 500
 120 CLS
 130 SLOW
 200 PRINT AT 1,0;"█";AT 1,15;"█";AT 1,31;"█";AT 12,0;"█";AT 12,15;"█";AT 12,31;"█";AT 21,0;"█";AT 21,15;"█";AT 21,31;"█"
 210 LET Y=USR 16514
 9500 SAVE "PROCESSOR TESTE[R]"
 9510 SLOW
 9520 GOTO 1

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

People

No people associated with this content.

Scroll to Top