V-Chip Chip8 Emulator (2007)
This emulator was started as a side-project for the Vectrex OS i'm currently developing. After implementing a simple basic compiler and a brainfuck interpeter, i was looking into other runnable formats i could support.
The emulator was supposed to be part of the Vectrex OS, but due to its size (9.4kb) its kind of large to include in the OS (which i'm hoping to keep at around 8KB in size). I might connect the two in the future, using some kind of shared memory pool.
Now, due to the system's limitation. Trying to emulate ANYTHING on the vectrex is near to impossible...
One more reason for me to give it a try it anyhow ;-)
- First ever emulator for the vectrex
- Play CHIP8 games and demos on your vectrex.
- Comes with 20 built-in roms (using the vectrexOS filesystem).
(c)2007 Revival Studios
All Programming by: Martijn Wenting
Here are some of the technical hurdles i had to overcome:
For starters, the vectrex is not a pixel-based system. Now i've been able to trick the Vectrex into displaying bitmap graphics (as shown in some of my other products), but this was always using specially prepared static/non- movable data.
So before even starting on the emulator i needed to see if it was at all possible to display pixeldata that i could modify on the fly. This was a difficult task. The CHIP8 has a resolution of 64x48 pixels, which usually means it has needs 3kb of VRAM. By settling with a 1bit VRAM, i was able to get it running with about 256bytes of VRAM. As expected, the result was not top-notch quality, but enough to keep me going.
Secondly, to emulate anything, you'd need lots of RAM.
Unfortuanately, the vectrex has only about 700 bytes of RAM available, of which 256 bytes alone went into emulating a pixel-based framebuffer, which left me with about 400 bytes of RAm to spare for actual emulation. The CHIP8 has 4096bytes of RAM available, where it can read and write from. To work around this, i tried very hard to seperate static-data from non-static data, by tracking its behaviour. This way calls to reading/writing anywhere into the 4KB chip8 memory could be redirected to a smaller piece of RAM (128 bytes). This was a complete horror to do, and while a few games like blinky won't run because of they need quite a bit of RAM, i was able to get a lot of games to work.
Well, as you might know the vectrex only has a 1.6mhz processor. So while many current emulators run on 2ghz machines, its quite a challenge to get one running on such a slow machine. Furthermore, because the complexity of the pixelbased drawing routines, the actual updating of the screen takes up about 80% of the speed, leaving only very little clocks to do some actual emulation.
While the original CHIP8 had a touchpad of 16 keys for input, the vectrex only has 8 (the 4 directions of the joystick, and 4 buttons). So i had to do some remapping. To make matters worse, each title uses a different set of buttons to control the game. Therefore, i had to remap buttons for specific games. Upon loading the game's checksum will be checked against a list of games, and buttons will be remapped accordingly.
The V-CHIP emulator will be released on both cartridge and as downloadable rom.
Please visit this page in the future for downloads.
If you would like to support my classic gaming efforts, please make a donation by pressing the button below: