Machine Code Monitor (Syntax)

Developer(s): Matthew Johnson
Date: 1981
Type: Program
Platform(s): ZX80

A BASIC monitor for entering and running Z80 machine code on the ZX80, derived from one in 30 Programs for the ZX80. Answer the first prompt in decimal with the number of bytes you need (9 to 100); the program then shows each address and waits for two hex digits, or NEWLINE to leave the byte alone. It stores the code in the array it has just set up, so the code does not get in the way of BASIC. After the last byte it asks for changes, then calls the code with USR and prints the value left in HL.

The article suggests trying it with the Syntactic Sum routine from the February 1981 issue. A C9 (RET) byte also prints a STORAGE LOCATIONS heading. Syntax later printed changes for loading the code into reserved space instead.

Published in Syntax May 1981 (Machine Code Monitor).

Related Articles

Utility program enables you to edit and execute hex Z80 machine code.

Image Gallery

Source Code

  10 REM BE SURE TO LEAVE RESULT
  20 REM IN THE HL REGISTER AND
  30 REM INCLUDE A RETURN.
  40 PRINT "HOW MANY LOCATIONS NEEDED?"
  50 PRINT "(FIGURE ONE BYTE/LOC.)"
  60 PRINT ":::9<NUMBER<100:::"
  70 INPUT L
  80 DIM A(L)
  90 LET S=PEEK(16392)+256*PEEK(16393)+9
 100 CLS
 110 PRINT "LOCATION","CONTENTS"
 120 FOR I=0 TO L
 130 PRINT S+I,,
 140 INPUT A$
 150 IF A$="" THEN GO TO 180
 160 LET V=16*CODE(A$)+CODE(TL$(A$))-476
 170 POKE S+I,V
 180 LET V=PEEK(S+I)
 190 PRINT CHR$(V/16+28);CHR$((V AND 15)+28)
 200 IF PEEK(16421)=9 THEN CLS
 210 IF V=201 THEN PRINT "STORAGE LOCATIONS:"
 220 NEXT I
 230 PRINT
 240 PRINT "ANY CHANGES?"
 250 INPUT A$
 260 IF A$="Y" THEN GO TO 100
 270 PRINT "RESULT OF USR IS: ";USR(S)
 280 PRINT "STOP?"
 290 INPUT A$
 300 IF A$="Y" THEN STOP
 310 GO TO 100

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