Instructions are divided by Nibble.

Structure

  • First Nibble: Instruction type
  • Second Nibble (X): one of the registers V0-VF
  • Third Nibble (Y): one of the registers V0-VF
  • Fourth Nibble (N): A 4-bit number
  • Fourth + Fifth Nibble (NN): A 8-bit immediate number
  • Fourth + Fifth + Sixth Nibble (NNN): A 12-bit memory address

Instructions Table

CodeDescription
00E0Clear screen
1NNNJump, or set PC to NNN
6XNNSet register VX
7XNNAdd value to register VX. Overflow Flag not affected
ANNNSet memory register I to NNN
DXYNDisplay/Draw N pixel tall sprite from memory location at Index Register I at coordinate VX,VY.
All pixels that are 1 in the original sprite will turn the same pixels on at the memory location. If any pixels were turned off, set VF flag to 1.
Sprite image should not wrap.
0NNNExecute subroutine at address NNN
00EEReturn from subroutine by popping last address from stack
2NNNCall subroutine at memory location NNN
3XNNBranch statement if VX = NN
4XNNBranch statement if VX != NN
5XY0Branch statement if VX = VY
9XY0Branch statement if VX != VY
8XY0Set the value VX to VY
8XY1Set VX to Bitwise OR of VX, VY
8XY2Set VX to Bitwise AND of VX, VY
8XY3Set VX to Bitwise XOR of VX, VY
8XY4Set VX to addition of VX, VY. Affects Carry Flag
8XY5Set VX to subtraction VX - VY.
Set VF to 1 if we have a natural remainder
Set VF to 0 if we underflow
8XY7Set VX to subtraction VY - VX
Set VF to 1 if we have a natural remainder
Set VF to 0 if we underflow
8XY6Put value of VY into VX, then Bitwise Right Shift by one
Set VF to the bit that was shifted out.
8XYEPut value of VY into VX, then Bitwise Left Shift by one
Set VF to the bit that was shifted out.
BNNNJump with offset NNN + V0 used as Jump Table
CXNNGenerate a random number, Bitwise AND with NN and store result in VX
EX9ESkip instruction (increment PC by 2) if pressing a key corresponding to VX
EXA1Skip instruction (increment PC by 2) if key in VX is not pressed.
FX07Set VX to current value of CHIP-8 Delay Timer
FX15Set CHIP-8 Delay Timer to value in VX
FX18Set CHIP-8 Sound Timer to value in VX
FX1ESet Index Register I adds value in VX. Triggers Overflow Flag
FX0AYield until key at VX is pressed. Decrements PC if PC is incremented during fetch of Sec-Fetch-Dest
FX29Index register I set to address of hexadecimal character in VX
FX33Binary-coded decimal conversion. Takes number in VX and converts it into 3 decimal digits at Index Register I.
E.g: VX = 153. Then, I = 1, I+1 = 5, I+2 = 3
FX55Store all register values up to VX (V0-VX) at I. So:
I : V0
I+1 : V1

I+X : VX
FX65Load all register values up to VX (V0-VX) starting from I. So:
V0 : I

VX : I+X