Educational project for learning about emulation and practicing Rust.
- Rust toolkit, including cargo
- SDL2 installation. On Mac OS, this is as simple as running
brew install sdl2
.
The project can be built with the following command for debug mode.
cargo build
Or the following for release mode with optimisations.
cargo build --release
These commands will put the compiled binary into the respective folder in the target
directory. Once the project has been built, it can be run with the following command.
chip8 [OPTIONS] <ROM>
The emulator can also be run without explicitly building with the following.
cargo run -- [OPTIONS] <ROM>
The help text can be displayed with
chip8 --help
The controls listed here correspond to the Chip8 keypad. See the Keypad section for details on how it maps to your keyboard.
Player vs CPU game of classic Pong. Move up with 1
and down with 4
.
Test ROM which tests the conditional jump, mathematical and logical operations ofd the CPU. If all tests are successful, 'BON' is displayed.
Demo ROM which randomly walks along the display and inverts pixel values.
Demo ROM which shoots random particles from the bottom centre of the display.
Traditional puzzle game where the player aims to reverse the keypad by sliding values into the empty space. To move a tile into the empty space, press the keypad button which corresponds to its current location.
Well known arcade game where the aim is to destroy all the aliens which move towards the bottom of the display. Shoot with 5
, move with 4
and 6
. Press 5
to begin a new game.
Test ROM which highlights the button which has been pressed on the display.
The following options are available. All of them are optional and have sensible default values which mimic the original Chip8 implementations.
Specifies the keypad mapping to use. See the Keypad section below for details on what each option corresponds to.
-k <KEYMAP>
--keymap <KEYMAP>
qwerty
(default)dvorak
The CPU clock multiplier to use. By default, the CPU runs at 500Hz. A value of 1
will set this. A value of 2
will set it to 1000Hz, and a value of 0.1
will set this to 50Hz.
-m <MULTIPLIER>
--multiplier <MULTIPLIER>
- Any positive float (default
1.0
)
The scale of the display. Each pixel on the Chip8 display will be represented by a square this many pixels in height/width on your display. The Chip8 display is 64x32 pixels. A value of 10
will mean a 10x10 pixel square represents each pixel on the Chip8 display.
-s <SCALE>
--scale <SCALE>
- Any positive integer (default
10
)
The Chip8 keypad takes the following form:
1 2 3 C
4 5 6 D
7 8 9 E
A 0 B F
This corresponds to the following keys on a QWERTY keyboard:
1 2 3 4
Q W E R
A S D F
Z X C V
And the following on a Dvorak keyboard:
1 2 3 4
' , . p
a o e u
; q j k