Chip 8 is an interpreted programming language (more like a virtual machine), which was initially used on the Telmac 1800 8-bit microcomputers to make game programming easier.
- Interpreter occupies the first 512 bytes of memory space. Thus, programs written for the original system begin at memory location 512 (0x200)
- Uppermost 256 Bytes are reserved for display refresh
- 96 bytes below that are reserved for call stack, internal use, and other variables
- CHIP-8 has 16 8-bit dat aregisters namely V0-VF.
- VF is for carry flag.
- Address Register (I) is 16-bit wide
- 16 levels of stack
- Stack is used to store return addresses when subroutines are called.
- Chip-8 language uses a 64x32-pixel monochrome display
- Chip-8 draws graphics on screen through the use of sprites. (Sprite: group of bytes which are a binary representation of the image)
Opcode | Description | Implemented |
---|---|---|
00E0 | Clears the screen | ✅ |
00EE | Return from a subroutine | ✅ |
1NNN | Jump to address NNN | ✅ |
2NNN | Call subroutine at NNN | ✅ |
3XNN | Skips the next instruction if VX == NN | ✅ |
4XNN | Skips the next instruction is VX != NN | ✅ |
5XY0 | Skip the next instruction if VX == VY | ✅ |
6XNN | VX = NN | ✅ |
7XNN | Adds NN to VX | ✅ |
8XY0 | VX = VY | ✅ |
8XY1 | VX = VX OR VY | ✅ |
8XY2 | VX &= VY | ✅ |
8XY3 | VX ^= VY | ✅ |
8XY4 | VX += VY | ✅ |
8XY5 | VX -=VY | ✅ |
8XY6 | VX >>= 1 | ✅ |
8XY7 | VX=VY-VX | ✅ |
8XYE | VX <<= 1 | ✅ |
9XY0 | Skips the next instructions if VX != VY | ✅ |
ANNN | I = NNN | ✅ |
BNNN | PC=V0+NNN | ✅ |
CXNN | VX = rand() & NN | ✅ |
DXYN | Draws a sprite at coordinate (VX,VY) that has a width of 8 pixels and a height of N pixels | ❌ |
EX9E | Skips the next instruction if the key stored in VX is pressed | ❌ |
EXA1 | Skips the next instruction if the key stored in VX isn't pressed | ❌ |
FX07 | VX = delay_timer | ✅ |
FX0A | A key pressed is awaited, and then stored in VX | ❌ |
FX15 | delay_timer = VX | ✅ |
FX18 | sound_timer = VX | ✅ |
FX1E | I += VX | ✅ |
FX29 | Sets I to the location of the sprite for the character in VX | ✅ |
FX33 | Stores the BCD representation of VX | ✅ |
FX55 | memory = VX (V0-VF) | ✅ |
FX65 | VX = memory | ✅ |