A high-performance CHIP-8 emulator built with C++ backend compiled to WebAssembly (WASM) and a modern React frontend with a retro-themed UI.
CHIP-8 is an interpreted programming language from the mid-1970s. It's a simple 8-bit virtual machine that became popular for retro gaming and is still used today as a great introduction to emulation.
- 16 (8-bit) General Purpose Registers (V0-VF, each 8-bit)
- 4KB Memory (0x200 - 0xFFF for programs)
- 64x32 Pixel Display (monochrome)
- 16-Key Hexadecimal Keypad (0x0-0xF)
- 16-Level Stack (for subroutine calls)
- 8-bit Timers (Delay and Sound timers)
- 16-bit Program Counter
- 35 Instructions (all 2 bytes)
The emulator comes pre-loaded with 23 classic games including:
- PONG - The iconic arcade game
- TETRIS - Block stacking puzzle game
- INVADERS - Space shooter
- BREAKOUT - Brick breaker game
- MAZE - Maze navigation
- And many more!
git clone https://github.com/oyetanishq/chip8_emu.git
cd chip8_emucd website
yarn installyarn run devThe emulator will be available at http://localhost:5173 (or the port shown in your terminal).
yarn run buildIf you want to rebuild the C++ core:
- Install Emscripten
- Ensure CMake is installed
cd chip8_core
mkdir -p build/wasm
cd build/wasm
emcmake cmake ../..
make
# The compiled WASM module will be generated in `build/wasm/chip8_wasm.js`.If you want to rebuild the C++ core:
- Ensure SDL2 is installed
cd chip8_core
mkdir -p build/core
cd build/core
cmake ../..
make
./chip8_core ../../roms/TANKchip8_emu/
├── chip8_core/ # C++ emulator core
│ ├── src/
│ │ ├── chip8.cpp # Main emulator implementation
│ │ ├── instructions.cpp # Instruction set
│ │ ├── wasm_bindings.cpp # WebAssembly bindings
│ │ └── main.cpp # CLI entry point
│ ├── include/
│ │ └── chip8.hpp # Public interface
│ ├── roms/ # ROM files
│ └── CMakeLists.txt # Build configuration
│
├── website/ # React frontend
│ ├── src/
│ │ ├── pages/
│ │ │ └── home.tsx # Main emulator interface
│ │ ├── lib/
│ │ │ └── chip8_wasm.js # Compiled WASM module
│ │ └── global.css # Theme and styles
│ ├── public/
│ │ └── roms/ # Game ROMs
│ └── package.json
│
└── docs/ # Documentation
└── image.png # Project screenshot
- Open the emulator in your browser
- Select a ROM from the ROM Library on the left panel
- Click the Run button to start emulation
- Use your keyboard or the on-screen keypad to play
The CHIP-8 hexadecimal keypad maps to your keyboard:
1 2 3 4 → 1 2 3 C
Q W E R → 4 5 6 D
A S D F → 7 8 9 E
Z X C V → A 0 B F
Use the Speed slider in the controls bar to adjust emulation speed:
- Lower values = slower emulation (easier for slower games)
- Higher values = faster emulation (up to 1800Hz)
- Modify the C++ source in
chip8_core/src/ - Rebuild the WASM module using the steps above
- Copy the generated
.jsfiles towebsite/src/lib/ - Run
yarn buildto create the production bundle
- Place ROM files in
website/public/roms/ - Add the ROM name to the
AVAILABLE_ROMSarray inwebsite/src/pages/home.tsx - The emulator will automatically detect and list the ROM
Enjoy the nostalgia! 🎮✨