Skip to content

Im-Rises/Chip8topia

Repository files navigation

Chip8topia

cmakeLogo cppLogo openglLogo

Description

Chip8topia is a Chip8 emulator written in C++ for Windows, Linux, macOS and WebAssembly. It uses OpenGL/WebGL for the rendering and ImGui for the UI. The application is compiled with CMake and uses Vcpkg for most dependencies. For the WebAssembly version, it uses Emscripten to compile with vcpkg for most dependencies as well.

It can emulate the original Chip8, the SCHIP1.1, SCHIPC and Xo-Chip.

Platforms:

  • Windows
  • Linux
  • macOS
  • WebAssembly

Emulated consoles:

  • Chip8
  • SCHIP1.1
  • SCHIPC
  • Xo-Chip

Screenshots

Chip8topia Tools Chip8topia Debug Tools
chip8topia-main-tools chip8topia-debug-tools
Invaders (Chip8) Car (SCHIP) T8NKS (Xo-Chip)
invaders-game-screenshot car-game-screenshot t8nks-game-screenshot
Alien Inv8sion Title Screen (Xo-Chip Octo) Alien Inv8sion Gameplay (Xo-Chip Octo)
alien-inv8sion-titlescreen alien-inv8sion-gameplay

Features

Main

  • Desktop and Web version
  • Chip8, SCHIP1.1, SCHIPC and Xo-Chip support
  • Pause/Resume/Restart the emulation
  • Change the emulation speed
  • Change the game colors
  • Fullscreen mode
  • Rom loader
  • Sound

Debug Tools

  • Registers viewer
  • Stack viewer
  • Memory Editor
  • Virtual Keypad
  • Disassembly
  • Disassembly controls (break, step, run, reset)
  • Breakpoints
  • Planes viewer

Controls

Original game controls

1 2 3 C
4 5 6 D
7 8 9 E
A 0 B F

Emulator game controls (QWERTY)

1 2 3 4
Q W E R
A S D F
Z X C V

TODO

Major:

  • Add Xo-Chip audio

Minor:

  • Cleanup the full handling of the sound emulation
  • Restarting a game when playing big xo-chip games will not reload the game from the start (we should reset memory and reload the game rom)
  • Improve disassembly (check TODO in the Chip8topiaDisassembly.cpp and Chip8topiaDisassembler)

Documentation

Rom links

Dependencies

Build

Before building, be sure to fetch all the git submodules and install vcpkg.

Submodule:

To fetch the submodules:

git submodule update --init --recursive

If you want to update the submodules:

git submodule update --remote

Build

Once you have fetched the submodules and installed vcpkg, you can build the project. Go to the root of the project and create a build directory.

Note Be sure to change the path to vcpkg or emscripten if necessary in the following commands.

Build for Windows or Linux

Use the following command to set up the build:

cmake -B [build directory] -S . -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake

Then build with:

cmake --build [build directory]

Build for WebAssembly (Emscripten)

Use the following command to set up the build:

emcmake cmake -B [build directory] -S . -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DVCPKG_TARGET_TRIPLET=wasm32-emscripten "-DCMAKE_EXE_LINKER_FLAGS=-s USE_SDL=2 -s FULL_ES3=1 -s WASM=1 -s EXPORTED_RUNTIME_METHODS=[ccall] -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS=[_main,_malloc,_free] --preload-file ../../Chip8Games --preload-file ../../shaders --preload-file ../../fonts" -DCMAKE_BUILD_TYPE=Release

then build with:

emmake make -C [build directory]

GitHub Actions

CMake Vcpkg Publish Binaries CMake Vcpkg Emscripten Publish

The project uses GitHub Actions to build and publish the desktop builds to the GitHub release page and publish the WebAssembly build to GitHub Pages.

Contributors

Quentin MOREL :

GitHub contributors