Hello World
Your first emoji program! Loads a number and prints it.
beginner · basics
📥 42 🖨️ ⏹️
Output: 42
Try, inspect, change
Load an example into the lab, step through its instructions, then change a value. Each example includes its expected output.
Your first emoji program! Loads a number and prints it.
beginner · basics
📥 42 🖨️ ⏹️
Output: 42
Add two numbers together.
beginner · basics
📥 10 ➕ 5 🖨️ ⏹️
Output: 15
Perform multiple arithmetic operations.
beginner · basics
📥 100 ➕ 50 🖨️ ➖ 30 🖨️ ✖️ 2 🖨️ ➗ 4 🖨️ ⏹️
Output: 150, 120, 240, 60
Count down from 10 to 1 using a loop.
beginner · basics
LOAD 10 again: PRINT SUB 1 JUMP_IF_ZERO done JUMP again done: HALT
Output: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
Generate eight Fibonacci values with registers and a bounded loop.
intermediate · algorithms
LOAD 1 R1 LOAD 1 R2 LOOP 8 LOAD R1 PRINT COPY R0 R3 ADD R2 COPY R2 R1 COPY R0 R2 RETURN HALT
Output: 1, 1, 2, 3, 5, 8, 13, 21
Print 2⁰ through 2⁷: 1, 2, 4, 8, 16, 32, 64, 128.
intermediate · algorithms
📥 1 🖨️ ✖️ 2 🖨️ ✖️ 2 🖨️ ✖️ 2 🖨️ ✖️ 2 🖨️ ✖️ 2 🖨️ ✖️ 2 🖨️ ✖️ 2 🖨️ ⏹️
Output: 1, 2, 4, 8, 16, 32, 64, 128
Store two bytes, clear R0, then actually read them from memory.
intermediate · basics
LOAD 42 STORE 0 LOAD 99 STORE 1 LOAD 0 LOAD [0] PRINT LOAD [1] PRINT HALT
Output: 42, 99
Check if a number is even or odd using MOD.
intermediate · algorithms
📥 7 📊 2 🖨️ 📥 8 📊 2 🖨️ ⏹️
Output: 1, 0
Push and pop values on the stack.
advanced · advanced
📥 10 ⬆️ 📥 20 ⬆️ 📥 30 ⬆️ ⬇️ 🖨️ ⬇️ 🖨️ ⬇️ 🖨️ ⏹️
Output: 30, 20, 10
Multiply 6 × 7 using repeated addition.
intermediate · algorithms
LOAD 0 LOOP 7 ADD 6 RETURN PRINT HALT
Output: 42
Demonstrate AND, OR, XOR operations.
advanced · advanced
📥 12 🔀 10 🖨️ 📥 12 🔃 3 🖨️ 📥 12 🔄 15 🖨️ 📥 255 ❌ 🖨️ ⏹️
Output: 8, 15, 3, -256
Calculate the sum of numbers from 1 to 10.
beginner · algorithms
LOAD 1 R1 LOAD 0 R2 LOOP 10 LOAD R2 ADD R1 COPY R0 R2 LOAD R1 ADD 1 COPY R0 R1 RETURN LOAD R2 PRINT HALT
Output: 55
Calculate 5! (5 factorial = 120) using a loop.
intermediate · algorithms
LOAD 5 R1 LOAD 1 R2 LOOP 5 LOAD R2 MUL R1 COPY R0 R2 LOAD R1 SUB 1 COPY R0 R1 RETURN LOAD R2 PRINT HALT
Output: 120
Choose the larger of two small nonnegative integers using a signed 32-bit sign mask.
beginner · basics
LOAD 15 R1 LOAD 25 R2 LOAD R1 SUB R2 AND -2147483648 JUMP_IF_ZERO first LOAD R2 JUMP show first: LOAD R1 show: PRINT HALT
Output: 25
Swap values between R1 and R2 using the stack.
beginner · basics
📥 10 📋 R0 R1 📥 20 📋 R0 R2 📥 R1 🖨️ 📥 R2 🖨️ 📥 R1 ⬆️ 📥 R2 📋 R0 R1 ⬇️ 📋 R0 R2 📥 R1 🖨️ 📥 R2 🖨️ ⏹️
Output: 10, 20, 20, 10
Find the absolute value of a small signed 32-bit integer with a sign mask.
beginner · algorithms
LOAD -42 R1 LOAD R1 AND -2147483648 JUMP_IF_ZERO positive LOAD R1 MUL -1 JUMP show positive: LOAD R1 show: PRINT HALT
Output: 42
Count from 3 to 1, then 1 to 3.
beginner · basics
📥 3 🖨️ ➖ 1 ❓ 5 ⏭️ 1 📥 1 🖨️ ➕ 1 ⚖️ 4 ❓ 11 ⏭️ 6 ⏹️
Output: 3, 2, 1, 1, 2, 3
Double 7 twice using addition, equivalent to multiplying by 4.
intermediate · advanced
📥 7 📋 R0 R1 📥 R1 ➕ R1 📋 R0 R1 📥 R1 ➕ R1 📋 R0 R1 📥 R1 🖨️ ⏹️
Output: 28
Print first 5 triangle numbers: 1, 3, 6, 10, 15.
intermediate · algorithms
LOAD 0 R2 LOAD 1 R1 LOOP 5 LOAD R2 ADD R1 COPY R0 R2 PRINT LOAD R1 ADD 1 COPY R0 R1 RETURN HALT
Output: 1, 3, 6, 10, 15
Copy a value through all 8 registers.
intermediate · advanced
📥 42 📋 R0 R1 📋 R1 R2 📋 R2 R3 📋 R3 R4 📋 R4 R5 📋 R5 R6 📋 R6 R7 📥 R7 🖨️ ⏹️
Output: 42