https://github.com/basokant/chip-8-emulator
A CHIP-8 emulator written in C++.
https://github.com/basokant/chip-8-emulator
Last synced: 4 months ago
JSON representation
A CHIP-8 emulator written in C++.
- Host: GitHub
- URL: https://github.com/basokant/chip-8-emulator
- Owner: basokant
- License: mit
- Created: 2022-12-01T14:55:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-30T03:23:22.000Z (over 3 years ago)
- Last Synced: 2024-10-11T22:19:17.857Z (almost 2 years ago)
- Size: 2.09 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CHIP OFF THE BLOCK
A CHIP-8 emulator written in C++.
## Build
### Dependencies
* SDL2
* SDL2-mixer
The default SDL2 include path is under `/usr/include` on Linux. The proper lib path is also included by default.
If yours differs, add the paths to a `config.mk` file in the root directory as follows:
```makefile
# in /config.mk
SDL_INCLUDE_DIR :=
SDL_LIB_DIR :=
```
Using a UNIX environment, run `make` in the root directory to build the executable and the docs. Run `make chip8` or `make docs` to build just the executable or just the docs. Then, run `./chip8 ` to run a specified .ch8 file.
Custom ROMs are found in `roms`. 3rd party ROMs are found in `roms/3rdparty`.
* run `make clean` to clean up the intermediate build files in the build directory `build/`.
## Building Assembly Files
Dependencies:
* cargo
To build all assembly files in the `roms` directory, add the source file to `roms/Makefile` and run `make`.
(Make sure to pull git submodules as well).
## Configuration
Keyboard mapping and emulation speed can be controlled from `chip8.config.json`.
```json
{
"custom_keymap" : {
:
},
"emulation_speed" : 1.0, // factor: 2.0 runs twice as fast
"screen_width": 960 // screen height is half the screen width
}
```
The SDL key names can be found [here](https://wiki.libsdl.org/SDL2/SDL_Keycode) under "Key Name".
There are 16 CHIP-8 keys to map: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
## Controls
The default key mapping is as follows (to match the original hardware):
Keyboard
|||||
|---|---|---|---|
|1|2|3|4|
|Q|W|E|R|
|A|S|D|F|
|Z|X|C|V|
CHIP-8 Mapping
|||||
|---|---|---|---|
|1|2|3|C
|4|5|6|D|
|7|8|9|E|
|A|0|B|F|
Note: A-F are referenced by their hex values (e.g. 10 = A, 11 = B, etc.)