Skip to content

CHIP 8 Technical Reference

Sergio Luis Para edited this page Mar 21, 2018 · 1 revision

Hardware

The following sections describe the general hardware emulated by the original CHIP-8 emulator, in machines such as the Cosmac VIP and the Telmac 1800.

Memory

The CHIP-8 language uses 12 bits to address memory. This means it can address up to 4.096 bytes, located from address 0x000 to 0xFFF. The emulator occupies the first 512 bytes (from address 0x000 to 0x1FF), so these should not be used by any program that respects the original specification.

The uppermost 256 bytes (from 0xF00 to 0xFFF) are reserved for display refresh. The previous 96 bytes are reserved for call stack, internal use, and other variables.

+----------------+= 0xFFF (4095) End of Chip-8 RAM
|                |
+----------------+= 0xF00 (3840) Start of graphics memory
+----------------+= 0xEA0 (3744) Start of Stack & vars memory
|                |
|                |
|                |
| 0x200 to 0xFFF |
|     Chip-8     |
| Program / Data |
|     Space      |
|                |
|                |
|                |
+----------------+= 0x200 (512) Start of programs
| 0x000 to 0x1FF |
|  Reserved for  |
|  interpreter   |
+----------------+= 0x000 (0) Start of Chip-8 RAM

Registers

The CHIP-8 virtual machine has 16 general purpose registers, commonly designed as Vx, were x is an hexadecimal ID from 0 to F. The register VF should not be used by any program, as it is used as a carry flag.

CHIP-8 also has two special purpose registers for the delay and sound timers. Both registers are decremented at a constant rate of 60Hz until they hit zero. Check the Timers & Sound section for more information about these.

There are two registers that are not accessible by any program, and are only to manage program execution: the PC (Program Counter) and SP (Stack Pointer). The PC should be 16-bit (although only the less-significant 12 are used), while the SP can be 8-bit, and it points to the top-most level of the stack.

Stack

The stack is an array of 16, 16-bit values. Each value holds a memory address, used as the return address for subroutine calls, which means that CHIP-8 only allows up to 16 levels of nested subroutines before hitting a stack overflow.

Keyboard

Display

Timers & Sound

Instruction set