Chip 8 Emulator
This is a CHIP-8 emulator built using C. Graphics and events were handled by SDL 2.0.
Overview
I have a fondness for retro gaming systems, having grown up with a Spectrum. As future projects in my mind include writing an emulator for Atari 2600 or similar, I felt that writing an emulator for a simple device such as CHIP-8 would be an ideal learning experience.
Background of CHIP-8
The CHIP-8 system has the following features:
- 35 16-bit opcodes.
- 4096 bytes of memory. The first 0x200 bytes are reserved for the interpreter - therefore when a ROM is loaded, it is loaded starting at 0x200.
- 16 8-bit registers called V0 to VF. V0 to VE are general purpose registers. VF is used for the carry / non-borrow flag for addition/subtraction. In addition to the carry flag, it is also used to indicate a collision when rendering.
- A 64x32 pixel monochrome display (2048 pixels).
- Program counter - used to indicate the location in memory of the current instruction.
- Index register - typically used to store memory locations. As there are 4096 bytes of memory, at least 12 bits are required.
- A stack - typically 16 levels of nesting. Used to store the current value of the program counter when calling subroutines.
- A delay timer and a sound timer. Both of these count down at 60Hz. When the sound timer is non-zero, a sound is produced.