Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | Рortuguês

Imagem logo

RISC8Emulator

GitHub license GitHub stars GitHub stars

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.

Features

  • 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).

File Structure

  • 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.

Prerequisites

  • 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.

Installation

  1. Clone the repository:
git clone https://github.com/alvarorichard/RISC8Emulator.git
  1. Navigate to the project directory:
cd RISC8Emulator

Running the Emulator

Build the project:

zig build

Then run it, passing your ROM as an argument:

zig build run -- path/to/game.rom

Or run the built binary directly:

./zig-out/bin/RISC8Emulator path/to/game.rom

If 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.

Contributing

Contributions to improve or enhance the emulator are always welcome. Please adhere to the standard pull request process for contributions.

About

RISC8Emulator is a software recreation of the CHIP-8 system, a simple computer from the mid-1970s primarily used for playing video games.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages