Authors
Publication
Pub Details
Date
Pages
Hot-Z for both the TS1000 and 2068 has been in constant demand since I first first added it to my product line. Make no mistake about it, this product is a very powerful tool in the hands of a machine code programmer. Unfortunately, there is another side to the Hot-Z coin. Right from the start, customers complained that they couldn’t figure out how to use Hot-Z. Some said that the documentation (about 50 pages) went right over their heads.
HOT-Z CLINIC is going to be a regular column in Computer Updates. It is for all owners of the program who have experienced difficulties. And that includes everybody, even me. I must confess that even after 2 years of using Hot-Z, there are still some features I have not dared to try. In each column I will concentrate on just one or two features, using very short and simple examples. Hopefully, I can pick up where Hot-Z’s documentation leaves off, and provide that one single comment that makes everything click into place for you.
So what is all this fuss about Hot-Z, anyway? Above all else, Hot-Z is a tool for writing machine code. It is to the programmer what a table saw is to the fine finish carpenter. Anyone can use a table saw, but the skilled craftsman can use it to produce items the weekend nail pounder can only dream of. Hot-Z will NOT write machine code for you. It will NOT magically turn you into a hot shot programmer. You plug it in, turn it on, and use YOUR creative skills to write. Like the saw, Hot-Z sure beats cutting it by hand. If you know how to use it, the program will speed your production, and enable you to do things you’d never attempt without it.
Now, an apprentice carpenter does not start by building a beautiful set of custom cabinets. Nor should you as a Hot-Z beginner expect to churn out kilobytes of poetic machine code. You start with the Basics. So with that in mind, here is a demonstration of two of the most fundamental rudimentary functions Hot-Z has to offer: reading a disassembly and switching between a data display and a disassembly.
First, load your copy of Hot-Z into the computer. If you use Hot-Z II for the TS1000, the load will finish with a title screen and a prompt which tells you to press any key to begin. Hot-Z AROS, the cartridge version for the 2068 also comes up with a title screen and asks you which kind of printer interface you use. With these two versions, enter the information asked for. After you do the first screen of Hot-Z’s disassembly display will appear. This same display comes up automatically after loading the tape version of Hot-Z for the 2068. What you’ll see is something like that shown below.
Hot-Z always starts up in what is called the READ mode. What you see on the screen is a disassembly of the first 22 instructions of your computer’s ROM. Hot-Z is “reading” the numbers stored in memory starting at address 0 and displaying what it finds in both the Hexadecimal representation and the mnemonic. The far left column of four digit numbers, starting with “0000” and going to “0027” at the bottom of the screen, represent the starting memory addresses for each Z80 machine code instruction.
The next column, labeled “Hexcode” is the hexadecimal representation of each instruction. The number of bytes needed to write any given machine language instruction varies depending on the instruction. In this display, several are shown which take up only one byte such as those at addresses 0000 or 0001. Longer instructions which require three bytes appear from addresses 0002 to OOOB. Next, a two byte instruction is shown at OO0E.
The top number in this column, the F3, is a hexadecimal display of the value stored in the very first byte of the ROM. The hex numbering system is used throughout the program for a variety of reasons. One of the bigger ones is that of convenience. A number stored in any single byte of memory can range in value from 0 to 255. To display values in decimal would, therefore require from | to 3 digits. Hex is used because the same values can be expressed in just 2 digits (00 to FF) per byte. This makes the display more compact and also eliminates a great deal of confusion which can arise when decimal numbers are used. Consider the instruction at address 000E. We can tell by looking at the hexcode, that this is a two byte instruction comprised of 18 and 43. If this were a decimal display, would the values be 18 and 43? Or could they be 184 and 3? Hot-Z follows the convention of hex notation and always uses 2 digits to represent the value of each byte. Therefore, in a longer instruction such as at address 0002, we have a 3 byte instruction which is written in hex as i EP and FF.
Another reason why Hex is used is that it is (believe it or not) easier to understand. The explanation of why this is so also makes a nice introduction to the third column of the TV display, the Mnemonic representation of each machine language instruction. Don’t let the word “mnemonic” throw you. I can’t pronounce it either. What it IS is more important. The mnemonic display is an abbreviated English (?) rendition of the hexcode instructions in column 2. Once you learn how to pronounce these abbreviated words, it will much easier to understand what a piece of machine code does. Literally thousands of pages have been written about machine code including great volumes on exactly what happens inside the computer when some specific instruction is executed. I certainly do not intend to duplicate all that work here. But I will tell you that the mnemonic “DI” means “disable interrupts”. That definitely holds more meaning than saying “F3”.
Look at the mnemonic at address 0002 which says LD DE,FFFF. In English, this stands for LOAD DE,FFFF or “load the register called DE with the number FFFF.” Now I can attempt to explain why working exclusively in hex is easier to understand than working in decimal. For your information, FFFF hex is the same as 65535 in decimal. If we were to write mnemonics in decimal, this instruction would become LD DE,65535. The hexcode translated to decimal would be 17, 255, 255. It is very difficult to look at the decimal numbers and see any correspondence between the two 255’s and the mnemonic 65535. But when we deal exclusively in hex, the hexcode and the mnemonic are the same. We have two FF’s in the hexcode column and FFFF in the mnemonic column as well. There are very definite advantages in this which will become more apparent as you progress.
So far, we have looked only at the first screenfull of disassembly. To view the next screenfull, press ENTER on the TS1000 or the SPACE BAR on the 2068. This will let you “page through” consecutively. There is another method which allows you to start the display at a specific address. This is done by simply typing a four digit hex address. To test this out, try typing 013E. After the last zero is pressed, the display will instantly show a new disassembly starting with address 013E hex.
Actually, this is an area in the ROM of both the 1000 and 2068 which stores the tokens used by the machine (like PRINT, GOTO, VAL, etc.). Because Hot-Z is in the disassembly mode, it takes the bytes it finds here and shows you the machine code mnemonics even though it is data rather than machine code. To the trained eye, disassemblies of data are fairly easy to spot because such a disassembly results in nonsense. This is not because Hot-Z is doing anything wrong. On the contrary, the program is doing a masterful job trying to make sense out of bytes which are not supposed to be machine code. Hot-Z has not been told that it is looking at the token table.
Built in to the program is the capability to read memory without trying to disassemble it. This is called the “DATA DISPLAY.” To see the token table for what it really is, press SHIFT and the letter D on the TS1000, or Symbol Shift and G on the 2068. Once you are in the DATA mode, you see a completely different presentation of memory. As in the Disassembly mode, you have the hex address and hex value stored there. But you also get these numbers printed in decimal. The right hand column shows the character code for the value stored in each given byte. Can you see some tokens hiding there? On the TS1000, you should see SQR starting at address 013E. Following that are SGN, ABS, and PEEK. On the 2068 you should see MERGE starting at 0141 hex, followed by VERIFY and BEEP.
You can look at any area of memory in either the Data or the Disassembly mode. DATA mode is just like Disassembly mode. Press ENTER (for TS1000) or SPACE BAR (TS2068) to page from one screen to the next. Or, type in a four digit hex address to start a display at at the address you type. The key you pressed to switch from DISASSEMBLY to DATA is a switch to go back and forth. Press the same key again to go back to the Disassembly mode.
Here’s a tip. How do you use Hot-Z to translate a hex number into decimal? Answer: Flip to the DATA mode and type the hex number you want to translate as if it were an address. The screen will jump to the address you type in. Since you are in the DATA mode, the decimal equivalent of the number you typed will appear in the forth column from the left.
Well, this Hot-Z Clinic will close for now. We covered quite thoroughly, the subject of READING. Next time, I’ll delve into WRITING, and if there’s time, maybe a little ARITHMETIC.