- Memoria: Acceso directo hasta 4KiB de RAM.
- Display: Pantalla monocroma de 64 x 32 píxeles (128 x 64 para SUPER-CHIP).
- Registros:
Reg | Resolución | Función |
---|---|---|
PC | 16 bit | Contador de programa |
I | 16 bit | Registro índice |
V0-F | 8 bit | Registros de propósito general |
VF | 8 bit | Registro de flags |
- Pila con direccionamiento de 16 bits.
- Temporizador de 8 bits que se decrementa 60 veces por segundo hasta que llega a 0.
- Temporizador de 8 bits que funciona como el anterior, pero si distinto de 0 pita.
- Keypad de 16 botones (4 x 4).
(from https://github.com/trapexit/chip-8_documentation)
Opcode | Mnemonic | Origin/Version | Description |
---|---|---|---|
001N | EXIT N | CHIP-8 | From Peter Miller’s chip8run. Exit emulator with a return value of `N`. |
00BN | SCU N | SCHIP-8 | Scroll display `N` lines up. |
00CN | SCD N | SCHIP-8 | Scroll display `N` lines down. |
00E0 | CLS | CHIP-8 | Clears the display. Sets all pixels to `off`. |
00EE | RET | CHIP-8 | Return from subroutine. Set the `PC` to the address at the top of the stack and subtract `1` from the `SP`. |
00FA | COMPAT | CHIP-8 | Non-standard. Toggles changing of the `I` register by `save (FX55)` and `restore (FX65)` opcodes. |
00FB | SCR | SCHIP-8 | Scroll display `4` pixels to the right. |
00FC | SCL | SCHIP-8 | Scroll display `4` pixels to the left. |
00FD | EXIT | SCHIP-8 | Exit the interpreter. |
00FE | LOW | SCHIP-8 | Enable low res (64x32) mode. |
00FF | HIGH | SCHIP-8 | Enable high res (128x64) mode. |
0NNN | CALL NNN | CHIP-8 | Call machine language subroutine at address `NNN`. |
02A0 | STEPCOL | CHIP-8X | Steps background 1 color (-> blue -> black -> green -> red ->) |
1NNN | JMP NNN | CHIP-8 | Set `PC` to `NNN`. |
2NNN | CALL NNN | CHIP-8 | Call subroutine a `NNN`. Increment the `SP` and put the current `PC` value on the top of the stack. Then set the `PC` to `NNN`. Generally there is a limit of 16 successive calls. |
3XNN | SE VX, NN | CHIP-8 | Skip the next instruction if register `VX` is equal to `NN`. |
4XNN | SNE VX, NN | CHIP-8 | Skip the next instruction if register `VX` is **not** equal to `NN`. |
5XY0 | SE VX, VY | CHIP-8 | Skip the next instruction if register `VX` equals `VY`. |
5XY1 | SGT VX, VY | CHIP-8E | Skip the next instruction if register `VX` is greater than `VY`. |
5XY1 | ADD VX, VY | CHIP-8X | Let `VX = VX + VY` (hex digits 00 to 77) (useful for manipulating the `NH, NV` parameters for low resolution color.) |
5XY2 | SLT VX, VY | CHIP-8E | Skip the next instruction if register `VX` is less than `VY`. |
5XY3 | SNE VX, VY | CHIP-8E | Skip the next instruction if register `VX` does not equal `VY`. |
6XNN | LD VX, NN | CHIP-8 | Load immediate value `NN` into register `VX`. |
7XNN | ADD VX, NN | CHIP-8 | Add immediate value `NN` to register VX. Does **not** effect `VF`. |
8XY0 | LD VX, VY | CHIP-8 | Copy the value in register `VY` into `VX` |
8XY1 | OR VX, VY | CHIP-8 | Set `VX` equal to the bitwise `or` of the values in `VX` and `VY`. |
8XY2 | AND VX, VY | CHIP-8 | Set `VX` equal to the bitwise `and` of the values in `VX` and `VY`. |
8XY3 | XOR VX, VY | CHIP-8 | Set `VX` equal to the bitwise `xor` of the values in `VX` and `VY`. **Note:** This instruction was originally undocumented but functional due to how the 8XXX instructions were implemented on teh COSMAC VIP. |
8XY4 | ADD VX, VY | CHIP-8 | Set `VX` equal to `VX` plus `VY`. In the case of an overflow `VF` is set to `1`. Otherwise `0`. |
8XY5 | SUB VX, VY | CHIP-8 | Set `VX` equal to `VX` minus `VY`. In the case of an underflow `VF` is set `0`. Otherwise `1`. (`VF = VX > VY`) |
8XY6 | SHR VX, VY | CHIP-8 | Set `VX` equal to `VX` bitshifted right `1`. `VF` is set to the least significant bit of `VX` prior to the shift. Originally this opcode meant set `VX` equal to `VY` bitshifted right `1` but emulators and software seem to ignore `VY` now. **Note:** This instruction was originally undocumented but functional due to how the 8XXX instructions were implemented on teh COSMAC VIP. |
8XY7 | SUBN VX, VY | CHIP-8 | Set `VX` equal to `VY` minus `VX`. `VF` is set to `1` if `VY` > `VX`. Otherwise `0`. **Note:** This instruction was originally undocumented but functional due to how the 8XXX instructions were implemented on teh COSMAC VIP. |
8XYE | SHL VX, VY | CHIP-8 | Set `VX` equal to `VX` bitshifted left `1`. `VF` is set to the most significant bit of `VX` prior to the shift. Originally this opcode meant set `VX` equal to `VY` bitshifted left `1` but emulators and software seem to ignore `VY` now. **Note:** This instruction was originally undocumented but functional due to how the 8XXX instructions were implemented on teh COSMAC VIP. |
9XY0 | SNE VX, VY | CHIP-8 | Skip the next instruction if `VX` does **not** equal `VY`. |
9XY1 | MUL VX, VY | CHIP-8E | Set `VF`, `VX` equal to `VX` multipled by `VY` where `VF` is the most significant byte of a 16bit word. |
9XY2 | DIV VX, VY | CHIP-8E | Set `VX` equal to `VX` divided by `VY`. `VF` is set to the remainder. |
9XY3 | BCD VX, VY | CHIP-8E | Let `VX`, `VY` be treated as a 16bit word with `VX` the most significant part. Convert that word to BCD and store the 5 digits at memory location `I` through `I+4`. `I` does not change. |
ANNN | LD I, NNN | CHIP-8 | Set `I` equal to `NNN`. |
BNNN | JMP V0, NNN | CHIP-8 | Set the `PC` to `NNN` plus the value in `V0`. |
B0NN | OUT NN | CHIP-8I | Output `NN` to port. |
B1X0 | OUT VX | CHIP-8I | Output contents of `VX` to port. |
B1X1 | IN VX | CHIP-8I | Read input from port and palce in `VX`. |
BXY0 | COL VX, VY | CHIP-8X | Set `VY` color @ `VX(NH)`, `VX+1(NV)` (provides low resolution color 8x8.) |
BXYN | COL VX, VY, N | CHIP-8X | `N != 0`, set `VY` color @ `VX`, `VX+1` byte `N` bytes vertically (provides high resolution 8x32.) |
CXNN | RND VX, NN | CHIP-8 | Set `VX` equal to a random number ranging from `0` to `255` which is logically `and`ed with `NN`. |
DXY0 | DRW VX, VX, 0 | SCHIP-8 | When in high res mode show a `16x16` sprite at `(VX, VY)`. |
DXYN | DRW VX, VY, N | CHIP-8 | Display `N`-byte sprite starting at memory location `I` at `(VX, VY)`. Each set bit of `xor`ed with what’s already drawn. `VF` is set to `1` if a collision occurs. `0` otherwise. |
EX9E | SKP VX | CHIP-8 | Skip the following instruction if the key represented by the value in `VX` is pressed. |
EXA1 | SKNP VX | CHIP-8 | Skip the following instruction if the key represented by the value in `VX` is **not** pressed. |
EXF2 | SKP2 VX | CHIP-8X | Skip the following instruction if the key represented by the value in `VX` is pressed on hex keyboard 2. |
EXF5 | SKNP2 VX | CHIP-8X | Skip the following instruction the the key represented by the value in `VX` is **not** pressed on hex keyboard 2. |
FX07 | LD VX, DT | CHIP-8 | Set `VX` equal to the `delay timer`. |
FX0A | LD VX, KEY | CHIP-8 | Wait for a key press and store the value of the key into `VX`. |
FX15 | LD DT, VX | CHIP-8 | Set the delay timer `DT` to `VX`. |
FX18 | LD ST, VX | CHIP-8 | Set the sound timer `ST` to `VX`. |
FX1E | ADD I, VX | CHIP-8 | Add `VX` to `I`. `VF` is set to `1` if `I > 0x0FFF`. Otherwise set to `0`. |
FX29 | LD I, FONT(VX) | CHIP-8 | Set `I` to the address of the CHIP-8 8x5 font sprite representing the value in `VX`. |
FX30 | LD I, FONT(VX) | SCHIP-8 | Set `I` to the address of the SCHIP-8 16x10 font sprite representing the value in `VX`. |
FX33 | BCD VX | CHIP-8 | Convert that word to BCD and store the 3 digits at memory location `I` through `I+2`. `I` does not change. |
FX55 | LD [I], VX | CHIP-8 | Store registers `V0` through `VX` in memory starting at location `I`. `I` does not change. ’ |
FX65 | LD VX, [I] | CHIP-8 | Copy values from memory location `I` through `I + X` into registers `V0` through `VX`. `I` does not change. |
FX75 | DISP VX | CHIP-8E | Display the value of `VX` on the COSMAC Elf hex display. |
FX75 | LD R, VX | SCHIP-8 | Store `V0` through `VX` to HP-48 RPL user flags (X <= 7). |
FX85 | LD VX, R | SCHIP-8 | Read `V0` through `VX` to HP-48 RPL user flags (X <= 7) |
FX94 | LD I, VX | CHIP-8E | Load `I` with the address of the font sprite of the `ASCII` value found in `VX`. |
FXFB | IN VX | CHIP-8X | Copy contents from `input port` to `VX`. (Waits for EF4=1) |
FXF8 | OUT VX | CHIP-8X | Output contents of `VX` to `output port`. Used to program simple sound. |
Iré actualizando esto a la que vaya viendo artículos nuevos:
- https://github.com/trapexit/chip-8_documentation
- http://mattmik.com/files/chip8/mastering/chip8.html
- https://chip-8.github.io/extensions/
- https://courses.ece.cornell.edu/ece5990/ECE5725_Fall2016_Projects/Lab_group_bcp39_rk534/cpu.html
- http://www.pong-story.com/chip8/
- https://www.zophar.net/pdroms/chip8/chip-8-games-pack.html
- https://johnearnest.github.io/chip8Archive/
- https://tobiasvl.github.io/blog/write-a-chip-8-emulator/