After a lot of beta testing, a new version of Genesis Plus for Gamecube/Wii is about to be released… Even if there are no really revolutionary features, I’m quite satisfied with this one since I’ve been working a lot on emulation accuracy, which is one of the most interesting challenge about writing an emulator, in my opinion.

Beside correcting some bugs and cleaning some parts of the source, my goal this time was mainly to:

1) Emulate Genesis timings as accurately as possible

Some games are very timing sensitive and expect some events (VDP writes, DMA, HV Interrupts, HBLANK and VBLANK) to happen at very precise times, or for a very specific period. I will not go deeply into details but one of the key to correctly emulate several CPU running in parallel and accessing shared memory resources, is to emulate also the latency of those devices.

For example, on real hardware, switching interrupts ON through VDP registers do not trigger an interrupt immediately, but, more probably, the CPU will have the time to run one single instruction before jumping to the interrupt routine. Not emulating this tiny timing latency could cause some bad programmed games to hang, which was indeed the case of Sesame’s Street Counting Cafe, not really the best game in the world, but a good challenge to test emulation accuracy.

In some way, I finally found timings that should work with any sensitive games, without need anymore for specific games “hacks” but also without disturbing any previous working game. The goal behind this is that the emulator now achieves a near perfect compatibility rate (I only found some unlicensed games not working properly, mostly due to some unemulated cartridge hardwares)

2) Get a “pixel accurate” aspect on screen

The first idea was to emulate the colored overscan area which indeed exists all around the active display (generally 320×224 pixels) . Emulating the full display height (243 lines for NTSC) and width (based on the VDP Pixel Clock and scanline period), gives an accurate screen aspect ratio, much more similar to what a real Genesis/Megadrive displays. Below is a screenshot example of the full overscan area, rendered on a line basis (when displayed on TV, this area is generally hidden with vertical borders being only visible when the system runs in PAL mode)

The second idea was to add support for original Genesis rendering modes. Indeed, as many old consoles, it originally uses a ~ 240 lines progressive mode, which means that in a regular NTSC screen (always ~480 lines), only the even lines were displayed, odd lines remaining black (this is sometime recreated as “scanline effect” in emulators).

Additionally, the “interlaced mode 2″ support (double resolution interlaced mode used in Sonic 2 “vs-mode”) was also improved, with a better rendering quality using both 240i/480i TV modes.

sonic2000.gif

Finally, I also add optional support for original PAL video modes which means that the Gamecube/Wii could automatically switch into a PAL video modes (287p, 287i or 574i) when the virtual Genesis is running in PAL mode…

The results, compared side-by-side with my old switched Megadrive II, is pretty accurate in term of rendering or aspect ratio, and I hope every fellow retrogamers would enjoy this nostalgic feeling as much as I do.

What should be next…

Next step would be to improve the sound emulation, especially FM core emulation. I already improved the samples rendering and FM timers accuracy which (I believe) produce some more accurate sound effects in some games but I still need to add support for original YM2612 samplerate/frequency and also investigate about some undocumented features (or bugs ?) of the original hardware which make some musics sound totally weird (Flashback, Spiderman, Comix Zone…) under emulators.

Anyway, I’m planning to release soon the new version of Genesis Plus (SMSPlus coming also along, with similar additions) since it’s always more enjoyable to share his work with other people and get some feedback…more to come at tehskeen.

About these ads