Thirty small steps into a computer

The OpenKernel course

Understand an idea, try it in a visible CPU, and solve a challenge checked by the machine. Start with three instructions and finish with your own tiny programs.

No account or installation. A lesson is completed only when your program passes every challenge case. Progress and badges stay in this browser.

Start lesson 1 → Open the free lab

Your progress

Progress is loaded in your browser.

Complete a unit to earn its badge. Badges record checked challenges, not visits.

Private browsing, clearing site data, or a different device may remove your local record. You can take any lesson in any order.

Unit 1 · about 20 minutes

Meet the Machine

Explain fetch/execute, registers, PC, output and stopping.

0 of 3 checked challenges complete

  1. Your First Emoji Program · 5 minutes

    Move a number into the CPU, print it, and stop.

  2. Understanding Registers · 8 minutes

    Use the eight fast workspaces without losing a value.

  3. Following the Program Counter · 7 minutes

    Read a trace and separate source lines from instruction addresses.

Unit 2 · about 28 minutes

Arithmetic and Input

Build integer calculations with saved inputs and test cases.

0 of 3 checked challenges complete

  1. Emoji Math · 9 minutes

    Combine addition, subtraction, and multiplication as ordered steps.

  2. Division and Remainders · 9 minutes

    Explain floor division and signed remainder, including negatives.

  3. A Two-input Calculator · 10 minutes

    Build a reusable calculator instead of a fixed answer.

Unit 3 · about 28 minutes

Byte Memory

Distinguish values from addresses and read/write byte storage.

0 of 3 checked challenges complete

  1. Memory: The Computer’s Notebook · 10 minutes

    Store and actually retrieve a byte after overwriting R0.

  2. Addresses in Registers · 9 minutes

    Use an address as data and read a lookup table.

  3. Bytes and Boundaries · 9 minutes

    See why memory wraps while registers do not.

Unit 4 · about 29 minutes

Decisions and Flags

Use comparison, remainder and labeled paths to express decisions.

0 of 3 checked challenges complete

  1. Conditional Logic: Making Decisions · 10 minutes

    Compare values, then branch on a stored flag.

  2. Even or Odd · 9 minutes

    Use remainder and a branch to classify input.

  3. A Memory-backed Decision · 10 minutes

    Make a decision from stored data and record the result.

Unit 5 · about 34 minutes

Repetition and Counters

Use bounded loops, zero cases, counters and accumulators.

0 of 3 checked challenges complete

  1. Loops: Repeating Things · 10 minutes

    Pair LOOP with RETURN and treat zero repeats correctly.

  2. Building a Counter · 12 minutes

    Print 1 to 10 and generalize the count.

  3. Sum One to N · 12 minutes

    Keep an accumulator separate from the loop counter.

Unit 6 · about 42 minutes

Algorithms with State

Describe and inspect factorial, Fibonacci and reverse-copy invariants.

0 of 3 checked challenges complete

  1. Factorial and Loop Invariants · 12 minutes

    Use a multiplicative accumulator and explain why 0! is 1.

  2. The Fibonacci Sequence · 15 minutes

    Keep two previous values and update them in a safe order.

  3. Reverse a Memory Buffer · 15 minutes

    Copy a buffer backward using source and destination pointers.

Unit 7 · about 39 minutes

The Stack and Functions

Use LIFO data, call frames and save/restore conventions.

0 of 3 checked challenges complete

  1. Stack Operations: Last In, First Out · 12 minutes

    Save values on the data stack and restore them in reverse order.

  2. Calling a Subroutine · 12 minutes

    Reuse code and return to the instruction after CALL.

  3. Preserving a Caller’s State · 15 minutes

    Use a save/restore convention when a function needs scratch space.

Unit 8 · about 39 minutes

Bits and Representation

Select and toggle bits and explain signed 32-bit behavior.

0 of 3 checked challenges complete

  1. Bit Masks and Flags · 12 minutes

    Select individual bits with AND and set them with OR.

  2. Toggling Bits · 12 minutes

    Use XOR’s reversible change to update a saved setting.

  3. Signed Bits and the Largest Value · 15 minutes

    Understand NOT and test a signed difference with a sign mask.

Unit 9 · about 45 minutes

Scheduling, Cores and Events

Distinguish scheduling policy, work partition and handler state restoration.

0 of 3 checked challenges complete

  1. Cooperative Scheduling · 15 minutes

    Take turns between tasks and distinguish policy from CPU instructions.

  2. Partitioning Work Across Cores · 15 minutes

    Divide independent jobs and combine their results.

  3. Interrupts and Handlers · 15 minutes

    Handle an event and restore the interrupted foreground value.

Unit 10 · about 56 minutes

Build Small Programs

Combine the instruction set into a game, buffer utility and job dispatcher.

0 of 3 checked challenges complete

  1. A Tiny Target Game · 18 minutes

    Build a three-round game with stored state and scoring.

  2. A Stack-powered Buffer Utility · 18 minutes

    Combine input, loops, the stack, and indexed storage.

  3. Your Own Mini Operating System · 20 minutes

    Dispatch queued jobs to reusable services and record their results.

First-time programmers welcome

Three beginner guides

Follow a short recipe and predict its output. Open that exact program in the lab, then take its lesson challenge to check your own solution.

Your First Program

Build a print-42 recipe, then follow its trace.

  1. Insert 📥 LOAD from the palette.
  2. Add the number 42 after LOAD.
  3. Add 🖨️ PRINT on the next line.
  4. Add ⏹️ HALT on the final line.
  5. Run and confirm that the actual console shows 42.
  6. Step through the recipe and notice R0, PC, and the output.
📥 42
🖨️
⏹️

Expected output: 42

Open guide in the lab →

Take the lesson challenge →

Emoji Math

Calculate 10 + 5 and watch the accumulator change.

  1. Insert 📥 LOAD.
  2. Load the number 10.
  3. Add ➕ ADD on the next line.
  4. Use 5 as the ADD operand.
  5. Add 🖨️ PRINT to display the result.
  6. Add ⏹️ HALT to stop.
  7. Run and confirm that the console shows 15.
  8. Step again and explain why PRINT sees the sum.
📥 10
➕ 5
🖨️
⏹️

Expected output: 15

Open guide in the lab →

Take the lesson challenge →

Countdown Loop

Count from five to one with a labeled exit.

  1. Insert 📥 LOAD.
  2. Set the starting count to 5.
  3. Name the PRINT instruction again: so the jump has a clear destination.
  4. Add ➖ SUB after printing.
  5. Subtract 1 each pass.
  6. Add ❓ JUMP_IF_ZERO immediately after SUB.
  7. Use the label done for the exit target.
  8. Add ⏭️ JUMP for the path that continues counting.
  9. Use the label again to return to PRINT.
  10. Add done: ⏹️ HALT after the loop.
  11. Run and confirm the actual output is 5, 4, 3, 2, 1.
  12. Trace the final subtraction: zero becomes true, and execution reaches HALT.
📥 5
again: 🖨️
➖ 1
❓ done
⏭️ again
done: ⏹️

Expected output: 5, 4, 3, 2, 1

Open guide in the lab →

Take the lesson challenge →