Looking at the bit patterns for the Z80 instruction set
(they are nicely tabulated in your Nascom manual … towards the
back), you will notice that many groups of instructions use the
middle three bite to represent a register, condition, arithmetic
operation, or a number from 0 to 7 (for the bitwise
operations)[r, c, a & n respectively].
INDIS represents an index register HL, IX or IY (and the
displacement if necessary). A similar system operates with
Where IND represents one of the index registers (HL, IX, IY)
but with no displacements. Make sure that you understand this,
because basically disassembley is analysis of bit patterns. I
did not, and wrote a disassembler so complex even I could not
make head nor tail of it!! These tables will have to go into
tables in the computer as they are crucial. You will have to
define a character to represent INDIS and IND as we don’t yet
know which of the index registers to output!! Remember these as
if they were arrays, eg. r(0) – r(7) etc.
The disassembler is going to need one vital piece of
information before it starts. Elementary – where to start from.
This can easily be done using the Nas-Sys routine ARGS. Load
this disassembly address into BC’ (the alternate registers are
identified by ’). This piece of your program is the first
encountered on a run and is not used again. From now on the
disassembley address is always in BC’. It must be the first byte
of an instruction or else there will be havoc!! Next thing to
do is to set STRDIS to an empty string.
Now there are two more variables – held also in the
alternate registers (use D’ and E’) – to be initialised. Call
one INDEX, the print routine will require this. The other call
TYPE and this holds information as to whether the instruction
began with £CB, £ED or neither. Set both these to zero. Take a
deep breath and begin!!!