Skip to content

columbladee/yac8emu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yet Another CHIP-8 Emulator

Another implementation of a CHIP-8 emulator, written in C with SDL2 for graphics and audio. So far I have confirmed that it builds. I cannot speak to the performance yet.

Table of Contents

Features

  • CPU Emulation: All 35 instructions - see ISA.md for details. Implemented in chip8.c
  • Graphics: Renders display with SDL2 - see src/graphics.c
  • Input Handling: 16 key input
  • Audio: Buzzer is emulated by generating a square wave - again with SDL2 - see src/audio.c .
  • Logging: For debugging purposes. See src/logger.c

Prerequisites

To build and run the emulator, you need:

  • C Compiler: GCC or any standard-compliant C compiler.
  • Make: To use the provided Makefile.
  • SDL2: Simple DirectMedia Layer library for cross-platform development.

Installing SDL2

Linux

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install libsdl2-dev

Building the Emulator

  1. Clone or Download the Repository:

    git clone https://github.com/columbladee/yac8emu.git
    cd yac8emu
  2. Ensure the Logs Directory Exists:

    The emulator logs information to a logs directory. Create it if it doesn't exist:

    mkdir -p logs
  3. Build Using Make:

    make

    This will compile the source files and produce an executable named chip8_emulator.

  4. Clean Build Artifacts (Optional):

    To clean up object files and the executable:

    make clean

Running the Emulator

./chip8_emulator path/to/your/rom.ch8
  • Replace path/to/your/rom.ch8 with the actual path to the CHIP-8 ROM file you want to run.
  • Ensure that the ROM file exists and is accessible.

Example:

./chip8_emulator roms/PONG.ch8

Controls

The CHIP-8 emulator maps the original hexadecimal keypad to your keyboard as follows:

+-----+-----+-----+-----+
|  1  |  2  |  3  |  4  |       
| 0x1 | 0x2 | 0x3 | 0xC |       
+-----+-----+-----+-----+      
|  Q  |  W  |  E  |  R  |       
| 0x4 | 0x5 | 0x6 | 0xD |   
+-----+-----+-----+-----+  
|  A  |  S  |  D  |  F  |      
| 0x7 | 0x8 | 0x9 | 0xE |       
+-----+-----+-----+-----+      
|  Z  |  X  |  C  |  V  |    
| 0xA | 0x0 | 0xB | 0xF |       
+-----+-----+-----+-----+        
  • Exit Emulator: Press ESCAPE or close the window.

Logging

  • The emulator generates logs in the logs/chip8_emulator.log file.

Resources

License

This project is licensed under the GPL-3 License.

About

Yet another Chip 8 Emulator - using C/SDL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published