Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kgabis/chip8
A CHIP-8 and SUPER CHIP emulator in C.
https://github.com/kgabis/chip8
c chip8 emulator
Last synced: 25 days ago
JSON representation
A CHIP-8 and SUPER CHIP emulator in C.
- Host: GitHub
- URL: https://github.com/kgabis/chip8
- Owner: kgabis
- Created: 2018-01-13T18:54:35.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-13T19:03:50.000Z (almost 7 years ago)
- Last Synced: 2024-10-14T09:43:22.605Z (2 months ago)
- Topics: c, chip8, emulator
- Language: C
- Size: 186 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## About
A [CHIP-8/SUPER CHIP](https://en.wikipedia.org/wiki/CHIP-8) emulator library written in C. Most games should work but there might be some exceptions. Use at your own risk.## Usage
Please see example_sdl2.c for an example SDL2 client.API should be quite simple and self-descriptive, here's how a theoretical client might look like:
```c
chip8_t *ch8 = chip8_make();
if (ch8 == NULL) {
goto end;
}bool ok = chip8_load_program(ch8, program, program_size);
if (!ok) {
goto end;
}
while (true) {
chip8_keyboard_input_t input = {};
get_input(&input);
int num_ticks = chip8_is_super(ch8) ? 16 : 8;for (int i = 0; i < num_ticks; i++) {
ok = chip8_cpu_tick(ch8, &input);
if (!ok) {
goto end;
}
}if (chip8_should_beep(ch8)) {
beep();
}for (int y = 0; y < chip8_get_height(ch8); y++) {
for (int x = 0; x < chip8_get_width(ch8); x++) {
if (chip8_get_pixel(ch8, x, y)) {
draw_pixel(x, y);
}
}
}sleep_ms(16);
}
end:
chip8_destroy(ch8);
```## Screenshots
![blinky](screens/blinky.png)
![car](screens/car.png)
![breakout](screens/breakout.png)## License
[The MIT License (MIT)](http://opensource.org/licenses/mit-license.php)