Code
Hidden Language of Computer Hardware and Software
Charles Petzold's explanation of how computers work, built from absolute first principles — starting with flashlights and Morse code and arriving, without skipping a step, at a working computer architecture.
- First published
- 1999
- Publisher
- Microsoft Press
- Pages
- 393
- Shelf
- Technology
- Level
- Core
- ISBN-13
- 9780735605053
Record checked against
Catalogue note
- Reads as
- TechnicalAssumes and builds craft knowledge.
- Level
- Core / BuildingAssumes general familiarity with the subject.
- Approach
- Applied
- Written for
- Engineers, Readers with some grounding
Saved in this browser only — no account, nothing sent anywhere. My library
Read this if
- You build software and want the ideas under the tools.
- You want to know how we got here.
- You work in this area and want depth rather than an overview.
- You know roughly how the subject works and want the fuller account.
The method
Petzold's approach is strictly constructive. Each chapter builds only on what has already been established, beginning with the idea of signalling between two children with torches and ending with a machine that executes instructions.
Nothing is asserted as a black box. Every component the book uses is built in front of the reader out of components built earlier, which is what makes the arrival at a computer feel inevitable rather than magical.
Nothing is a black box. Every component is built from ones already built, which is why the ending feels inevitable.
Devmark’s reading — not a quotation from the book
Codes and representation
The opening chapters establish that information can be represented in any system with enough distinguishable states — Morse, Braille, binary — and that the choice of representation is arbitrary while the information is not.
This groundwork matters because the rest of the book depends on the reader being comfortable that a number, a letter and an instruction can all be the same pattern of bits interpreted differently.
From switches to logic gates
His central construction: a relay is a switch controlled by electricity, and relays wired together implement Boolean logic — AND, OR, NOT — which Petzold builds explicitly.
This is the step most explanations skip, and it is the step that makes everything after it comprehensible. A reader who follows this chapter understands the bridge from physics to logic, which is where most intuitions about computers actually fail.
Arithmetic from logic
He then builds an adder from gates, carry propagation and all, and demonstrates that arithmetic is a consequence of logic rather than an additional capability.
The subsequent construction of memory from feedback loops — a flip-flop that holds a state — is the other genuinely surprising moment, because it shows that storage emerges from the same components rather than requiring anything new.
Building a computer
The book's payoff: assembling the accumulated components into a machine with an instruction set, a program counter, memory and a clock.
Petzold takes the reader through it slowly enough that the architecture is constructed rather than described, and the moment when the assembled parts begin executing a stored program is the clearest available explanation of what a computer actually is.
The moment the assembled parts execute a stored program is the clearest explanation of what a computer is.
Devmark’s reading — not a quotation from the book
The later chapters
After the machine works, he covers operating systems, floating point, graphics, the ASCII and Unicode standards, and the development of higher- level languages.
These are considerably more compressed than the earlier material and function as a survey rather than a construction. The book's distinctive quality is in the first two-thirds.
What the second edition changed
The 2022 revision updated the later material substantially, expanded the treatment of the transition from relays to transistors and integrated circuits, and improved the illustrations.
The core construction is unchanged, which is appropriate — the physics and logic of how a computer works have not moved, and that is precisely the part the book exists for.
Who it is for
Anyone who uses computers and does not know how they work, including professional programmers, many of whom have never built the bridge from transistor to instruction.
It assumes no mathematics beyond arithmetic and no prior technical knowledge, and it is genuinely accessible without being simplified — a combination that is much rarer than it sounds.
Where it demands patience
It is a cumulative book and cannot be skimmed. A reader who skips the relay chapters will not follow the adder, and one who skips the adder will not follow the machine.
Several chapters also require working through a diagram carefully rather than reading past it, which is more effort than the average technical book for a general reader asks for.
Why it matters
Because it removes magic. A great many people work with computers while holding a mental model that stops at some layer they have accepted without understanding, and this book is the most reliable way to close that gap.
The resulting understanding is also durable, because it is about principles that have not changed since the book was written and will not.
What to take away
- 01Representation is arbitrary, information is notMorse, Braille and binary all carry the same content; the encoding is a choice.
- 02Logic comes from switchesThe bridge from physics to Boolean logic is the step most explanations skip and the one intuitions fail at.
- 03Arithmetic is a consequence of logicAn adder built from gates shows that calculation requires no additional capability.
- 04Memory emerges from feedbackStorage comes from the same components looped back on themselves rather than from anything new.
- 05It cannot be skimmedEach chapter depends on the last, which is exactly why the ending is comprehensible.
