项目作者: ajor

项目描述 :
Chip-8 / Super-Chip emulator
高级语言: C++
项目地址: git://github.com/ajor/chip8.git
创建时间: 2015-09-27T14:31:13Z
项目社区:https://github.com/ajor/chip8

开源协议:

下载


Chip-8 Emulator

Play online at http://ajor.co.uk/chip8

Native Build

This code has only been tested on Linux, although it may work on other platforms provided the required dependencies are available.

Requirements

  • A C++11 compiler
  • GLFW3
  • GLEW (OpenGL Extension Wrangler)

Compilation

Then compile using CMake:

  1. mkdir build
  2. cd build
  3. cmake ../
  4. make

or just run:

  1. g++ main.cpp chip8.cpp font_loader.cpp -std=c++11 -lglfw -lGLEW -lGL -lGLU -pthread -O3 -Wall -pedantic

Emscripten/asm.js Build

Requirements

Compilation

Compile using CMake, substituting the path to the Emscripten.cmake toolchain file on your system:

  1. mkdir build
  2. cd build
  3. cmake ../ -DCMAKE_TOOLCHAIN_FILE=/usr/lib/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release
  4. make

Usage

Native

  1. ./chip8 [options] rom
  2. Options:
  3. -i Instructions per step (default: 10)
  4. -s Screen scale factor (default: 20)

Emscripten/asm.js

Place chip8.html and the generated chip8.js and chip8.js.mem files in the same directory and open in a web browser.

General

You can adjust the speed of the emulator by changing instructions_per_step (defaults to 10). This parameter represents the number of Chip-8 instructions executed per frame.

Assuming a frame rate of 60fps, an instructions_per_step value of 10 (or a little higher) works well for most Chip-8 games tested, but Connect4 needs instructions_per_step=1 to be playable. Super-Chip games generally need to be run a bit faster - somewhere in the 20-60 range seems to work well.

Keyboard map

  1. Chip-8: QWERTY keyboard:
  2. 1 2 3 C 1 2 3 4
  3. 4 5 6 D Q W E R
  4. 7 8 9 E A S D F
  5. A 0 B F Z X C V

Pressing Enter resets the emulator.

Compatibility

  • All Chip-8 and Super-Chip games tested appear to work correctly

TODO

  • Stop using abort() everywhere
  • Fix threading