Skip to content
/ ch8 Public

CHIP-8 Implementation in C++ while I was learning the language.

License

Notifications You must be signed in to change notification settings

migantoju/ch8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👾CHIP-8 Emulator👾

CHIP-8 implement in pure C++. Chip-8 Emulator

Summary

Chip-8 implementation in C++ programming language while I was learning the language.
If you see something to improve on my code, your welcome to add a comment or create a PR, It will help me a lot to improve.

I will improve the emulator gradually.

Built with 🧰

Usage 📐

First of all, you need to install cmake and SDL2

For Linux

$ sudo apt-get install cmake libsdl2-dev

For Mac OS

$ brew install cmake sdl2

Then, you need to compile the project and execute the binary/.exe file.

$ mkdir build
$ cd build
$ cmake ..
$ make

and to run:

$ ./chip8 <ROM filename>

and that's all, enjoy 😊.

Next Steps (TODO)

  • Add sound/beeper support
  • Improve execution timing
  • Add Super CHIP-8 Support
  • Add XO-CHIP support
  • Use function pointers instead of a giant switch statement
  • Improve graphics by adding filters (Hqx)
  • Port it to other platforms (Mobile? some portable video console?) or languages
  • Move on to a more complex project for example emulating a Gameboy (Z80 processor)
  • Add Xbox and/or PlayStation controller support
  • Create a Chip-8 game

Technical Ref

Memory Map diagram

+---------------+= 0xFFF (4095) End of Chip-8 RAM
|               |
|               |
|               |
|               |
|               |
| 0x200 to 0xFFF|
|     Chip-8    |
| 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

The original CHIP-8 used a hexadecimal keyboard so, for these times I changed the keys to normal keyboards:

Keypad       Keyboard
+-+-+-+-+    +-+-+-+-+
|1|2|3|C|    |1|2|3|4|
+-+-+-+-+    +-+-+-+-+
|4|5|6|D|    |Q|W|E|R|
+-+-+-+-+ => +-+-+-+-+
|7|8|9|E|    |A|S|D|F|
+-+-+-+-+    +-+-+-+-+
|A|0|B|F|    |Z|X|C|V|
+-+-+-+-+    +-+-+-+-+

Screenshots

Pong Game

Trip8 Rom

Resources

About

CHIP-8 Implementation in C++ while I was learning the language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published