iolinked
iolinked · from the transistor up

Build a computer
from the transistor up

There's a computer under every piece of software you've ever run, and almost nobody sees how it actually works. This tutorial builds one from nothing. You start at a single switch — open or closed, nothing else. Then you wire switches into logic gates, and gates into an adder. You give the adder a memory, give the memory an address, and give the address a bus. Last, you give the whole thing a loop that fetches an instruction and obeys it. By the final chapter a real program is running on a machine you understand completely — because you built it, one decision at a time. Every idea here has a widget you can flip, wire and watch run — nothing is claimed without being shown working first.

Start Chapter 1
switch CPU
01

How Computers Work · the full map

19 chapters · one flat path, from a switch to a running program
computers — from the transistor up
>>>
ch 01The SwitchOne switch, on or off — the single physical fact everything above is built from. ch 02Logic GatesWire a few switches together and get AND, OR, NOT — decisions made out of plumbing. ch 03Composing GatesGates wired into gates — build XOR, the multiplexer and the decoder from the basic three. ch 04Counting in Two SymbolsOnly 0 and 1 to work with — binary place value, and counting without ten fingers. ch 05Negative NumbersSigned values with no minus sign — two's complement, and why subtraction becomes addition. ch 06Building the AdderHalf adder, full adder, ripple-carry chain — arithmetic built entirely out of gates. ch 07Remembering a BitA gate that remembers itself — feedback, the latch, and the birth of state. ch 08The Edge-Triggered RegisterTame the latch with a clock edge — store a bit exactly once per tick, on command. ch 09Addressable Memory (RAM)Registers by the thousand, each with its own address — memory you can name and find. ch 10The BusOne shared set of wires, many devices — how the bus decides whose turn it is to talk. ch 11The Lookup Table & ROMTurn an address straight into a fixed answer — the lookup table, and memory that never forgets. ch 12InstructionsAn instruction is just a number — the encoding that tells the machine what to do. ch 13The Fetch–Execute LoopFetch, decode, execute, repeat — the loop that runs every program ever written. ch 14Making DecisionsFlags, comparisons and jumps — how a CPU chooses which instruction runs next. ch 15The Control Unit is a ROMThe control unit demystified — it's just a ROM turning opcodes into control signals. ch 16ProgramsInstructions in sequence become a program — loops, calls and the stack, from raw opcodes. ch 17Up the Ladder: Real CPUsFrom toy CPU to real silicon — pipelines, caches and the tricks that make it fast. ch 18Bit ManipulationSqueeze meaning out of individual bits — masks, shifts and flags in real code. ch 19Talking to the WorldMemory-mapped I/O and interrupts — how a CPU talks to keyboards, screens and disks.