CHIP-8 WASM

Registers

0x0

0

0x1

0

0x2

0

0x3

0

0x4

0

0x5

0

0x6

0

0x7

0

0x8

0

0x9

0

0xA

0

0xB

0

0xC

0

0xD

0

0xE

0

0xF

0

What is Chip8?

Chip8 is an interpreted programming language developed in the 1970s. It was developed for the Chip8 virtual machine to simplify video game development for 1800 Microprocessor Systems. It consists of 35 Unique Opcodes, 4KB of RAM, 1MHz CPU, 32 x 64 pixel display and a hexadecimal keyboard.

How did I Implement it?

I started implementing Chip8 in python but handling different integer sizes proved to be a nightmare. After a little research, I went with rust. I started by implementing the minimum viable opcodes namely DXYN, ANNN, 7XNN, 6XNN, 1NNN and getting the IBM rom to display. I then realized that I wanted to run it in the browser so I used wasm-pack, an all in one WebAssembly project tool. The rust code is compiled to the wasm32-unknown-unknown target with Object bindings exposed via wasm-bindgen. We then use the bindings in JS client code to read from display memory and run the cpu at 10 times on each of the requestAnimationFrame calls

How Does it Work?

This chip8 emulator works by first selecting a ROM from the drop down menu, then pressing Run ROM. To interact with a rom you will use your keyboard. The mapping is as follows

Trip8 is my favorite ROM!