All posts by Joseph Knowles

Z-80 Homebrew: I/O board!

The next step on my Z-80 journey is building the I/O. I decided to do this before building the processor circuit itself as it doubles up as a handy test device.

Z-80 I/O
Z-80 I/O

There are three output ports that use TIL311 displays; I got these cheap off eBay from Hong Kong. They take a four-bit input and display it as a hexadecimal value. Therefore, in pairs, they can display binary data from the data bus as a hexadecimal number 00h – FFh. They aren’t all connected to the data bus; I’ve kept them separate, so if necessary I can connect them to the address and data bus and for troubleshooting my ROM programmer.

The keypad follows Ciarcia’s design, but modified to use available components. Basically, there is a 556 timer (lower right chip) that has an astable oscillator providing a clock signal of approx. 3kHz. It goes through a NAND gate (upper left) before driving a binary counter (middle right). The counter outputs a four-bit number to a 4 to 14 demultiplexer (lower left). The 16 outputs are connected to the 16 numerical inputs, which are labelled using handwritten stickers to add to the homebrew feel. When one of these is pressed a monostable timer sends a 10ms signal (longer if the switch is held). First, this debounces the switch; second it stops, via the NAND gate, the clock signal. The four-bit number outputting from the counter is then held at the number pressed, which corresponds to the value of the button, and the four bit number is present at the bus buffer (top right) to be read by the CPU. When the CPU is looking for a value from the keypad it will read this buffer and get the number from the lower four bits. The next three bits are the modifier keys and finally bit 7 is the output from the monostable timer that tells the CPU that a key has been pressed and a value can be read. A software flag will ensure that the value is only read once.

ROM is necessary to boot the computer. Gone, however, are the days of needing EEPROM or UV erasable chips and their expensive programmers. Instead a few pounds will by a 4Mbit CMOS flash chip. So to program this chip, which can be done quickly using a single 5V supply, a simple Arduino sketch is required that uses shift registers to provide a parallel output. This is currently underway and it is possible to debug it using the I/O board.

Shift Register Test
Shift Register Test Using Z-80 I/O

Here, three shift registers are connected to the Arduino providing 8 bytes of output. The top two will drive the address bus and the lower provide the data. For now, though, it is just a proof of concept and is running a simple counter. Eventually, it will be possible to program it using data sent over the serial port of the computer.

Z-80 Homebrew – First Update

I’ve always wanted to build my own computer from the circuit up; so inspired by Steve Ciarcia’s Build Your Own Z-80 Computer and my success building a computer from CMOS Logic I thought it was time to have a go! Most of the components are no longer available, but the Z-80 CPU itself is still in production. So with a bit of re-designing it should be easy to build a computer following Ciarcia’s design.

First up: the power supply. It’s a simple design based around a 7805 regulator that takes a 9V supply from an old transformer and reduces it to a regulated 5V supply, with a maximum current of 1A.

Second: the clock. The Z-80 is available today at speeds of up to 33Mhz, but I bought a 4Mhz version. I’m not trying to replicate a vintage computer, it’s just an educational project, but it should be fast enough for any machine code I’ll write for it and slow enough to avoid any timing issues.

Prototype Power Supply and Clock
Prototype Power Supply and Clock

I’ve left them on breadboard for the time being; I don’t know how I will lay out the completed project yet.

Using an oscilloscope it’s possible to see the clock signal.

Clock Signal
4 Mhz Clock Signal

Connecting the power supply to the second oscilloscope channel shows how it is affected by the clock. The scale is very high (.1v per division) but demonstrates the need for decoupling capacitors very well. I’m using a 0.01 and 0.001 uF.

Clock with Power Supply
The Clock Signal and Power Supply

Next: The I/O!

CMOS Logic Computer

8-bit CMOS Logic Computer

This is my 8-bit computer built from CMOS logic gates, based on the SAP-1 in Albert Paul Malvino’s Digital Computer Electronics. It was hard to avoid creating a rats’ nest of wires, but there is (surprisingly) about 40m of wire in total. Its hard to gauge the amount of detail to describe this project in; there’s enough for a whole book’s worth describing it from the logic gates up, so I’ve provided a brief overview and a video that shows how it works in action!

The computer is fully programmable and it can add and subtract numbers from 0 to 255. The computer is organised around an 8-bit parallel data bus. At its heart is the adder/subtracter, which performs the computer’s calculations, either side is a register, which together hold the two numbers to be added or subtracted. Once the calculation has taken place, the result is stored in the upper register, which is called the accumulator. The result can then be sent to the output register, which drives the 8-bit LED display, or further operations can take place.

CMOS Logic Computer
CMOS Logic Computer

Data and instructions are stored in the RAM, which is the most complex chip on the computer. Two chips of 16 4-bit words each combine to make one 8-bit word; giving the computer a total memory of 16 bytes.

A 555 timer divided by a flip-flop provides the clock and drives two counters. First, the program counter, which is used for loading instructions,  and second the ring counter, which generates T states for the control logic, which is made entirely of NAND gates and inverters.

The two most complex chips are the RAM and the 4-bit adder, all of the other components are Logic Gates or Flip-flops. Incidentally, these are the only TTL chips on the computer as they were not available as CMOS. Their inclusion has taught me the practicalities of level shifting.

Whilst the computer’s functions are basic, building it has taught me the fundamentals of digital logic and computer architecture. Also, reading how these work in a book is very different from making them a practical reality.


The computer has 5 instructions:

LDA 0000 +4 bit address  which loads a number into the accumulator, this must be the first command.

ADD 0001+4 bit address adds a number at a 4-bit address to the accumulator.

 SUB 0010+4 bit address subtracts adds a number at a 4-bit address to the accumulator.

 OUT 1110 XXXX outputs the accumulator value to the display

 HLT 1111 XXXX stops the computer’s clock. All programs must end with this instruction.

These instructions are loaded into the upper nibble (4-bits) of the computers memory and where an address is needed it is added to the lower nibble. The program counter starts at 0000 and continues counting upwards to 1111 unless a HLT instruction is received, so numbers to be added or subtracted have to be entered in memory locations after the HLT. This is shown in my video, where I write a program to do the sum 63 + 111 – 56 = ?

The program is as follows:


0000 00000101 @Load Value at address 5 into the accumulator

0001 00010110 @Add Value at address 6 to the accumulator

0010 00100111 @Subtract Value at address 7 from the accumulator

0011 1110XXXX @Output result to LED display

0100 1111XXXX @Stop the computer

0101 00111111 @63 in binary

0110 01101111 @111 in binary

0111 00111000 @56 in binary

Output = 01110110 in binary or 118



Reappraising the Seicento

‘Reappraising the Seicento’ Available Now

It is now possible to place an order for my book ‘Reappraising the Seicento: Composition, Dissemination, Asslimilation’ of which I am both a joint editor and contributor.

Reappraising the Seicento

Reappraising the seicento presents new perspectives on some relatively well-researched areas of music history and adumbrates some more arcane aspects of the period, offered by fledgling scholars and early career researchers in the field of musicology. The scope of the title has the potential to warrant a tome on the subject, but it is not the intention to provide a comprehensive survey of music in the seventeenth century. Instead, five essays are presented, divided into two sections, which represent the research activities of young scholars with an interest in the seicento.

In the first part of this book compositional procedure in seicento Italy is examined through two different analytical procedures. Musical styles and fashions changed considerably throughout Europe in the seventeenth century; at the forefront of these changes were Italian composers and performers, who found fame and influence in their native countries as well as abroad.

In the second part of this book the dissemination of Italian music in seventeenth-century England and the appropriation and assimilation of contemporary Italian compositional techniques by English composers are considered. The phenomenal interest shown in Italian music by English patrons and musicians of the seventeenth century is placed into context and is revealed to be part of a larger historical trend.

It is available on via this link: