Source: https://mokxi.com/teachers/plans/chip8-emulator
Updated: 2026-11-19

Lesson plan

# Write a CHIP-8 emulator lesson plan

Build the classic first emulator in C++ on an ESP32-C3 handheld: memory, fetch-decode-execute, XOR sprites, keys, timers and a debugger, ending with an original game in 151 bytes.

3 chapters, 7 lessons, about 6 hours, on the ESP32-C3-DevKitM-1. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- The machine's state, and the loop that runs it.
- XOR sprites, a keypad on six buttons, and two timers at 60 Hz.
- A debugger to find a wrong byte, then a whole game.

### Materials for the whole unit

- ESP32-C3-DevKitM-1
- Full-size breadboard
- Game console buttons
- Piezo speaker
- TFT display, 240x320

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 50 min

## The processor

The machine's state, and the loop that runs it.

Lesson | Time | What students do

The machine CHIP-8 is a computer that was only ever software. Build its 4 KB of memory, sixteen registers, program counter and font, load a ROM at 0x200, and read it back byte by byte. | 55 min

- A computer that never existed
- Memory is a row of bytes
- The registers
- The font in memory
- Find a letter yourself

Fetch, decode, execute The loop inside every processor: read two bytes at PC, cut them into nibbles, do what they say. Watch a countdown ROM run line by line, hit an instruction the emulator does not know, and teach it. | 55 min

- Fetch
- Decode
- An instruction it does not know
- Teach it 7XNN
- Edit the ROM

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- Game console buttons
- Piezo speaker
- TFT display, 240x320

### Check for understanding

Each student finishes "Fetch, decode, execute" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Edit the ROM".

Chapter 2. About 2 h 25 min

## Screen, keys and sound

XOR sprites, a keypad on six buttons, and two timers at 60 Hz.

Lesson | Time | What students do

Display DXYN, the one drawing instruction: 8-pixel sprites from memory, drawn by XOR, with collisions in VF. Draw a rocket, erase it by drawing it again, label it with the font, and count the pixels. | 55 min

- One instruction draws everything
- XOR, and the flag
- Labels from the font
- Count the pixels
- Give it a bigger flame

Keypad Sixteen CHIP-8 keys on a six-button pad: read the buttons each frame, spot new presses, and run the three key instructions, including FX0A, which stops the program until you press something. | 45 min

- Waiting for a key
- Press A
- Press left
- Map B to F

Timers and sound Two timers that tick at 60 Hz: measure the delay timer to the millisecond, make the buzzer follow the sound timer, and edit the ROM for a longer beep. | 45 min

- Sixty ticks a second
- The sound timer
- Make it beep
- A longer beep

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- Game console buttons
- Piezo speaker
- TFT display, 240x320

### Check for understanding

Each student finishes "Timers and sound" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "A longer beep".

Chapter 3. About 1 h 50 min

## Debug and play

A debugger to find a wrong byte, then a whole game.

Lesson | Time | What students do

Debugging ROMs A ROM should write 600D and writes BAD. Drive the built-in debugger from the serial monitor: step, disassemble, set a breakpoint, read the registers, find the wrong byte and fix it. | 55 min

- It writes BAD
- Step and disassemble
- Set a breakpoint
- Read the registers
- Fix the byte

Boss: play a game The finished emulator runs Space Dodge, an original CHIP-8 game in 151 bytes: steer with the pad, dodge rocks, hear the beeps, and tune the game by editing its machine code. | 55 min

- Space Dodge
- Dodge one
- Crash into it
- Make the rocks faster
- Play, then share

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- Game console buttons
- Piezo speaker
- TFT display, 240x320

### Check for understanding

Each student finishes "Boss: play a game" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Play, then share".

Your class

## Teach this unit as a class

Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
