Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksToolsOpen the lab →

Reading Code by Charles Petzold? Build its circuits yourself

Code: The Hidden Language of Computer Hardware and Software, by Charles Petzold, walks from switches and relays through logic gates, adders, flip-flops and memory to a working CPU and assembly language. The 2nd edition was published by Pearson Education in August 2022, and Petzold's free companion site, codehiddenlanguage.com, has interactive illustrations of the book's most important circuits. This page maps those chapters to circuits you can build yourself, part by part, in digiwleea's free browser lab.

What Code does best

Code explains each idea in plain language and builds it up one small step at a time, so a reader with no background can follow the whole path from a light switch to a processor. The companion site lets you click the switches of each finished circuit and watch it work, and it is free, with no paywall, cookies or tracking. (digiwleea is an independent project, not affiliated with Charles Petzold or his publishers.)

Building the circuits yourself

Reading about a circuit and clicking a finished one is not the same as wiring it yourself and finding out why your first try does not work. In digiwleea you build the book's circuits on a live simulator: gates from CMOS transistors (the modern version of Code's relays), then adders, flip-flops, memory, an ALU and a CPU that you program in assembly, with every part checked against its truth table, and a 40+ level course and an AI tutor (Wleea) for when you get stuck. The table further down lists, for each chapter with an interactive illustration, the matching builds and lessons.

Code (book and site)digiwleea
FormatA book, plus a free site of interactive illustrationsA browser lab and a guided course
The basic switchRelaysCMOS transistors
What you doRead, then toggle switches in finished circuitsPlace every part and wire yourself
Checks your circuitNo (illustrations)Yes, every part against its truth table
PriceThe book is paid; the site is freeFree lab and Act I; Premium for the full course

Chapter by chapter: build what you read

Every chapter with interactive illustrations on the companion site, the circuits it shows, and where to build or read the same thing on digiwleea:

No sign-up is needed to start: open the lab and place your first transistor, or read the free theory course. The account (and the AI tutor) are optional.

See for yourself: build a logic gate from transistors in the simulator, then follow the path from sand to an 8-bit CPU.

Open the digiwleea lab →

Frequently asked

Is there an online simulator for the circuits in Code by Charles Petzold?

Petzold's own companion site, codehiddenlanguage.com, has free interactive illustrations of the book's main circuits, where you toggle the switches of finished circuits. To build the circuits yourself, part by part, use a logic simulator such as digiwleea, which runs free in the browser.

Which chapters of Code have interactive circuits?

On codehiddenlanguage.com: chapters 6, 8, 10 and 14 to 24, plus chapter 27 on assembly language and JavaScript.

Do I need to read Code before using digiwleea?

No. digiwleea's free theory lessons and course start from a single switch, so either works on its own. They make a good pair: read a chapter, then build its circuits.

Does digiwleea use relays like the book?

No. Code starts with relays because they are easy to picture; digiwleea uses CMOS transistors, the switches inside modern chips. The logic is the same: switches in series make AND, and switches in parallel make OR.