Personal Computer News


Disassembler

 
Published in Personal Computer News #101

Does the thought of trying to decipher your machine code routines leave you bleary-eyed? Try A. K. Fox's time-saving routine which allows you to check all those ROM routines in your own programs.

Disassembler

Assembly Line

Does the thought of trying to decipher your machine code routines leave you bleary-eyed? Try AK Fox's time-saving routine which allows you to check all those ROM routines in your own programs.

Disassembler machine code into assembly language and make it easier to understand with this machine code routine. You will then be able to examine ROM routines and routines that you wish to use in your own programs.

It occupies only 1,440 bytes, 600 of which are data, and it saves you the tedious business of disassembling by hand.

Type in the loader program and save it. Now type in the hex loader and enter 60000 for the start address. Then enter the code, SAVE "DISS" CODE 60000,1439 after the loader on the tape and VERIFY it. Now type PRINT USR 60600 and the program will give you a prompt for the start address. If you make a mistake press P and try again, then press Enter and the disassembled memory will scroll up the screen.

The screen displays the address, the assembly language and also the hexadecimal codes. Press M to input another start address or the space key to return to Basic. Any other key continues the disassembly.

Mnemonics

All Z80 commands are recognised and jump relatives are calculated to the address that they jump to. For a starter, try disassembling ROM routines at 703 (key input), 16 (character print) and even the disassembler itself at 60600. The data contains just the first three sets of mnemonics shown in the manual because the index commands just mimic the HL register pair commands.

I have also split all the mnemonics into sets of 8. This way the routine uses bits 0, 1, 2, 6 and 7 to direct it to the right set. Then bits 3, 4 and 5 are examined to determine which registers or flags etc are used. Note that the printer buffer is used as a temporary store.

A. K. Fox