Skip to content

tommojphillips/Chip8-SDL2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chip8 Interpreter

A Chip-8 Interpreter For windows written in C using SDL2 for renderering and imgui for a simple menu and debug windows.


Input

Key Desc
Esc Toggle Main Menu
Ctrl+R Reset current program
Space Pause/Unpause
Plus ( + ) Increment Clock
Minus ( - ) Decrment Clock
Enter Step Program (when halted)
1 2 3 4  -->  1 2 3 C
Q W E R  -->  4 5 6 D
A S D F  -->  7 8 9 E
Z X C V  -->  A 0 B F

Loading Chip8 Programs

  • Drag n drop c8 files onto the window to load them
  • Launch a program using: `Chip8.exe <c8_file>

Dependencies


Building

The project is built in Visual Studio 2022

  1. Clone the repo
git clone https://github.com/tommojphillips/Chip8-SDL2.git
  1. CD to lib/ dir
cd Chip8-SDL2/lib
  1. Clone Chip8-Core into lib/ dir
git clone https://github.com/tommojphillips/Chip8-Core.git
  1. Clone imgui into lib/ dir
git clone --depth 1 --branch v1.91.6 https://github.com/ocornut/imgui.git
  1. Clone imgui-club into lib/ dir
git clone https://github.com/ocornut/imgui_club.git
  1. Download SDL2 VC package SDL2-devel-X.X.X-VC.zip (direct download link)

    • Extract and copy the include and lib folders into Chip8-SDL2/lib/SDL2 you will have to create the SDL2 directory
  2. Download SDL2 Image VC package SDL2_Image-devel-X.X.X-VC.zip (direct download link)

    • Extract the include and lib folders into Chip8-SDL2/lib/SDL2_Image you will have to create the SDL2_Image directory
  3. Open vc\Chip8-SDL2.sln in visual studio and build and run

The project directory structure should look like this:

Chip8-SDL2\
      | -- lib\
      |        | -- Chip8-Core\
      |        |              | -- chip8.h
      |        |              | -- chip8.c
      |        |              | -- chip8_defines.h
      |        |              | -- chip8_mnem.c
      |        |
      |        | -- imgui\
      |        |          | -- backends\
      |        |
      |        | -- imgui-club\
      |        |          | -- imgui_memory_editor\
      |        |
      |        | -- SDL2\
      |        |         | -- include\
      |        |         | -- lib\
      |        |
      |        | -- SDL2_Image\
      |                        | -- include\
      |                        | -- lib\
      |         
      | -- src\
      |
      | -- vc\
      |       | -- Chip8-SDL2.sln
      |       | -- Chip8-SDL2.vcxproj

Sources


Screenshots

Space Invaders (Pixel Spacing = 0)

Screenshot 2025-01-19 231610

Space Invaders (Pixel Spacing = 2)

Screenshot 2025-01-19 231629

Space Invaders (Pixel Spacing = 4)

Screenshot 2025-01-19 232304

Window / Display Settings

Screenshot 2025-01-19 231706

Chip8 Quirks / Setitngs

Screenshot 2025-01-19 231715

Display editor ( click pixel to toggle )

Screenshot 2025-01-19 231835

Display RAM editor

Screenshot 2025-01-19 231846

Instruction Debug & RAM editor

Screenshot 2025-01-19 231859