Building 8 Bit Computers For Fun
Building 8 Bit Computers For Fun
David Hovemeyer
daveho@cs.jhu.edu
November 5, 2020
Outline
● Background
● Digital logic
● Microprocessors, busses, addresses, peripherals
● Building and testing microcomputer circuits
● Conclusions
Hardware for software people
● In CS, our main concern is software
● We take computing hardware for granted
● How does it work? Is it magic?
● Modern computing hardware: immensely complicated
○ 4th gen Core i7: 1.4 billion transistors! 2000+ pins!
● If you wanted to design and build your own computer, where to start?
8 bit CPUs!
● The microcomputer era began in the mid 1970s with 8 bit CPUs
○ Motorola 6800, 6809
○ Intel 8080, Zilog Z80
○ MOS 6502
● These were used in the first mainstream personal computers!
○ Altair 8800
○ Apple I, Apple II
○ Commodore VIC-20, C64
○ Atari 400, 800
○ TRS-80 Model I, Color Computer
● These CPUs are surprisingly easy to use and understand!
● You can use them to build a complete computer system!
Digital logic
Digital logic
● Computer hardware is based on digital logic
● In a digital circuit, voltages are either high (true, 1) or low (false, 0)
● Logic gates implement boolean operations (AND, OR, NAND, NOR, XOR,
NOT, etc.) on digital signals
○ "Signal" just means a digital voltage at a specific point in the circuit
● Any boolean function (with any number of inputs and outputs) can be
implemented by connecting logic gates
Basic logic gates
Inputs Output
Sequential logic
● Basic logic gates implement
combinational logic: outputs are a
mathematical function of the inputs
● A sequential logic element has "state"
● Example: D-type flip flop
○ Basically, a 1-bit memory!
○ Two inputs: D (data) and Clk (clock signal)
○ On a low to high transition on Clk, the Q
output is set to the current value of D
○ S and R can be asserted to unconditionally
set or reset Q
○ Q̅ output is always the opposite of Q
Image source: Wikipedia
Logic ICs
● 7400 family logic ICs: wide variety of devices providing logic gates and
sequential logic elements
● Some examples (from the "HCT" sub-family):
○ 74HCT00: quad 2-input NAND
○ 74HCT27: triple 3-input NOR
○ 74HCT74: dual D-type flip flop
○ 74HCT138: 3 to 8 decoder
● There are literally hundreds of these
Rules for building digital circuits
● An output can be connected to any number of inputs
● Two outputs should never be connected
○ Exception: tri-state outputs connected to a bus
● Typically, every input should be connected to an output, or connected to a
constant high or low voltage
○ "Floating" inputs (not driven by any output) can cause the circuit to behave strangely
○ A resistor to VCC (positive) or GND (0V) can provide a nominal high or low voltage that can be
"overridden" by a stronger output
● Moral: there are "design patterns" that you can follow
Example circuit with D-type flip flop
Building circuits!
● One of the most fun things about digital circuits is that you can build them!
● Easiest way: on a solderless breadboard
● Groups of 5 holes are connected electrically
● Use jumper wires to connect circuit nodes
Example circuit construction
Push buttons
(to drive D and
Clk inputs)
LED driven by
Q output
74HC14 used
74HC74 (one flip
for switch
flop used)
debouncing
The point
● Building digital circuits using logic ICs is pretty easy!
Microprocessor circuits
Microprocessors
● Microprocessor (Z80, 6502, 6809, ...)
○ Address bus (16 outputs): specifies a memory address
○ Data bus (8 bidirectional pins): used to transfer 1 byte of data to/from processor
○ Control signals (bus control, interrupts, etc.)
● Peripheral devices are attached to the data bus:
○ ROM (firmware code)
○ RAM
○ UART (serial port)
○ Timer/counter
○ etc...
● Glue logic: "decodes" addresses, generates a chip select for each peripheral
device
○ Only one peripheral device may access the bus at any given time!
6809 CPU
Peripherals
Peripheral chips needed: