Title: Sinclair ZX81 ROM
Disassembly Part A:
0000H-0F54H
By: Dr. Ian Logan
From: Melbourne House Ltd.
Price: $20.00 in US
Ian Logan has disassembled and annotated the ZX81 Monitor, easing your access to the routines of the improved 8K ROM. (If you have an old ROM–PEEK 54=132–this disassembly doesn’t match your machine.) This analysis is more up-to-date than the 1st ed. of The ZX81 Companion. Ian’s book includes all functions except for the floating point calculator.
I find the book useful and reasonably done, although several obvious typos make me nervous (p.2: 0028 listed twice, the second is 002B; p.29: 16417 equals 4021H, not 401FH). I would verify any routine I intended to use by PEEKing appropriate locations.
Preceding every major routine, you will find a concise functional description of the code–very useful for quick understanding.
In particular, you can examine the LPRINT, LOAD and SAVE routines. These last two differ from the 4K routines published earlier (SYNTAX, May 81 & Jul.81).
Logan’s book doesn’t list hex codes following addresses, which makes checking difficult. Also, the notation differs from Logan’s earlier 4K ROM disassembly; here you’ll find both subroutine names and hex addresses in commands (like CALL 031E,OUT-BYTE). Compare the CALL example with LD HL,+VERSN (see sample routine following). Although good to locate subroutines, the names aggravate the problem of counting bytes. If you count bytes between 030B and 031E, only one name (VERSN) has bytes associated with it. Further, the typeface doesn’t distinguish system variables carrying Sinclair names, from those which Dr. Logan named.
Logan’s notes on the system variables include both decimal and hex addresses, but not the save and poke codes from Sinclair’s manual. Logan details the flag functions by bit (as Sinclair did not), and his alternative expressions of system variables enhances understanding.
All things considered, Logan’s comments plus the additional data on flags add real value to the disassembly. In future editions, I would urge Dr. Logan to include each address and the code in the ROM as well as to separate variable names from the commands. Also, system variables should stand out from monitor calls.
THE ‘SAVE’ COMMAND ROUTINE
HL is set to point to the start of the program name. There is a 6 second header and then the bytes of the name and the program are passed out to the cassette recorder.
02F6 SAVE CALL 03A8,NAME
JR C,02F4,REPORT-F
EX DE,HL
LD DE,+12CB
02FF HEADER CALL 0F46,BREAK-1
JR NC,0332,BREAK-2
0304 DELAY-1 DJNZ 0304,DELAY-1
DEC DE
LD A,D
OR E
JR NZ,02FF,HEADER
030B OUT-NAME CALL 031E,OUT-BYTE
BIT 7,(HL)
INC HL
JR Z,030B,OUT-NAME
LD HL,+VERSN
0316 OUT-PROG. CALL 031E,OUT-BYTE
CALL 01FC,LOAD/SAVE
JR 0316,OUT-PROG.
031E OUT-BYTE LD E,(HL)