★ APPLICATIONS ★ PROGRAMMATION ★ Z80 DISASSEMBLER (COMPUTING WITH THE AMSTRAD) ★ |
Raw Assembler (Computing With the Amstrad) | Z80 Disassembler (Computing With the Amstrad) |
A must for the keen machine code programmer's toolkit, by ROLAND WADDILOVE TO complement the Z80 assembler listed in the July issue of Computing with the Amstrad, RAW, here's a Z80 disassembler. As the name implies, it's the exact opposite of an assembler and is a valuable machine code programmer's tool. Machine code is pretty unintelligible. As you probably know, it's just a series of binary numbers in the range 0 to 255. When we write machine code we write it in assembly language first, as it's much easier to understand, and then translate the mnemonics into machine code. This is fine, but what happens if you haven't got the original assembly listing? This may occur if you've lost it, but more commonly if you didn't have it in the first place. Many games and utilities are written in machine code and although most games are protected, utilities are often not. Just how does that screen dump or RSX vork? There's a lot to be learnt by looking at other people's programming techniques. Assembly listings also take up a great deal of space in the magazine and not everyone has an assembler -order a back issue immediately - so a routine may be listed as a series of hex numbers in data statements. On top of this are two ROMs containing 16k of machine code - the Basic and operation system. Many of you will have a disc interface with a further 16k of code. There's a lot of interesting material lurking about in there. What is needed is a program which wiir convert the machine code back into an assembly listing. This is the function of this disassembler. All of the Amstrad's 64k of RAM can be disassembled, except for the 7k taken up by the program itself. Also any of the 252 possible ROMs can be selected and disassembled. A memory lister producing a hexadecimal and Ascii dump has been included. Again this can display data in RAM or any ROM. All the ROMs are interrogated when the program is first run and their type and select address printed. The addresses are needed when choosing a ROM. There's also an option to send all output to the printer if a hard copy is required. Unfortunately a disassembler can't reproduce an exact copy of an assembly listing as it has no way of knowing the labels used by the programmer. The address or number is printed instead. Another area of difficulty is data tables. A disassembler can't detect data in the middle of a program. It simply attempts to disassemble the lot. Apart from these minor difficulties it produces a very close copy of the original listing. You should find it an extremely useful tool. The program uses virtually no data and is very compact. It works out each instruction by looking at the bit pattern of the object code. It then selects the appropriate subroutine. The algorithm used is superb and can be found in Mastering Machine Code On Your ZX81 OR ZX80, by Toni Baker. There you'll find a full description of how the program works.
|