Introduction
This is the second kit of the Hardware Basics series. In it we build what every processor counts with — the adder — and go all the way: from a single bit to a calculator that adds and subtracts signed numbers.
The kit is standalone: it starts from the transistor and takes nothing from other kits. Inside:
- gates
NOT,NAND,NOR,AND,OR,XOR— built in the very first lesson; - adders — from a one-bit half adder to the 8-bit
ADDSUB8, each one made of the ones before; - negative numbers and subtraction — with the same adder, no separate "subtractor";
- flags
C,Z,N,V— what the processor makes its decisions by; - comparison — how the
CMPinstruction finds out which number is bigger.
The finished calculator is 1,208 transistors.
What you get
Five lessons: half adder → 4 bits → subtraction and flags → 8 bits and comparison → the ± calculator. Bonus lesson 6 is decimal math, as in pocket calculators. If you are tired after the fifth lesson — the kit is already complete.
How to read binary numbers
Switches and lamps show numbers in binary: the top digit is on the left. In the check tables, next to every number it says which switches to turn on: 1 — on, 0 — off.
| Binary | Decimal |
|---|---|
| 0001 | 1 |
| 0010 | 2 |
| 0100 | 4 |
| 1000 | 8 |
| 0101 | 4 + 1 = 5 |
| 1111 | 8+4+2+1 = 15 |