GithubHelp home page GithubHelp logo

zyadz2000 / chip-8-emulator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sarbajitsaha/chip-8-emulator

0.0 0.0 0.0 1.18 MB

A simple Chip 8 Emulator written in C++

License: GNU General Public License v3.0

C++ 99.80% CMake 0.20%

chip-8-emulator's Introduction

Chip 8 Emulator

This is a simple Chip 8 emulator written in C++. CHIP-8 is an interpreted programming language, developed by Joseph Weisbecker. It was initially used on the COSMAC VIP and Telmac 1800 8-bit microcomputers in the mid-1970s. CHIP-8 programs are run on a CHIP-8 virtual machine. It was made to allow video games to be more easily programmed for said computers.

This article on Wikipedia explains the virtual machine(CPU,memory,display and keypad) and the opcodes supported.

Screenshots

PONG2

alt text

BRIX

alt text

Building

Cmake and SDL2 are required for this project. You can install them on Ubuntu using

$ sudo apt-get install cmake libsdl2-dev

For compilation

$ cd cmake-build-debug
$ cmake ..
$ make

The executable file, Chip8_Emulator, will be in the cmake-build-debug folder

Running

You need to provide the path to a ROM file as an argument. 23 ROMS have already been provided in the "roms" directory (downloaded from https://www.zophar.net/pdroms/chip8/chip-8-games-pack.html).

So you can start the PONG game available in the roms directory by

./Chip8_Emulator ../roms/PONG

Test

To run tests

cd cmake-build-debug
make tests
./tests

Catch testing framework is used. More tests need to be added, so PRs are welcome.

Modes

There are two modes available - trace mode and single step mode. You can also type -help to check usage

  • Trace mode - Type -t to print the program counter, register values and opcode executed each cycle. It follows this pattern:

    pc opcode I sp V0 to VF

  • Single step mode - Type -s flag to execute one instruction at a time waiting for you to press enter after each cycle.

Both modes can be used simultaneously.

Keypad

The original Chip 8 had a hexadecimal keypad (0 - 9 and A - F). The key mapping here is as follows -

Chip 8 Key Keyboard Key
1 1
2 2
3 3
4 Q
5 W
6 E
7 A
8 S
9 D
0 X
A Z
B C
C 4
D R
E F
F V

License

This project is licensed under the GPLv3+. The file LICENSE includes the full license text.

chip-8-emulator's People

Contributors

sarbajitsaha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.