I'm diving into the nand2tetris course, but I'm feeling pretty stuck. The material often suggests just using a high-level language and available APIs to build things like an assembler or compiler, but that feels like bypassing the core learning experience for me. I really want to understand how each layer—like the assembler itself—works from the very basics, especially how it's implemented and interacts with the hardware. For instance, how was the first assembler created and run? Instead of just using an API, I want to explore the actual mechanics of building these systems from the bottom up. Does anyone else share this frustration? Are there any resources that delve deeper into the physical and self-hosted aspects of system building?
4 Answers
To grasp how the first assembler ran, you'll need to get into the CPU instruction set and see how assembly mnemonics relate to machine code. For example, mnemonics like `RET` in Z-80 Assembly translate to the machine code instruction `C9`. The initial assembler was built by hand, translating assembly languages into machine code, much like how Steve Wozniak created the AppleSoft BASIC interpreter. Learning this process with simpler CPUs can really help get you started.
I’m not super familiar with nand2tetris, but you might enjoy Ben Eater’s "Hello World" series on YouTube. While it doesn’t cover assemblers directly, it shows how to get a 'hello world' on a display, and I think it gives great foundational knowledge. Also, check out this video about the built-in monitor (wozmon) from the Apple 1—it provides some insights into assembly programs and memory manipulation, showing the effort it takes to code an assembler from scratch!
Before you head down into the deep end of things, it's helpful to learn some fundamental skills first. Understanding the basics of machine code and how assembly works is crucial.
If I remember correctly, you only dive into writing the assembler in the second half of the book after you’ve already built the CPU using nand gates, right? By that point, you should have also done some basic machine code programming. The initial assembler was probably written in machine code, dealing with the tedious process of translating Assembly into machine-executable format. It might feel like the book doesn’t cover the nuts and bolts you’re looking for, as it's more focused on teaching operations rather than pure machine code details.

What basic skills should I focus on?