The Benedict Year › The workshop
Project 6 · Weeks 31–33
The assembler
The translator from the language people write to the ones and zeros the machine runs. Done by hand, it is a code to break, like the Morse of Unit 2.
The kind of answer
Enacted. The instruction set is a law the machine keeps from without, never from within. The assembler applies the code exactly as it is written, line by line, as a rule is applied.
On paper first
Turn @17 into sixteen bits. Then turn D=M+1 into sixteen bits with the course’s tables. Check both with the Assembler.
What you build
In the Assembler. The files for Project 6 are in the IDE’s own projects folder, so there is nothing to download.
- Add.asm, translated by hand
- Max.asm, translated by hand
- Rect.asm, translated by hand
Each one is done when its test passes in the IDE. A pass cannot be argued with, and neither can a fail.
Week by week
About an afternoon a week. If a week runs long, let it: the strand keeps its own order, not the calendar’s.
| Week | Watch | Do |
|---|---|---|
| Week 31 | 6.1; 6.2; 6.3 | What an assembler is, and how each kind of instruction is translated. Translate Add.asm by hand and check it against the Assembler in the IDE. |
| Week 32 | 6.4; 6.6B | Symbols: labels and variables. Translate Max.asm by hand, finding the labels first and then everything else, as the lecture does. |
| Week 33 | 6.5; 6.6; 6.7 | Rect.asm by hand. Lectures 6.5 and 6.6 show how to write an assembler as a program; that is for a second year, so watch them as a look ahead. |
The lectures
8 lectures, about 123 minutes in all, by Nisan and Schocken. Watch with your parent, one or two at a sitting.
- 6.1 Assembly Languages and Assemblers 15:29
- 6.2 The Hack Assembly Language 9:05
- 6.3 The Assembly Process: Handling Instructions 11:29
- 6.4 The Assembly Process: Handling Symbols 20:14
- 6.6B Project 6 Overview: Without Programming 9:28
- 6.5 Developing a Hack Assembler 13:57
- 6.6 Project 6 Overview: Programming Option 32:12
- 6.7 Perspectives 11:13
For the parent
The course lets the assembler be written as a program or done by hand, and lecture 6.6B covers the by-hand way. A child who knows Scratch can build a small assembler there, with lists for the course’s tables, but it is not needed. Writing it in a real programming language is for a second year.
Public domain I have dedicated this page to the public domain under CC0 1.0. Copy it, change it, translate it, print it and share it, for any purpose, without asking. Quotations from other writers keep their own terms.