Chip 8 on the COSMAC VIP: Instruction Index

This is a series of posts in which I analyse the Chip-8 interpreter as implemented on the RCA COSMAC VIP. They are primarily intended to be of use to anyone writing a Chip-8 interpreter for another platform. However, they will also be of use to anyone wanting to know more about the COSMAC VIP in general.

I already have the existing posts indexed by article. I thought it would be useful to also have the articles indexed by Chip-8 instruction, so here is the list:

Instruction Description Relevant Articles
0XXX Calls a machine code subroutine at the address 0x0XXX Machine Code Integration
00E0 Clears the screen Machine Code Integration
00EE Returns from a subroutine Machine Code Integration

Branch and Call Instructions

1XXX Branches to the instruction at address 0x0XXX Branch and Call Instructions
2XXX Calls a subroutine at address 0x0XXX Branch and Call Instructions
3XNN Skip if VX = NN Skip Instructions
4XNN Skip if VX ≠ NN Skip Instructions
5XY0 Skip if VX = VY Skip Instructions
6XNN Load VX with NN Loading and Saving Variables
7XNN Add NN to VX Arithmetic and Logic Instructions
8XY1 OR VY with VX Arithmetic and Logic Instructions
8XY2 AND VY with VX Arithmetic and Logic Instructions
8XY3 XOR VY with VX Arithmetic and Logic Instructions
8XY4 Add VY to VX, load VF with carry bit Arithmetic and Logic Instructions
8XY5 Subtract VY from VX, load VF with carry bit Arithmetic and Logic Instructions
8XY6 Shift VY one bit right, load VX with result, load VF with bit 0 Arithmetic and Logic Instructions
8XY7 Subtract VX from VY, load VX with result Arithmetic and Logic Instructions
8XYE Shift VY one bit left, load VX with result, load VF with bit 7 Arithmetic and Logic Instructions
9XY0 Skip if VX ≠ VY Skip Instructions
AMMM Load I with the address 0MMM Loading and Saving Variables

Indexing the Memory

BXXX Branch to the address calculated by adding 0x0XXX to Chip-8 variable V0 Branch and Call Instructions
CXNN Load VX with a random number from 0 to 255 ANDed with NN Interrupts

Generating Random Numbers

DXYN Draw the N byte sprite stored at the address pointed to by I on the display at location X and Y. Set VF to 0×01 if any set pixel in the sprite overwrites an existing set pixel on the display, otherwise set VF to 0×00 Interrupts

Drawing Sprites

The Character Set

Binary Coded Decimal

EX9E Skip if VX = current key press Skip Instructions

Keyboard Input

EXA1 Skip if VX ≠ current key press Skip Instructions

Keyboard Input

FX07 Get the current value of the timer into VX Interrupts

The General Purpose Timer

FX0A Wait for a keypress and store the value in VX Interrupts

Keyboard Input

FX15 Set the timer with the value of VX Interrupts

The General Purpose Timer

FX18 Set the sound timer with the value in VX Interrupts

Sound

FX1E Add value in VX to I Indexing the Memory
FX29 Load I with address of sprite for the character in VX The Character Set

Binary Coded Decimal

FX33 Store the BCD representation of the value in VX at I, I+1 and I+2 Binary Coded Decimal
FX55 Save variables V0 through VX starting at the address in I Loading and Saving Variables
FX65 Load variables V0 through VX from memory starting at the address in I Loading and Saving Variables

Here is a PDF with the complete CHIP-8 Interpreter Disassembly.

This entry was posted in Chip-8, Retro Computing and tagged , , , , . Bookmark the permalink.

18 Responses to "Chip 8 on the COSMAC VIP: Instruction Index"

Leave a reply