Code is my favorite technical book of all time [1]. Charles does an amazing job of building a computer up from basic principles "two young boys who want to communicate after their parents tell them to go to bed at night" all the way to modern (for 1999) computers. He layers abstraction on top of abstraction all the way to a working computer. My only (slight) disappointment in the book is that he tries to cover operating systems -> object oriented programming in a couple of chapters at the end. That could have been a multi-volume series in its own right.
It goes really well with Elements of Computing Systems (2nd ed) [2] which I kind of think of as a "lab manual" where you get to build a computer from first principles.
I picked it up years ago, got through the first few chapters, but then never finished it. I loved the early buildup and still want to go back and keep reading.
If you're actually looking for something that does build to a virtual computer, Nand2Tetris (second edition of the book The Elements of Computing Systems that goes with it is now out) is a great companion to Code: https://www.nand2tetris.org/.
Code is more high level, Nand2Tetris and Elements is project based but covers some similar territory.
The hardware exercises expect you to use a simple HDL, you write an assembler in your language of choice (I used Ruby, but others have used Python or JavaScript), and you write programs for the computer you "built" in earlier chapters using Jack (a language with Java-like syntax).
"Project 4 is written in the computer’s assembly language, and
projects 9 and 12 (a simple computer game and a basic operating system)
are written in Jack—the Java-like high-level language for which we build a
compiler in chapters 10 and 11."
Code is not more high level it starts from as low as you can get in terms of abstractions, it explains what electricity is and how it moves through wires and and moves on to creating simple logic gates using switches.
Highly recommend Nand2Tetris. I completed it a few months ago as a relatively non-technical person (I had only taken CS50 as my first CS class ever in 2020) and learned a ton.
GP said “builds up to.” It’s more about the abstractions adding up so that the reader understands how electrons can be programmed. There is no implementation of any kind of virtual or hardware machine in the book.
It’s been awhile so I might have missed a step or two. You’ll come away knowing how we used electricity to get from lightning bolts, to pocket computers. You will not come away with a programmable machine.
It’s more a book that actually shows you how a computer really works, from first principles.
It’s not a book about implementing a particular computer - it’s more about giving you the rough thought process about how it actually works at the level of electricity and wires, and how this gets built up into something that actually calculates stuff.
It’s the first book that took me from “computers are mystical magic” to “computers are understandable magic”.
There is a much older text book called the Art of Digital Design. In it, if you buy and solder the necessary components, you get a fully working PDP-8.
It goes really well with Elements of Computing Systems (2nd ed) [2] which I kind of think of as a "lab manual" where you get to build a computer from first principles.
[1] https://www.amazon.com/Code-Language-Computer-Hardware-Softw...
[2] https://www.amazon.com/Elements-Computing-Systems-second-Pri...