Whether you are a beginner or an old pro at programming in machine language, you need the “tools of the trade” to allow youself to concentrate on the programming and not spend 90% of your time figuring out the mechanics of getting your code into your computer. This article will describe and compare two well known assemblers and their differing approaches for programming machine code.
An assembler lets you use the (relatively) easy to understand mnemonics, such as “LD A,80” (load register A with 80), instead of the abstract “3E80” when you are typing in program listings or writing your own program. Combined with a good tutorial, such as Toni Baker‘s articles in ZX-COMPUTING, one of these assemblers could be just the ticket to see you well on your way into the world of machine code.
SOFTSYNC INC.
14 EAST 34th ST
NEW YORK, N.Y. 10016
$19.95/CASSETTE
ZEUS is a two-pass assembler which occupies memory from 57344 to 65279. It allows you to enter a program in assembly language complete with labels, comments and text. Line numbers are required, but the assembler will handle that for you automatically if you type “I” followed by the starting line and desired spacing. You must specify the Origin (ORG). The origin is where you want the machine code which ZEUS will generate from your source listing to begin. Once you’ve entered your program you can have ZEUS assemble it into machine code by hitting A and ENTER. If you’ve made an error in syntax, then assembly time is when it shows up. The assembler will stop assembling and display an error code and the line number in which it occured. You can list the line and correct the mistake by using the cursor keys and screen editor commands.
Once you’ve corrected all syntax errors, the cursor moves down to the next line with no error report. You are left with a Source listing and its equivalent in machine code, beginning at the address specified at the start of your source code by the ORG statement. The machine code program could now be run, but of course you’ll want to SAVE it first. It is very important to save the source file that you spent the time to type in and not necessarily the machine code itself. With the source on tape, you can reload and examine the program, make changes and reassemble it with ZEUS in a matter of seconds. Once you are completely satisfied with the code generated from your source file, the machine code can be saved and used. The source file cannot be recreated from the machine code so keep the source code somewhere safe.
Figure 1. Sample of ZEUS Display
00010 ORG 40000
00020 ENT
00030 VECT EQU #FEFF
00050 BRKON LD HL,BRK
00060 LD (VECT),HL
00070 DI
00080 LD A,#FE
00090 LD I,A
00100 IM 2
00110 EI
00120 RET
00130 BRK DI
00140 PUSH AF
00150 PUSH HL
00160 LD A,(23610)
00170 CP #14
00180 JR Z,GO
00190 LD HL,23692
00200 SET 7,(HL)
00210 POP HL
00220 POP AF
00230 EI
00240 JP #0038
00250 GO POP HL
00260 LD HL,9000
Another feature of an assembler that is not immediately apparent to the novice programmer is its ability, by changing the ORG address, to move a machine code program to a new location without the hassle of going through the machine code and changing all of the JUMPS and CALLS by hand.
The standard directives, such as, DISP for displacement of a program and EQU to assign values to labels, are also included in ZEUS. DISP is useful when you cannot assemble the program where you would ultimately run it from. For example, if you set ORG at 32768 and Disp at 10000, the machine code generated from your source file would be able to run from 32768, but it would be placed at 42768. If you didn’t displace it, the code would overwrite the source file which ZEUS holds at 32768. EQU allows you assign a value to a name or label. Just suppose you wish to use a routine in the ROM to scan the keyboard for you. You would enter “KSCAN EQU 02B0.” Every time you want to use the scan keys routine, you could use CALL KSCAN instead of CAll 02B0, which is much harder to remember.
The Monitor included with ZEUS ASSEMBLER is minimal at best. Typing M/ENTER, while in the assembler, will place you into the monitor mode. From here you can change colors, get the hex or decimal equivilant, examine or output to an I/O port, copy a block of memory, set tab stops for ZEUS, modify contents of memory, or examine blocks of memory.
Nobody likes to sit and stare at lines of hex numbers. It’s only a necessity when you don’t have a disassembler to translate for you. The most likely uses that the average novice would get from this monitor are the set tabs and the HEX/DEC conversion functions.
The Manual is 22 pages long and only gives one example to use. Ten routines that you might find useful to call from ZEUS are listed in the appendix.
SINWARE
BOX 8032
SANTE FE, NM 87504
$26.95/CASSETTE
$59.95/CARTRIDGE AROS
HOT Z has been available in many versions since it was first introduced for the ZX-81/TS-1000. The most recent, known as HOT Z AROS, is in EPROMs mounted on John Oliger’s cartridge board. They take up 24k of memory from 8000h to DFFFh in the dock and is invisible to the home bank (RAM). Virtually none of your memory is taken up by this system. HOT-Z on cassette includes a high and low memory version, with and without a name file. The name file contains the labels of the ROM routines and the system variables as well as routines in HOT-Z itself. This is extremely helpful in understanding exactly what’s happening in the machine code.
Upon loading, HOT-Z self starts and you find yourself in the disassembly, or READ mode. There are 4 modes: READ, WRITE, HEX-EDIT and SINGLE-STEP. The first three share the same screen format, the difference being in the position of the cursor and the effect of the commands.
The display is divided up into four columns. First is the address, in hex, of what follows in that row. The second column is the numbers for the instruction, also in hexidecimal, in that memory location. The fourth, the one you would read, contains the Z-80 assembly language mnemonics for the instruction. The third column is reserved for labels. Each label corresponds to an address. You can label your own routines or those of others. Since these names are restricted to four characters, some forethought is required in order to reflect the purpose of the routines.
In READ, the cursor appears at the top of the screen in the address column. To examine the next “page” of disassembly, merely hit the space bar. To go to a specific point in memory, you can type in the address or label.
If you wish to write machine code, you can enter HEX-EDIT (symbol-shift/E) or WRITE (symbol-shift/A). Quite often the machine code listings in magazines are in hex. They are difficult to understand and impossible to debug until you save the resulting code and examine it with a disassembler. In HOT-Z, however, the hex is converted to its mnemonics as you type it in, and hitting ENTER isn’t required. If you wish to enter a listing in mnemonics, such as the source listings in magazines, enter the WRITE mode and begin typing it in, hitting enter after each instruction. The hex equivalent will appear in the second column as Hot-Z assembles it. This is a line assembler in that the machine code is assembled line by line as you enter it in either form. Syntax errors prevent the line being accepted (as in Sinclair Basic), so any corrections are made as you go along. There is no source file as there is in ZEUS.

Once your program is entered, you can save it and run it from WRITE mode. This brings us to one of the most powerful features of HOT-Z, the SINGLE-STEPPER (figure 2). As the name implies, this mode allows you to step through a routine one step at a time and examine the results. All of the accessible registers are shown, including the alternates, along with their contents. Below these are the stack pointer, psuedo stack and the condition of the flags and exchange flags. Finally, at the bottom of the screen are the last instruction executed, the next to be executed, and the three in sequence after that. When you hit ENTER, the next instruction is run and every thing on the screen is updated. If you wish, you can set 2 breakpoints and have HOT-Z until it reches one.
A window facility is also included. This allows you to set aside a portion of free memory for a second display which can alternate with the single step display to let you observe the effects of your program on screen. As a debugging tool, this is hard to beat.

Conclusion
ZEUS is a competent assembler but with a limited debugging capability and with no disassembler. This means you can’t load up a program and examine it in its disassembled form. It’s possible to enter a program in hex by using the monitor facility, but you won’t see it disassembled. Other than syntax errors, debugging is a matter of “try it and see.” The greatest feature, as compared with HOT-Z, is the source file. As I mentioned before, all that has to be done to alter the position from which your program is run is to change the ORG value and, of course, any absolutes that refer to the program itself.
HOT-Z, on the other hand, is a combination of a monitor, editor, disassembler and assembler with very extensive debugging facilities. There are so many features included that it is impossible to give a complete picture let alone describe the uses of all of them. I haven’t even touched on the floating point interpreter or the relocation features. HOT-Z even lets you load in ZX-81/TS1000 tapes. The only serious drawback to HOT-Z is the absence of a source code. However, with the many code and block manipulation commands, it’s by no means a fatal omission.
Ideally, you would have both ZEUS and HOT-Z in your tool box. The combination of ZEUS’ source file and HOT-Z’s editing and debugging capabilites would be perfect. If it comes to “one or the other” though, HOT-Z, while a little more expensive, offers advantages that far outweigh the lack of source file and extra few dollars.