Skip to content

Latest commit

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

CHIP-8 Compiler

This is a CHIP8 Compiler developed using JavaScript. It allows you to write code, compile, and see it in the emulator afterwards.

Usage

Compiler Screenshot

Click the Compile button to compile the code. Click Start or Step to run your code in the emulator. You can click Stop to stop the emulator, and you can click Reset to reset it. Clicking the Save button on the left will allow you to download the compiled binary file.

Language

Insturction names and descriptions are taked from Cowgod's Chip-8 Technical Reference v1.0.

OpcodeInstructionDescription
0nnnSYS addrJump to a machine code routine at nnn.
00E0CLSClear the display.
00EERETReturn from a subroutine.
1nnnJP addrJump to location nnn.
2nnnCALL addrCall subroutine at nnn.
3xkkSE Vx, byteSkip next instruction if Vx = kk.
4xkkSNE Vx, byteSkip next instruction if Vx != kk.
5xy0SE Vx, VySkip next instruction if Vx = Vy.
6xkkLD Vx, byteSet Vx = kk.
7xkkADD Vx, byteSet Vx = Vx + kk.
8xy0LD Vx, VySet Vx = Vy.
8xy1OR Vx, VySet Vx = Vx OR Vy.
8xy2AND Vx, VySet Vx = Vx AND Vy.
8xy3XOR Vx, VySet Vx = Vx XOR Vy.
8xy4ADD Vx, VySet Vx = Vx + Vy, set VF = carry.
8xy5SUB Vx, VySet Vx = Vx - Vy, set VF = NOT borrow.
8xy6SHR Vx VySet Vx = Vx SHR 1.
8xy7SUBN Vx, VySet Vx = Vy - Vx, set VF = NOT borrow.
8xyESHL Vx VySet Vx = Vx SHL 1.
9xy0SNE Vx, VySkip next instruction if Vx != Vy.
AnnnLD I, addrSet I = nnn.
BnnnJP V0, addrJump to location nnn + V0.
CxkkRND Vx, byteSet Vx = random byte AND kk.
DxynDRW Vx, Vy, nibbleDisplay n-byte sprite starting at memory location I at (Vx, Vy), set VF = collision.
Ex9ESKP VxSkip next instruction if key with the value of Vx is pressed.
ExA1SKNP VxSkip next instruction if key with the value of Vx is not pressed.
Fx07LD Vx, DTSet Vx = delay timer value.
Fx0ALD Vx, KWait for a key press, store the value of the key in Vx.
Fx15LD DT, VxSet delay timer = Vx.
Fx18LD ST, VxSet sound timer = Vx.
Fx1EADD I, VxSet I = I + Vx.
Fx29LD F, VxSet I = location of sprite for digit Vx.
Fx33LD B, VxStore BCD representation of Vx in memory locations I, I+1, and I+2.
Fx55LD I, VxStore registers V0 through Vx in memory starting at location I.
Fx65LD Vx, IRead registers V0 through Vx from memory starting at location I.

Dependencies

Resources

License

The source code is provided under MIT License.

Releases

Packages

Used by

Contributors

Languages