Book companion · Programming & computer science · No plot spoilers

Code by Charles Petzold: summary, 2nd edition, and how to read it

Charles Petzold’s Code: The Hidden Language of Computer Hardware and Software explains how a computer works by building one on paper, starting from simple codes and electrical switches and ending at a working processor and operating system. It is written for readers who do not already know the field, and it rewards patience more than technical background.

What is Code by Petzold about?

The book answers one question: what is actually happening inside a computer? Petzold’s method, described in his preface, is to start with very simple concepts and build slowly toward a deep understanding of digital computers, using the language and symbols of real engineers instead of leaning on metaphors. He also chose old technology on purpose. Telegraphs and relays teach principles that outlast any particular chip, much as a study of the internal combustion engine could begin with the Model T.

The path runs through codes such as Morse and Braille, then Boolean logic, number systems, memory, arithmetic circuits, and the central processing unit. It then moves on to peripherals, the operating system, and programming. The focus is stand-alone computers, so the book does not explain how the internet is built.

Which edition: first (1999) or second (2022)?

The first edition appeared in September 1999 from Microsoft Press. The second edition was released in 2022, with a copyright date of 2023 on its title page; retailers list July or August 2022. Petzold says in the new preface that the first edition aged: Unicode got less than a page, JavaScript was never mentioned, and he felt he had never quite shown a real CPU working.

The 2nd edition fixes that. It is about 70 pages longer, with roughly 480 pages in all, and adds new chapters on a clock, the arithmetic logic unit, registers and busses, CPU control signals, loops, jumps and calls, and a closing chapter titled The World Brain. It also comes with a free companion site, CodeHiddenLanguage.com, with interactive versions of key circuits and no paywall. Our reading: choose the second edition unless you find a cheap first edition and only want the early chapters.

Is Code hard to read?

The first half is approachable for an adult reader with school arithmetic and no technical training. The second half asks for sustained attention. Petzold himself warns in the preface that readers may feel they are drowning in the CPU chapters, tells them to come up for air, and says that once Chapter 24 is done “the remainder of the book is a breeze.”

You do not need to code or know electronics. You do need to follow circuit diagrams step by step and tolerate abstraction. A pencil and a few hours per chapter in the middle of the book are more useful than speed.

How the book is organized: 28 chapters in seven stretches

The grouping below is ours; the chapter titles come from the publisher’s table of contents.

  1. Chapters 1 to 5: Best Friends; Codes and Combinations; Braille and Binary Codes; Anatomy of a Flashlight; Communicating Around Corners. Codes, and a first look at how electricity carries them.
  2. Chapters 6 to 8: Logic with Switches; Telegraphs and Relays; Relays and Gates. Boolean logic, then switches and relays wired into logic gates.
  3. Chapters 9 to 13: Our Ten Digits; Alternative 10s; Bit by Bit by Bit; Bytes and Hexadecimal; From ASCII to Unicode. Number systems, bits, bytes, and how text is encoded.
  4. Chapters 14 to 16: Adding with Logic Gates; Is This for Real?; But What About Subtraction? Arithmetic built from gates.
  5. Chapters 17 to 19: Feedback and Flip-Flops; Let’s Build a Clock!; An Assemblage of Memory. Circuits that remember, keep time, and form memory.
  6. Chapters 20 to 24: Automating Arithmetic; The Arithmetic Logic Unit; Registers and Busses; CPU Control Signals; Loops, Jumps, and Calls. The CPU is assembled piece by piece.
  7. Chapters 25 to 28: Peripherals; The Operating System; Coding; The World Brain. From hardware to software, and out to the wider world.

Key ideas in Code, in plain English

How to read Code: a reading plan

This plan is our suggestion. Read Chapters 1 to 13 at a relaxed pace of a chapter or two per sitting; they build the vocabulary. Slow down for Chapters 14 to 24, about 230 pages, and aim for one chapter at a time. Then finish the rest in a few sessions. The book’s page numbers put it near 460 pages of text, so a steady month is plausible.

Use the free companion site. It offers interactive illustrations for Chapters 6, 8, 10, 14 to 24, and 27, which suits the circuit-heavy sections. Redraw each major circuit yourself once. Chapter 27 includes assembly language and JavaScript, so you can see how the hardware you built is eventually driven by software. Petzold’s The Annotated Turing (Wiley, 2008), a guided tour through Alan Turing’s paper on computability, is a natural but harder follow-up.

Common sticking points and how to get past them

Discussion and self-check questions

  1. Why might a book about computers begin with flashlights, codes, and telegraphs?
  2. What can a relay do that a plain switch cannot?
  3. How does feedback turn simple gates into memory?
  4. Which part of a phone or laptop still feels like a black box after Chapter 24?
  5. Where does the book draw the line between hardware and software?
  6. Does teaching with old technology still work for today’s readers?

Sources

Checked October 20, 2026: the publisher’s second-edition sample pages (contents, preface, and a sample chapter), Pearson’s product page (edition, imprint, what is new), InformIT’s listing (page count, new chapters), the free CodeHiddenLanguage.com companion site, and Wikipedia (first-edition date and scope). Retail listings disagree on the exact 2022 release day, so this page gives only the year.

Related reading

This AI-assisted, source-checked companion is an original overview, not the book or a substitute for it. FeedLitra does not offer a copyrighted download.

Explore your own copy

Import your own lawfully obtained EPUB or PDF into FeedLitra to ask questions and map ideas while you read.