Electronics, coding and hacking. And ADD.

« DIY USB arcade controller Stellaris Logic Analyzer »

Free-running a Z80


Getting to know the Z80 has been on my todo-list for years. In my youth I used several computers featuring the Z80, but only briefly programmed them in assembly. I've mainly been obsessed with the MOS6502; but considering the impact the Z80 had in the past, I feel I owe it to be explored further.

I'm not really sure why I've always been chosing the 6502 over the Z80. Maybe it has to do with my weakness for Commodore products, or its simplicity. In many ways you could say that the Z80 is the 6502's bigger brother: it's slightly faster, has more registers and even 16-bit capabilities, not to mention a much wider and extensive instruction set. And, it can be hand-clocked - what a dream for the breadboarder!

Time to step up or give up.

I wired up a free-running Z80 last night. Free-running means there's no RAM/ROM yet, just the data lines hardwired to the NOP instruction (opcode $00) so whichever address the Z80 peeks at, it will only see the NOP instruction. If you have a Z80 laying around, this is a very trivial task to do: hook up VCC and GND, then NMI/INT/HALT/WAIT/RES via 1K resistors to VCC, and feed it a clock pulse. When starting, hold the RES low (to GND) first, so the CPU can reset (this only takes a few cycles). D0-D7 obviously goes directly to GND.

I solved the reset circuitry with a capacitor and couple of resistors. The capacitor takes a moment to recharge, holding the RES line low long enough for the Z80 to reset properly.

Reset circuit
(No, it's not a Instagrammed picture, my phone is just not good in poor light)

Here's the complete circuit on the bread board:

Free-running Z80

The next fun thing will be to add an EPROM with some test code to see if I can get some simple tasks done.

Oh, and unlike the 6502 which fetches its start address from the end of the address space, the Z80 simply starts executing code with the program counter at $0000. The ROM is therefore in the beginning of the memory, and RAM follows after.

Time to brush off those Z80 coding skills. It's been a looong, long time.


to Free-running a Z80

Feed for this Entry


    There are currently no comments.

About You

Email address is not published.

All messages must be validated by the admin.

Spam messages or messages containing URLs linking to spam, will never be published.

Add to the Discussion

Add to Google