A CHIP-8 emulator in Javascript and p5.js(a great Javascript canvas library). Because of its simplicity, it is usually recommened as a first emulator one should try before going on to build complicated ones (though it is not necessary). I thought it would be fun so I decided to take on this project. It was cool and I totally enjoyed the process. You can even play pong and tetris on it 😃 . Try it out. Visit https://amosaidoo.com/chip8 to see the emulator in action.
CHIP-8 has 35 opcodes, which are all two bytes long and stored big-endian.
NNN
: address
NN
: 8-bit constant
N
: 4-bit constant
X
and Y
: 4-bit register identifier
PC
: Program Counter
I
: 16bit register (For memory address) (Similar to void pointer)
VN
: One of the 16 available variables. N may be 0 to F (hexadecimal)
Please check the chip-8 wikipedia page for the meaning of the opcodes.
Opcode | Implemented |
---|---|
0NNN | ❌ |
00E0 | ✅ |
00EE | ✅ |
1NNN | ✅ |
2NNN | ✅ |
3XNN | ✅ |
4XNN | ✅ |
5XY0 | ✅ |
6XNN | ✅ |
7XNN | ✅ |
8XY0 | ✅ |
8XY1 | ✅ |
8XY2 | ✅ |
8XY3 | ✅ |
8XY4 | ✅ |
8XY5 | ✅ |
8XY6 | ✅ |
8XY7 | ✅ |
8XYE | ✅ |
9XY0 | ✅ |
ANNN | ✅ |
BNNN | ✅ |
CXNN | ✅ |
DXYN | ✅ |
EX9E | ✅ |
EXA1 | ✅ |
FX07 | ✅ |
FX0A | ✅ |
FX15 | ✅ |
FX18 | ✅ |
FX1E | ✅ |
FX29 | ✅ |
FX33 | ✅ |
FX55 | ✅ |
FX65 | ✅ |