Assembly Lab
From a line of C to the bits in a register
Learn assembly by running instructions one at a time in your browser. The simulator supports a subset of 64-bit Arm instructions. In the lessons, you see C code beside its assembly instructions. After each instruction, you can inspect the register values and their bits, the flags and memory. You predict what will happen and write small assembly programs. Automatic checks test your answers and programs.
Modules labelled "Published draft" have lessons you can use now. These lessons may change.
The machine's state
- Fundamentals (Module 0): Learn one operation at a time, follow a function call, then combine the instructions. (Published draft)
- Registers and readings (Module 1): Put values in registers and read one bit pattern as unsigned, signed or hexadecimal. (Published draft)
- Adding, subtracting and the flags (Module 2): Add and subtract, follow the carries, and predict the four flags. (Published draft)
- Logic, shifts and masks (Module 3): Pick bits out of a word, and set, clear and move them. (Published draft)
Choosing what runs next
- Compare and branch (Module 4): Turn a C if statement into a compare and a branch, for signed and unsigned values. (Published draft)
- Loops (Module 5): Write counting loops, and find the loop that never ends. (Published draft)
Memory and wider values
- Loads, stores and widths (Module 6): Move values of different sizes between memory and registers. See how a smaller value fills a larger register. (Published draft)
- Arrays, strings and pointers (Module 7): Walk through an array and a string by address. (Published draft)
- Multiply and divide (Module 8): Multiply into a result twice as wide, divide, and meet the cases that go wrong. (Published draft)
Functions and C
- Calls and the stack (Module 9): Call a function, return from it, and keep values safe on the stack. (Published draft)
- From C to assembly (Module 10): Write C, watch it become instructions, and compare with a real compiler. (Published draft)
- Where C and the machine disagree (Module 11): Explore what happens when a C program relies on behaviour that the language does not guarantee. (Published draft)
- Running ARM64 outside Assembly Lab (Module 12): Assemble a bootable ARM64 program, trace its startup and debug it with GNU tools and QEMU. (Published draft)
- Running on Raspberry Pi 5 (Module 13): Boot the assembly trip computer on a Raspberry Pi 5 and test it through its serial connector. (Published draft)
Optional, after the parts
- The same programs on 32-bit ARM (Module A): Compare the course's A64 programs with recorded 32-bit Arm compiler output. (Published draft)
This course runs in your browser, so it needs JavaScript. With JavaScript turned off, you see only this summary of the plan.