A simple CHIP-8 emulator written in C using SDL2.
- All instructions are 2 bytes long and are stored most-significant-byte first.
- 4K RAM (
0x0 ~ 0xfff
)0x0 ~ 0x1ff
: reserverd for system0x200 ~ 0xe9f
: freely used RAM0xea0 ~ 0xeff
: reserved for stack, internal use and other variables0xf00 ~ 0xfff
: for display
- 64x32 resolution display (1 bit per pixel)
- Font sprite starts at
0x000
, see details below - 8-bit delay and sound timer
- 16 8-bit registers
V0
~VF
- A 16-bit program counter (
PC
) - A 8-bit stack pointer (
SP
) - One 16-bit address register
I
- Instruction set
8XYE
:VF
should be the most significant bit ofVX
notVY
prior to the shift8XY6
: Same as aboveFX55
: Don't incresetI
FX65
: Same as above
1 2 3 C 1 2 3 4
4 5 6 D -> Q W E R
7 8 9 E A S D F
A 0 B F Z X C V
Mac OS:
- Install SDL2:
brew install sdl2
- Git clone the repo
make buildmac && make test
Windows:
- Download MSYS2 64bit from here: https://www.msys2.org/
- Update MSYS2:
pacman -Syu
- Install build tools and SDL2:
pacman -S make git mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-SDL2
- Start MSYS2 MinGW 64-bit Shell
- Git clone the repo
make buildwin && make test
There are a few roms in the rom
directory of repo.
BC_Test.ch8
and test_opcode.ch8
are used for testing the fundamental functions of our emulator.
test.ch8
is used for testing arbitrary instructions written by ourself.
All others are games for fully testing our emulator ๐ฎ.