RISC8Emulator is a software recreation of the CHIP-8 system, a simple computer from the mid-1970s primarily used for playing video games. Written in Zig, a modern programming language, this emulator replicates the architecture and functionality of the original CHIP-8, offering a unique experience for retro gaming and computer history enthusiasts.
- Memory: Emulates the CHIP-8's 4 KB RAM.
- Display: Simulates the 64x32 pixel monochrome display.
- Program Counter (PC): Manages the flow of the program.
- Index Register (I): A 16-bit register for pointing to memory locations.
- Stack: Utilized for storing 16-bit addresses for function calls and returns.
- Delay Timer: An 8-bit timer decrementing at a rate of 60 Hz.
- Sound Timer: Similar to the delay timer but emits a beep when not zero.
- Registers: Comprises 16 8-bit general-purpose registers (V0-VF).
main.zig: Entry point of the application, initializing the emulator.display.zig: Handles the CHIP-8's monochrome display.device.zig: Integrates components like memory and display.cpu.zig: Responsible for the CPU functionality and instruction execution.bitmap.zig: Manages bitmap operations for graphics.
SDL2 is imported directly from C via @cImport inside display.zig.
- Zig programming language installed on your system.
- ROM Requirement: To run a game, a CHIP-8 ROM file must be added. This emulator does not come with any preloaded games, so you need to provide your own ROM.
- Clone the repository:
git clone https://github.com/alvarorichard/RISC8Emulator.git- Navigate to the project directory:
cd RISC8EmulatorBuild the project:
zig buildThen run it, passing your ROM as an argument:
zig build run -- path/to/game.romOr run the built binary directly:
./zig-out/bin/RISC8Emulator path/to/game.romIf you start it without a ROM argument, the emulator prompts you for the path interactively — just type or drag-and-drop the ROM file and press Enter (empty Enter exits).
Requires Zig 0.16 and SDL2.
Contributions to improve or enhance the emulator are always welcome. Please adhere to the standard pull request process for contributions.
