Skip to content

Akhil-py/chip8-emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chip-8 Interpreter

A Chip-8 emulator project designed to deepen my understanding of computer architecture.

This emulator uses SDL2 for graphics, sound, and key inputs.


How to Run

  1. Build the project using the provided Makefile. Navigate to the src directory and run:
    make
    
  2. Start the emulator with the following command:
    ./chip8 ../roms/<rom_name>
    

Note that this emulator was built on a linux environment, hence the Makefile provided will only work on unix environments.


Optional Command-Line Arguments

You can customize the emulator's behavior with the following flags:

General Options

  • --scale <value>

    • Default: 20
    • Specifies the scaling factor for the window size. Actual dimensions are calculated as WIDTH * SCALE and HEIGHT * SCALE.
  • --speed <value>

    • Default: 700
    • Sets the number of instructions to execute per second.

Alternate Instruction Implementations

These flags enable alternate behaviors for certain instructions based on variations introduced by other interpreters like Super-Chip, Chip-48, or the original COSMAC VIP:

  • --cp_shift

    • Default: false
    • Enables the alternate implementation of the OP_8xy6 and OP_8xyE instructions.
  • --sc_jump

    • Default: false
    • Enables the alternate implementation of the OP_Bnnn (Jump with offset) instruction.
  • --cosmac_mem

    • Default: false
    • Enables the original COSMAC VIP implementation of the OP_Fx55 and OP_Fx65 (Store/Load Memory) instructions. Without this flag, the Super-Chip and Chip-48 behaviors are used.

Example Usage

./chip8 ../roms/IBM_Logo.ch8 --cosmac_mem --sc_jump --scale 30 --speed 750

Chip-8 Key Mapping

Chip-8 to Interpreter Layout


Memory Map

+---------------+ = 0xFFF (4095) End of Chip-8 RAM
|               |
|               |
|               |
|               |
|               |
| 0x200 to 0xFFF| Program/Data Space
|               |
|               |
|               |
+- - - - - - - -+ = 0x600 (1536) Start of ETI 660 Chip-8 programs
|               |
|               |
|               |
+---------------+ = 0x200 (512) Start of most Chip-8 programs
| 0x000 to 0x1FF| Reserved for interpreter
+---------------+ = 0x000 (0) Start of Chip-8 RAM

Resources

About

An attempt at creating my first emulator :)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published