Crates.io | tinychip |
lib.rs | tinychip |
version | 0.1.1 |
source | src |
created_at | 2023-05-05 19:26:55.575964 |
updated_at | 2023-05-05 19:28:44.08758 |
description | CHIP-8 emulator/interpreter |
homepage | https://github.com/theobori/tinychip |
repository | https://github.com/theobori/tinychip |
max_upload_size | |
id | 857992 |
size | 82,374 |
CHIP-8 is an interpreted programming language, developed by Joseph Weisbecker made on his 1802 Microprocessor. It was initially used on the COSMAC VIP and Telmac 1800 8-bit microcomputers in the mid-1970s. - Wikipedia
It is able to supports multiple graphical APIs and multiple interpreter implementations. We consider an instruction ~= 1 cycle, so 500hz means it executes 500 instructions per second.
cargo
SDL2
(as library)cargo install --path .
tinychip --help
Name | Status |
---|---|
IBM logo | β |
Pong | β |
Space invaders | β |
Tetris | β |
1 | 2 | 3 | 4 |
A | Z | E | R |
Q | S | D | F |
W | X | C | V |
Some descriptions of the chip8 instructions differ depending on the machine. For example, the instructions 8xy6
and 8xye
do not do the same thing according to the documents.
In general throughout the documents there are two kinds of semantic for the load operations (fx55
, fx65
) and for the shift operations (8xy6
, 8xye
).
To use the original semantic, use the following flags:
--original-load=true
--original-shift=true
Opcode | Default | Original |
---|
8xy6 | Vx = Vx >> 1, Vf = carry | Vx = Vy >> 1, Vf = carry 8xye | Vx = Vx << 1, Vf = carry | Vx = Vy << 1, Vf = carry fx55 | I = I + x + 1 | β fx65 | I = I + x + 1 | β
Some games where we know the best compatibility settings, Github issue.
USAGE:
tinychip [OPTIONS] <rom>
FLAGS:
--help Prints help information
-V, --version Prints version information
OPTIONS:
--api <api> Graphical API, value(s): sfml, sdl
--cycles <cycles> Cycle(s) per second (Hz)
-h, --height <height> Window height
--interpreter <interpreter> Interpreter, value(s): original
--original-load <original-load> use the original semantic for fx55, fx65
--original-shift <original-shift> use the original semantic for 8xy6, 8xye
-w, --width <width> Window width
ARGS:
<rom> Input file
docker build -t tinychip .
In the example below, we have:
X11
as graphic serverPulseAudio
as sound serverdocker run -it \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /dev/dri:/dev/dri \
-v /dev/snd:/dev/snd \
-v $PWD/roms:/roms \
-v /run/user/$(id -u)/pulse/native:/run/user/$(id -u)/pulse/native \
-e PULSE_SERVER=unix:/run/user/$(id -u)/pulse/native \
-u $(id -u):$(id -u) \
tinychip /roms/brick.ch8
Name | Status |
---|---|
500Hz clock | β |
Basic instructions | β |
Handle every CLI args ΒΉ | β |
Debug features Β² | β οΈ |
Create font | β |
Add beep sound | β |
60Hz delay and sound timers | β |
ΒΉ CLI args:
Β² Features:
Run cargo doc --open
to read the documentation in the browser.