Understanding Your ZX81 ROM

See all articles from SYNC v2 n4
Author(s): Tom Keeney
Publication: SYNC
Pub Details: SYNC v2 n4 (Volume 2, Issue 4)
Date: July/August 1982
Pages: 28

Understanding Your ZX81 ROM by Dr. Ian Logan. Melbourne House Ltd., Glebe Cottage, Station Rd., Cheddington, Leighton Buzzard, Bedfordshire LU7 7NA, U.K. 162 pp.; paperback. Available directly from the author for $18 (airmail). In U.S. $19.95 from: Gladstone, Heuristics, Sinclair Place, Softsync.

SYNC readers will recognize Dr. Logan as a major ZX80/81 expert whose writings are well worthwhile. Understanding Your ZX81 ROM is no exception. The book is written for a serious beginner who has a fairly good knowledge of Basic and wishes to take advantage of Z80 machine code execution speed. It supplements, but does not replace, the ZX81 manual which must be used as a reference. In many ways this book is an extension of Dr. Logan’s article “An Introduction to Machine Code” in SYNC 1:6.

The book falls logically into five parts. The first is a brief review of the Z80 CPU, its registers, and its instruction format. Next a quick introduction to the internal arithmetic and number base manipulations required is included.

The second part is a discussion of the Z80 machine code instruction set grouped by function. Examples are drawn liberally from the 8K ROM. Dr. Logan includes 26 additional examples in the form of simple Basic programs which can be entered and executed in the 1K memory.

A detailed examination of the relevant parts of the 8K ROM makes up the third part. The discussion is limited, however, to those routines which the user can reasonably access and use. Again, simple Basic programs detail the manner in which ROM based subroutines can be applied to a program. A simple USR(address) will not work with most of them. ROM functions for report generation, character printing, keyboard input, and display generation are discussed.

The fourth part might properly be called “Getting Started in Machine Code.” Dr. Logan introduces machine code programming by treating it as an extension to Basic. His technique of writing Basic programs that mimic machine code is unique to my experience. This appears to be such a good teaching method that it should become widespread. Of course, the technique is possible only because the Sinclair Basic can accept variables of any length. Such concepts as flowcharting and program structure help get the beginner started. Dr. Logan leads the programmer to think in terms of the special needs of the CPU. Finally, he discusses the integration of the Basic and machine code into one program. Demonstration programs illustrate the whole process.

The fifth part consists of appendixes. Complete listings of the more important 8K ROM routines are given as well as the usual tables of machine code language instructions, decimal-hexadecimal conversions, and keycodes.

Obviously, the book contains a great deal of information, and you would probably want to keep it as a reference. However, the book can be made easier to use with three improvements.

First, the book clearly needs an index and a revision of the physical arrangement of some of the contents. For example, the Z80 instructions set descriptions and the 8K ROM examples are separated from the short programs illustrating their use. This forces the reader to flip back and forth between references. I spend a lot of time with my fingers stuck in several pages to keep track of the relevant subject references while trying to apply the information to a particular programming problem.

Second, since the 8K ROM is decimal oriented, the inclusion of decimal equivalents for the hexadecimal numbers would remove some frustration for the beginner. Granted that a book on machine language needs some hex code information and examples, but the extensive use of hexadecimal leads to some problems. For example, the table of machine code instructions in Appendix ii is useless as a quick reference until the reader himself enters the decimal equivalents.

Third, a more durable type of binding that will allow the book to lie open and flat so that the reader can use both hands to enter program listings is needed. The pages are starting to fall out of mine, and I will soon ring bind it myself.

In spite of these three complaints, the fact that I have worn out Dr. Logan’s book is an indication of how useful I have found it to be. The fact that I intend to repair it is an indication of how valuable I think it will continue to be. It contains a tremendous amount of information and is well worth the cost. Understanding Your ZX81 ROM would be a valuable addition to most ZX80/81 libraries, and for the serious programmer it should be high on the list.