Category Archives: Digital Projects

It’s alive! Z-80 Computer hardware now complete.

I have just finished assembling the memory board of my Z-80 homebrew project. All components individually tested, I placed the test program on the ROM, inserted the Z-80 and it worked first time!

It's Alive: Z-80 Homebrew
It’s Alive: Z-80 Homebrew

There is still a little more to do on modifying the I/O board to run the monitor program (which also needs writing) as the board was designed to test the various different circuits. However, the computer successfully executes the following test routine:

;COMPUTER TEST ROUTINE
;
;OUTPUTS ON PORT 0 ANY INPUT ON PORT 0 WHILST CALLING AN EMPTY SUBROUTINE
;
;

LD SP,9000H

L1: IN A,(00H)
CALL TEST
OUT (00H),A
JP L1
TEST RET

This outputs on port 0 any input on port 0 whilst using the stack pointer to save the value of the program counter in the RAM for the execution of an empty subroutine. Thus the I/O, ROM and RAM are all tested. Monitor listing to come soon no doubt.

Z-80 Update

Z-80
Z-80 home brew board
Progress on Memory Board
Progress on Memory Board

Unfortunately, it has been a long time since I could work on my  Z-80 homebrew; it has been in storage for many months. However, my setup is active once more and I have built the processor board. It consists of a power supply, clock, reset logic and buffers for the data, address and control busses. Unlike the I/O board, whose schematic is only in my head, I have used KiCad to design the circuitry and I will upload that separately.

On a separate board lives the I/O decoding and memory, on which I’ve made a start (see picture above). It’s all designed for easy testing and expansion, hence all the chips are socketed. I’ll update soon with the schematics and pictures of the finished article!

 

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.

Programming 

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:

ADDRESS + DATA

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