Chip-8, 8X, ETI & Elf
Definitions
aaa | 12 bit address |
kk | 8 bit constant |
n | 4 bit constant |
x | Register number Vx (x = 0 to F) |
y | Register number Vy (y = 0 to F) |
I | Register I (12 bit) |
[I] | Memory value of address in register I |
NH | Bit 0-3 Horizontal Location Bit 4-7, Horizontal width |
NV | Bit 0-3 Vertical Location Bit 4-7, Vertical height |
1..9, A..F | Hexadecimal digits |
Chip-8 Syntax
Opcode | Mnemonic | Parameter | Definition |
---|---|---|---|
Fx1E | ADD | I, Vx | I = I + Vx |
7xkk | ADD | Vx, kk | Vx = Vx + kk |
8xy4 | ADD | Vx, Vy | Vx = Vx + Vy, VF = carry |
8xy2 | AND | Vx, Vy | Vx = Vx AND Vy, VF undefined |
2aaa | CALL | aaa | Call subroutine at aaa (16 levels) |
00E0 | CLS | Clear display | |
Dxyn | DRW | Vx, Vy, n | Draw n byte sprite stored at [I] at Vx, Vy. Set VF = collision |
1aaa | JP | aaa | Jump to address aaa |
Baaa | JP | V0, aaa | Jump to address aaa + V0 |
Fx33 | LD | B, Vx | Store BCD value of Vx in [I], [I+1], [I+2] |
Fx15 | LD | DT, Vx | Delaytimer = Vx |
Fx29 | LD | F, Vx | Point I to 5 byte numeric sprite for value in Vx |
Aaaa | LD | I, aaa | I = aaa |
Fx18 | LD | ST, Vx | Soundtimer = Vx |
Fx07 | LD | Vx, DT | Vx = Delaytimer |
Fx0A | LD | Vx, K | Vx = key, wait for keypress |
6xkk | LD | Vx, kk | Vx = kk |
8xy0 | LD | Vx, Vy | Vx = Vy, VF undefined |
Fx65 | LD | Vx, [I] | Read V0 .. Vx from [I] .. [I+x] |
Fx55 | LD | [I], Vx | Store V0 .. Vx in [I] .. [I+x] |
8xy1 | OR | Vx, Vy | Vx = Vx OR Vy, VF undefined |
00EE | RETURN | Return from subroutine (16 levels) | |
Cxkk | RND | Vx , kk | Vx = random AND kk |
3xkk | SE | Vx , kk | Skip next instruction if Vx == kk |
5xy0 | SE | Vx , Vy | Skip next instruction if Vx == Vy |
8xxE | SHL | Vx | Vx = Vx << 1, VF = carry |
8xyE | SHL | Vx , Vy | Vx = Vy << 1, VF = carry |
8xx6 | SHR | Vx | Vx = Vx >> 1, VF = carry |
8xy6 | SHR | Vx , Vy | Vx = Vy >> 1, VF = carry |
Ex9E | SKP | Vx | Skip next instruction if key Vx down |
ExA1 | SKNP | Vx | Skip next instruction if key Vx up |
4xkk | SNE | Vx, kk | Skip next instruction if Vx != kk |
9xy0 | SNE | Vx, Vy | Skip next instruction if Vx != Vy |
8xy5 | SUB | Vx, Vy | Vx = Vx - Vy, VF = !borrow |
8xy7 | SUBN | Vx, Vy | Vx = Vy - Vx, VF = !borrow |
0aaa | SYS | aaa | Call CDP1802 code at aaa |
8xy3 | XOR | Vx, Vy | Vx = Vx XOR Vy, VF undefined |
Chip-8X Syntax
All of the instruction from Chip-8, except 'Baaa: JP V0, aaa' are valid for Chip-8X. Chip-8X offers the following additional instructions:
Opcode | Mnemonic | Parameter | Definition |
---|---|---|---|
5xy1 | ADD8 | Vx, Vy | Vx = Vx + Vy (hex digits 00 to 77, mainly for manipulating the NH and NV parameters) |
02A0 | CLR | B BACK |
Step background 1 colour (-> blue, -> black, -> green, -> red ->) |
Bxy0 | CLR CLRL |
Vx, Vy Vx/Vz, Vy |
Set Vy colour @ Vx (NH), Vz (Vz has to be V(x+1)) (NV) |
Bxyn | CLR CLRH |
Vx, Vy, n Vx/Vz, Vy, n |
Set Vy colour @ Vx, Vz (Vz has to be V(x+1)) byte, n bytes vertically, n != 0 |
FxFB | INP1 | Vx | Input port 1 to Vx (waits for EF4=1) |
FxF8 | OUT3 | Vx | Vx to output port 3 (used for simple sound) |
ExF2 | SKP2 | Vx | Skip next instruction if key Vx on keypad 2 is down |
ExF5 | SKNP2 | Vx | Skip next instruction if key Vx on keypad 2 is up |
ETI-660 Chip-8 Syntax
All of the instruction from Chip-8 are valid for the TI-660 Chip-8 variant. ETI-660 Chip-8 offers the following additional instruction:
Opcode | Mnemonic | Parameter | Definition |
---|---|---|---|
0000 | EXIT | Return to Monitor | |
00F8 | TVON | Turn the screen on | |
00FC | TVOFF | Turn the screen off | |
00FF | NOP | Do nothing | |
Fx00 | LD | P, Vx | Set the pitch (frequency) of the tone generator (beeper) to Vx |
Elf Chip-8 Syntax
All of the instruction from Chip-8 are valid for the Elf Chip-8 variant and also offers the following additional instruction:
Opcode | Mnemonic | Parameter | Definition |
---|---|---|---|
Fx75 | OUT4 | Vx | OUT 4 with Vx |