All instructions are written in 'operation operand1, operand2...' style. All instructions assemble to 2-bytes unless otherwise stated.
Operand | Value |
---|---|
nnnn | A 16-bit unsigned integer constant. |
nnn | A 12-bit unsigned integer constant. |
nn | An 8-bit unsigned integer constant. |
vx, vy | A register with index between 0 and f. (v0, va) |
h | A 4-bit unsigned integer constant. |
@label | A label value. |
Assembles to a 16-bit unsigned constant integer at the located address. Takes up 2 bytes.
Assembles to an 8-bit unsigned constant integer at the located address. Takes up 1 byte.
Changes the program counter to the location value of 'label' or a 12-bit constant address.
Same as 'jp', but saves execution location so that it can be returned to with 'ret'
Returns to last execution location saved with 'call'.
Clears the screen.
Loads a constant 8-bit unsigned value into register 'vx'.
Copies the value of register 'vy' into register 'vx'.
Adds a constant 8-bit unsigned value to register 'vx'.
Adds the value of register 'vy' to register 'vx'. Register 'vf' is set to 1 if the addition results in an overflow. Otherwise, 'vf' is set to 0.
Subtracts the value of register 'vy' from register 'vx' and stores the result in register 'vx'. Register 'vf' is set to 0 if a borrow is required. Otherwise, 'vf' is set to 1.
Subtracts the value of register 'vx' from register 'vy' and stores the result in register 'vx'. Register 'vf' is set to 0 if a borrow is required. Otherwise, 'vf' is set to 1.
Performs the binary or operation on register 'vx' and register 'vy' and stores the result in register 'vx'.
Performs the binary and operation on register 'vx' and register 'vy' and stores the result in register 'vx'.
Performs the binary xor operation on register 'vx' and register 'vy' and stores the result in register 'vx'.
Sets the value of register 'vf' to the most significant bit of register 'vx', then multiplies 'vx' by 2.
Sets the value of register 'vf' to the least significant bit of register 'vx', then divides 'vx' by 2.
Skips the next instruction if register 'vx' is equal to a constant 8-bit unsigned value.
Skips the next instruction if register 'vx' is equal to register 'vy'.
Skips the next instruction if register 'vx' is not equal to a constant 8-bit unsigned value.
Skips the next instruction if register 'vx' is not equal to register 'vy'.
Sets register 'vx' to a random number that is the binary and of a random integer and a constant 8-bit unsigned value. (rand() & nn)
Loads into address register 'i' the address of 'label' or a 12-bit constant address.
Adds the value of register 'vx' to the address register 'i'.
Draws an 8xh sprite, with data starting at 'i', at location 'vx', 'vy' on the screen. If a pixel is drawn over an existing pixel, the pixel is turned off and register 'vf' is set to 1.
Skips the next instruction if the key whose index is stored in register 'vx' is pressed.
Skips the next instruction if the key whose index is stored in register 'vx' is not pressed.
Loads into the delay timer the value of register 'vx'.
Loads into the sound timer the value of register 'vx'.
Loads into register 'vx', the value of the delay timer.
Pauses execution until a key is pressed, then sets register 'vx' to the index of the key pressed.
Loads into the register 'i' the location of the sprite representing the value of register 'vx'.
Writes the BCD representation of the value of register 'vx' to memory starting at the address stored in register 'i'.
Copies the values of registers 'v0' through 'vx' to memory starting at the address stored in 'i'.
Reads the values of registers 'v0' through 'vx' from memory starting at the address stored in 'i'.