While debugging you may find you would like to step through each instruction executed to assure that the function of your system is correct. Instead of cycling the clock over and over to get through each instruction with a single-step clock circuit, a new circuit can be built to receive a de-bounced button press, and then execute one instruction at the speed the Z80 is set to run at. This requires a single-step instruction circuit. To build such a circuit we will be exploiting two control signals on the Z80, WAIT (Pin 24) and M1 (Pin 27).
M1 is an output control signal that goes low each time an instruction is fetched. WAIT is an input control signal that is sampled a short time after the instruction fetch, and when activated suspends the operation of the Z80. To allow only one instruction to execute at a time a D-flip-flop and one-shot are used. First, two NAND gates (74LS00) are used to de-bounce a momentary SPDT push button. The button press signal activates the D-flip-flop (74LS74) triggering the WAIT line to become high, and the Z80 to leave the WAIT condition to run an instruction. After this instruction is run the one-shot is triggered by the next M1 signal which is prompted by the instruction fetch. The one-shot’s output resets the D-flip-flop back which activates the WAIT signal to pause the Z80’s operation. The final toggle button adds a NAND gate and a toggle switch for toggling between an instruction stepping mode, and standard running mode. The finished single-step instruction circuit can be seen below. This circuit is a modified version of the circuit outlined in Figure 4.5 of “Build Your Own Z80 Computer” by Steve Ciarcia which I also display below. Instead of using the 74LS121 as a monostable multivibrator (one-shot) I have opted to use the 555 timer to cut down on the amount of different parts needed. Also, I opt for 10K resistors instead of 4.7K to standardize the components needed.
[Build your Own Z80 Computer Figure 4.5]
I have tested the operation of this single-step instruction circuit, and the results can be seen in the pictures below. To easily see the output of my Z80 system I have developed an 8-bit LED driver. This board accepts VCC, GND, and eight signal lines to display the contents of the bus or control signals visually. Below I have also included a gallery of pictures to show where the hardware is currently, and the eagle files for the single-step instruction circuit.
All Files from this project can be downloaded from my GitHub Repository,