Nascom Newsletter |
Volume 2 · Number 5 · November 1982 |
Page 4 of 37 |
---|
BC’ must be saved somewhere in RAM, I leave its actual position up to you, call it BCSAVE. Do not get this variable corrupted!
If you remember, when an IX of IY are used with a displacement, the displacement is always the third byte of an instruction. BC’ will get altered but the print routine will still need to know this third byte. Get a copy of the first byte of the op-code into the A register. Do not alter BC’ – its useful life is not over yet.
This part will test your knowledge of Z80 shifts and other bit-wise operations. Split A into 3 parts F, G and H (not to be confused with the actual register H). These variables must be stored in memory.
F | holds | bits | 7 (MSB) and 6 |
G | " | " | 5, 4 and 3) [Remember r(0) etc] |
H | " | " | 1, 2 and 0 (LSB) |
If the byte was £4F → 01 001 111 then F would be 1 (Not 64), G would be 1 (Not 4) and H would be 7. Got it? Easy wasn’t it? Now to do something similar to G. G goes into two parts called J and k (held in RAM). J consists of bite 2 and 1 of G, while K is just Bit 0. For the example above … J=0 and K=1. All these variables must be put somewhere safe. I keep emphasising this because I kept corrupting my variables and caused all sorts of things to happen!!
The next part is fundamental to the program. The print-out routine. Call it PRDIS, print the disassembled string. I will define it, but you can write it.
Check your subroutine with dummy data to test it.
Well, all I can say now is best of luck and be careful with those variables. The second part of this series will follow in the next issue.
Page 4 of 37 |
---|