1. Your First Emoji Program
Move a number into the CPU, print it, and stop.
1. Predict and trace
Before running the Try program, predict its output and trace the first three executed instructions. Track the relevant registers, flags or memory as needed. Then step the program to compare.
📥 42 🖨️ ⏹️
Queue input: None
Initialize memory: All bytes initially zero
Try prediction key
Output: 42
| Instruction | PC before | PC after | R0 before | R0 after | Relevant state | Output |
|---|---|---|---|---|---|---|
| LOAD | 0 | 1 | 0 | 42 | {"registers":[42,0,0,0,0,0,0,0],"flags":{"zero":false,"negative":false,"overflow":false},"sp":255,"stack":[],"callStack":[],"loopStack":[],"memoryReads":[],"memoryWrites":[]} | None |
| 1 | 2 | 42 | 42 | {"registers":[42,0,0,0,0,0,0,0],"flags":{"zero":false,"negative":false,"overflow":false},"sp":255,"stack":[],"callStack":[],"loopStack":[],"memoryReads":[],"memoryWrites":[]} | 42 | |
| HALT | 2 | 2 | 42 | 42 | {"registers":[42,0,0,0,0,0,0,0],"flags":{"zero":false,"negative":false,"overflow":false},"sp":255,"stack":[],"callStack":[],"loopStack":[],"memoryReads":[],"memoryWrites":[]} | 42 |
2. Build and check
Write a program that prints 42 exactly once and halts. Use LOAD, PRINT, and HALT.
Required instruction types: LOAD, PRINT, HALT
Example challenge solution
LOAD 42 PRINT HALT
Actual checker fixtures
Case 1
- Input
None- Initial memory
All bytes initially zero- Expected output
42
3. Explain the machine
What is in R0 and output just before PRINT? What PC does HALT leave?
Reasoning and teaching note
R0=42; output empty before PRINT; output 42 after it; HALT at compiled index2.