Mega/Super/HiRes/Chip-8 Emulator in C/C++, OpenGL, SDL, wxWidgets. I made it just to see if I was capable of doing an emulator and to learn how OpenGL/wxWidgets works. You can use the source as you want, but if you use the source, it would be kind to add a reference to me somewhere in your project ;-). It has been coded with Code::Blocks 13.12, gcc 4.8.1 on Linux Mint 16, it should compile as well on other systems, be aware that you must have:
- Code::Blocks, since it has a .cbp project file, but you can choose
the IDE you like;
- wxWidgets 3.0.1 development files;
- OpenGL Support in wxWidget (wxGLCanvas);
- SDL2 and SDL_Mixer;
- C++11 std support(I use Chrono from std, not from libboost)
- CTRL+O: Open a ROM (File | Open)
- CTRL+C: Close a ROM (File | Close)
- CTRL+R: Reset ROM (Emulation | Reset)
- CTRL+SPACE: Starts / Pause (Emulation | Start / Pause)
- ESC: Exit application (File | Quit)
- CTRL+F: Set fullscreen mode (Emulation | Graphics | Fullscreen)
- CTRL+L: Set opengl filter (Emulation | Graphics | Filter Texture)
- CTRL+H: Display some informations on screen (Emulation | Graphics | Display HUD)
- CTRL+A: Set automatic mode frequency (Emulation | Speed | Automatic)
- CTRL+Y: Set clock timer to 60 Hz, else follow current frequency
- NEW: CTRL+M: Mute sound
- NEW: CTR+S: Take screenshot (PNG, JPEG or BMP)
- Emulation | Color Themes: Replace black / white colors with some funny ones
- Emulation | Use Sleep: Give priority to OS half of the waiting time (may the CPU be less requested, but can slow down emulation...)
- Emulation | Graphics: You can also change here the size of the window regarding the original resolution
- Emulation | Speed: You can choose from 1/40x to 256x the original COSMAC VIP base frequency (1760 Hz), useful for debugging purpose and smoothness of Twisterbar Demo ;-)
- Emulation | Input: There you can change the keyboard mapping in relation to the ROM you play
- Emulation | About: Some build infos, shortcuts list and some credits
- Correction crash on exit
- Multiple corrections for Windows builds (less crashes i hope...)
- Correction on Pause (Music wasn't paused :-/ my bad lol)
- New Mega8 "Mega 8 Test Demo": Testing / Debugging Draw Modes (Blending Modes)
- New Mega8 "Mega 8 Test Demo": Testing / Debugging Transparent Colors
- New Mega8 "Mega 8 Test Demo": Testing / Debugging internal index register jumps (high)
- New Mega8 "Mega 8 Test Demo": Testing / Debugging all scroll directions (even transparent)
- New Mega8 "Mega 8 Test Demo": Testing / Debugging Correction in setting the length of Music
- New Mega8 "Mega 8 Test Demo": Testing / Debugging more than one sound at 44100 Hz
- Possibility to use 2 Joysticks maximum along with the keyboard
- Removed speed 1024x (crashes on Windows)
- FPS Limit to ~300
- New shortcut to mute the sound: CTRL+'M' (Remember to activate the sound on first run !)
- New shortcut to take a screenshot: CTRL+'S'
- Finally made the width corrections on wxStatusBar panels !
- Added key configuration editor (Can be set by profile/ROM)
- Corrected big mistake in sound !!! (length and frequency)
- It supports from 11025 Hz up to 44100 Hz (still in 8bits mono)
- With that correction, you can have more than one sound :-P
- Now supports saving settings like Filtering activated, Fullscreen,...
- Changed shortcuts (All "command" shortcuts must be set with CTRL+shortcut)
- Size of main window defaults to 5x the sizeof Chip-8 resolution
- Main window appear at the center of the screen
- Correction with std::chrono precision. In Linux it delivers nano and microseconds as well, in Windows, only milliseconds (Aaargh !) Now wxStopWatch is used, in Windows it make use of QueryPerformanceCounter
- Small corrections on scrolling parts
- Corrections when changing frequencies
- Correction when calculating FPS
- ...
- Binaries finally released !!
- Both in 32 and 64 bits
- Binaries are in 64bits mode only
- Command line compilation broken :-(
After adding the required libs to your system, you can compile with Code::Blocks. Here are the required libs:
- wxWidgets 3.0.1
- FTGL
- SDL 2
- SDL_Mixer 2
- Freetype 2
Command line compilation (Using Makefile) is broken since 1.2 due to added Windows (i686 and x86_64) builds. I'll fix that soon.
Keyboard is binded like this by default :
Original CHIP-8 Keypad PC Numpad
1 | 2 | 3 | C 7 | 8 | 9 | DEL
--+---+---+-- ----+---+-------+--
4 | 5 | 6 | D 4 | 5 | 6 | ADD
--+---+---+-- ----+---+-------+--
7 | 8 | 9 | E 1 | 2 | 3 | SUB
--+---+---+-- ----+---+-------+--
A | 0 | B | F MUL | 0 | ENTER | DIV
This can be changed with 1.2 simply go to Emulation | Input and set the keys you want. It is saved by profile / game.
Yes, you can ! 2 joysticks may be used at the same time, to configure, just go to Emulation | Input ;-)
It uses OpenGL for rendering, it's quite fast. It supports texture filtering to make it look less like 'Minecraft'. It has also a little on screen display with some informations regarding the system (the HUD can make a huge drop down to the actual FPS... at least on my old system).
Since all documents I've found are unclear about the real frequency of the chip, I'm basing on the clock speed from the COSMAC VIP, about 1.76 Khz. But you can press CTRL+/- to change the speed from 44 Hz to 1.8 Mhz (from 1/20x up to 1024x). When you change the frequency, the base clock stays still @60Hz (Delay and sound), but you can make it follow the actual frequency you've set by going to Emulation | Set Sync Clock.
- Chip-8/SChip-8: SDL_Mixer is used to play a simple beep at 440Hz
- MChip8: Full support for sound, check Twister Demo or mine ;-)
This emulator is still in development because I want to add some more features to it, like:
- ~~Mega-Chip support~~ Done !;
- Mega-Chip small modifications I have in mind;
- CDP1802 opcodes;
- Support for hybrid Chip-8 roms;
- ~~Input configuration~~ Done (1.2) !;
- ~~Better sound support (actually a wav file is played for beep)~~ Done !;
- Internationalization support;
- Load/Save State;
- ~~Screenshot~~ Done ! or video.
Sorry for the french comments in source files ! I'll change them if I have time. For more credits check the About menu !