Skip to content
/ c-chip8 Public

Chip8 Emulator in C: A cross-platform Chip8 emulator with flexible display options (SDL or terminal) and data input methods (file or raw bytes). Built with CMake for easy configuration and compilation.

License

Notifications You must be signed in to change notification settings

wojlin/c-chip8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chip8 Emulator in C

This is a Chip8 emulator written in C. It supports cross-platform usage with two display options: SDL and terminal. Game data can be loaded either from a file or as a raw byte string.

Features

  • Cross-Platform: Compatible with various operating systems.
  • Display Options: Choose between SDL for a graphical interface or terminal for a text-based display.
  • Flexible Data Input: Load game data from a file or directly provide raw bytes.
  • Build System: Utilizes CMake for easy compilation and configuration.

Requirements

  • SDL2: Required if you choose the SDL display option. Make sure SDL2 is installed on your system.
  • CMake: Required for building the project.

Usage

To run the emulator, use the following command-line options:

./chip8-emulator --ui <terminal|window> --type <file|raw> --data <path to file|bytes>

Parameters

  • --ui <terminal|window>: Selects the display mode. Use terminal for text-based output or window for graphical output.
  • --type <file|raw>: Specifies the method for loading game data. Use file to read from a file or raw to input raw byte data.
  • --data <path to file|bytes>: If --type is file, provide the path to the game file. If --type is raw, input the raw bytes of the game data as a space-separated list of hexadecimal values.

Building

To build the project, follow these steps:

  1. Download dependencies

    • linux:
    sudo apt-get install libsdl2-dev
    • windows
    https://www.libsdl.org/
  2. Clone the repository:

    git clone https://github.com/yourusername/chip8-emulator.git
    cd chip8-emulator
  3. Create a build directory:

    mkdir build
    cd build
  4. Run CMake to configure the project:

    cmake ..
  5. Build the project:

    cmake --build .
  6. Run the emulator:

    ./chip8-emulator --ui terminal --type file --data path/to/game.ch8

Example Usage

Terminal Display with File Input

./chip8-emulator --ui terminal --type file --data games/pong.ch8

SDL Display with Raw Byte Input

./chip8-emulator --ui window --type raw --data 00E0 6000 6100 6200 6300 6400 6500 6600

Contributing

Feel free to submit issues or pull requests. Contributions are welcome!

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

  • SDL2 for the graphical display.
  • The Chip8 community for the resources and documentation.

Contact

For any questions or suggestions, please contact my email.

About

Chip8 Emulator in C: A cross-platform Chip8 emulator with flexible display options (SDL or terminal) and data input methods (file or raw bytes). Built with CMake for easy configuration and compilation.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published