In Sega Genesis emulation history, YM2612 sound chip has always been one of the hardest part to emulate and more over when you are going the accurate way, since no technical documentation really exists to describe how the FM synthesiser chip internally works.

During a long time, the only documentation we had was the official Sega Developers Sound Manual that describes the interface with the YM2612 OPN chip and his internal registers.

As a result, the number of available YM2612 core, written by emulator authors, is rather limited:

  • The “MAME” core, written by Tatsuyuki Satoh & Jarek Burczynski, courtesy of the M.A.M.E emulator. This is an open-source emulator with a rather high level of accuracy thanks to lot of low-level tests made on real Yamaha OPN chips from the same family.

  • The “GENS” core, written by Stéphane Dallongeville, author of the GENS emulator. This is also an open source emulator, inspirated by the MAME core regarding internal YM2612 constants. It has been several times updated to improve sound rendering in some Sega Genesis games. For example, Stef added an interpolation method to emulate the YM2612 at his original frequency (quite but not completely similar as the Kega SuperHQ option). He also made many (but probably only at high level) tests on a real Sega Megadrive to adjust emulation parameters. The result is that his core is sometime considered as being more accurate than the MAME core regarding to some specific games.

  • Kega’s core, written by Steve Snake, one of the Sega Genesis emulation’s pioneer (author of Kgen & Kega). Not much is known about this core since it is closed-source but it is considered as the “most accurate” YM2612 emulator and Steve Snake admitted he spent MANY hours testing all possible features of the real chip. This even includes undocumented & unofficial features (see below) used by some games. The result is that, effectively, the accuracy level is quite HIGH and Kega was considered as the only emulator being able to render the sound of some games quite exactly as on real hardware. Sadly, Steve Snake always remained very discrete about his findings and, for whatever reasons, never publically shared them.

As you can now guess, excepted Kega, quite all (open-source or not) Sega Genesis/Megadrive emulators use the M.A.M.E core as a reference and, logically, share the same emulation flaws, resulting in some sound emulation inaccuracy.

Hopefully, a new document was recently discovered & translated, that covers the YM2608 FM chip. This chip is part of the same Yamaha OPN chip family as the YM2612 and obviously share a lot common internal behaviour. This document covers pretty everything about the chip registers & internal tables and even fixes some mistakes from the original Sega YM2612 document. However, it appeared quickly that the M.A.M.E core was already emulating all described features correctly so this document, even if being a great resource for emulator authors, could not help in fixing undocumented behaviour on his own.

But Nemesis, who is writing his own Sega Genesis emulator (not yet released) took this opportunity to start intensive tests on a real YM2612 chip, trying to fully understand how it internally works and most important, documenting it & sharing his notes.

Among other things (you can read the full thread here), he made priceless discoveries about two undocumented features that caused some games to sound incorrect before (one of this “bug” being discussed in a previous entry of this blog by the way, affecting some of the games using GEMS sound driver)

And now ?

I implemented these findings in the M.A.M.E ym612 core that I’m using for Genesis Plus and also, implemented sample interpolation to emulate the chip as it original frequency, which is required by some games to sound more correctly (the best example is known to be Sonic the Hedgehog’s end of level sign spinning). Finally, I fixed some inaccuracies regarding the Envelope Generator and Phase updates in CH3 special mode.

The result is a pretty accurate sound emulation, way better than before, and probably close (if not better) to Kega level of accuracy.

The modified source code is freely available on the Genesis Plus SVN repository (fm.c) for anyone interested. It seems that the M.A.M.E team, through Richard Belmont, got their hand on this and updated the original core: good stuff happen when people are sharing code & informations !

Obviously, Genesis Plus for Gamecube/Wii has been updated to reflect current modification, the last version can as usual be found on his thread on Tehskeen.

Here is the full changelog:

– adjusted (again) HINT timings: fix Double Dragon 2 (game freezed), hopefully does not break anything else
– fixed broken EEPROM support for Codemaster games
– modified input update timings: fix Dungeons & Dragons – Warriors of the Eternal Sun (thanks to Notaz)
– added support for “Ultimate Mortal Kombat Trilogy” hack (max. size supported is 10MBytes)
– added (VERY) preliminar support for PICO roms (credits to Notaz for his documentation)
– improved YM2612 emulation (credits to Nemesis for his tests on real hardware):
.implemented phase overflow emulation: improved fix for special music instrument used in Comix Zone, Flashback, Ariel, Shaq Fu…
.improved SSG-EG emulation in MAME core (also based on additional code from Alone Coder)
.improved Timers emulation accuracy
.improved Enveloppe Generator accuracy
.fixed Channel 3 CSM mode emulation
.implemented sample interpolation in MAME core to emulate the chip at original frequency (HQ YM2612 mode, from gens)

– added automatic alphabetical filesorting (Marty Disibio)
– added ROM History for faster ROM access (Marty Disibio)
– fixed a silly input bug in “ROM Infos” & “Game Genie” menus
– modified “Hard Reset” option
– improved display sharpness in original rendering mode (H40 cell mode only), filtering is now completely disabled
– enabled overscan emulation in “STRETCH” aspect mode also
– added support for horizontal wiimote handling in Menu (automatically used when the wiimote is not pointed towards the screen)
– improved Controller options
.prevented keys reconfiguration if device is not detected
.added support for up to 8 players (ISS Pro Deluxe, …)
.each player can be affected to a custom device (GAMECUBE Pad, WIIMOTE/NUNCHUK or CLASSIC)
.added the ability to use classic controller & wiimote pad from the same port separately
.modified “soft-reset” key on the Wiimote to avoid “accidental” resets (now press Buttons + & – simultaneously)
.added MODE button mapping: use “START+Z” on gamepad or “Button Minus” on wiimote/classic (not reconfigurable)
.added automatic configuration save for controller options

Side notes

I didn’t post before but since a few months, thanks to the hard work of para (author of the wiiuse library) & shagkur (libogc main developper), we now got easy-to-use & stable support for wiimote and expansion controllers in Wii homebrew. Obviously, Genesis Plus GX takes full benefit of this and now even support up to 8 players.

I also worked on Sms Plus GX to add accurate Sega LightPhaser emulation and to use the Wiimote IR pointing ability for a full nostalgic experience. Sega Menacer & Konami Justifier emulation should come along soon for Genesis Plus, more to come in a later post.

Here’s the time for another release of Genesis Plus. I have focused myself in fixing some bugs I introduced in the previous version, as well as emulating most of unlicensed “non-working” games (many thanks to Haze for his work).


I also made some progress about emulating an original YM2612 bug that made some games (Ariel, Shaq Fu, Comix Zone, Spiderman & Animated Series,…) sound correct on real hardware but wrong on emulators.

Finally, I added SVP emulation thanks to the great work of Tasco Deluxe and Notaz : as a result, Virtua Racing is now fully playable but don’t expect to run it full speed in gamecube mode. It needs to emulate a custom DSP running at 23Mhz which takes a lot of CPU time actually. You can still underclock the DSP but it will result in slower 3D rendering and effective framerate will still seem slower.


That’s why, to celebrate the last release of LibOGC which added Wii hardware support, I also release a special elf version that could be running in native Wii mode using the recent “Twilight hack“. Please note that this version remain completely UNTESTED as I personnaly don’t have any way to test it on Wii. SO, tell me if the above game is at least running faster 😉

Here is a complete changelog for this release:

– added SVP emulation: Virtua Racing is now emulated (big thanks to Notaz and TascoDeluxe)
– fixed VDP registers behaviour when VDP Mode 4 is enabled: fix Bass Masters Classic Pro, Captain Planet & The Planeeters
– corrected a bug in DMA Fill operation: fix James Pond 3, Rockman World/Megaman Willy Wars (corrupted VRAM)
– corrected typo errors in CPU cycle counters update: fix optiom screen music in “College Slam” and probably others games.
– added preliminary support of undocumented YM2612 bug: fixes soundtracks of Shaq Fu, Spiderman, Comix Zone, Ariel and some others
– added support for mappers & copy protection devices used in many unlicensed/pirate cartridges (see cart_hw.c for details)
– rewrote memory handlers for better modularity and some (little) speedup
– reduced Savestate size

– compiled with last LibOGC (20080228): fix issues when unplugging controller, support for Wii mode (see release.txt)
– added “hard-coded” IPL font (no more direct access to BOOTROM): fix font problem for Qoob users
– added SDCARD Slot B support for loading Roms
– removed unused MAME PSG Core
– added ‘Force DTACK’ option for prototype games usually hanging on real hardware (example: Sonic Crackers)
– added an option to underclock SVP core (with default cycle count, Virtua Racing actually does not run fullspeed in GC mode)

As usual, binary files can be downloaded from Tehskeen.

Download it from Tehskeen’s forums, here is a complete changelog:


  • many sourcecode cleanup and optimization
  • completely rewrote EEPROM emulation: now support all known EEPROM types (24C01-24C65) and mappers (Sega, Acclaim, EA, Codemasters) used in a few games (now use internal game database) as external RAM. This should at least fix save support in the following games:
    • NBA Jam (alternate Acclaim mapper)
    • College Slam, Frank Thomas Big Hurt Baseball (24C65 type)
    • NHLPA Hockey 93, Rings of Power (EA mapper)
    • Micro Machines serie, Brian Lara Cricket 96/Shane Warne Cricket (Codemasters mapper)
  • external RAM is now initialized to 0xFF by default: fix Micromachines 2, Dino Dini Soccer
  • fixed SRAM 16-bits memory handlers: fix some Sega Sports and EA Sports games (NFL95, NBA Action 95, NHL97, NHL98,…)
  • modified WRITE_xxx & READ_xxx macros for better portability and faster memory access on BIG ENDIAN platform
  • completely rewrote BIG ENDIAN support in render.c and vdp.c: rendering should be a little faster
  • rewrote ROM bankswitch emulation (Super Street Fighter II): ROM access are faster, using memory pointers instead of reading ROM copy from ARAM
  • fixed leftmost Window/PlaneA column render and implemented Window bug (as described by Charles Mc Donald)
  • improved “Sprite Limit” and “Sprite Collision” detection accuracy
  • modified RGB565 Color Palette to use the full available color range (0-31;0-63)
  • implemented “cycle accurate” HV Interrupt timings: fix Sesame’s Street Counting Cafe, Legend of Galahad (intro)
  • improved VDP access timings accuracy (added FIFO emulation): fix Double Clutch
  • improved DMA timings accuracy: fix Winter Olympics (E), Arch Rivals and probably more
  • fixed HCounter again: Road Rash serie (I,II,III) don’t need timing hacks anymore
  • fixed VCounter in Interlaced 2 mode: fix Combat Cars “VS-Mode”
  • improved Interlaced 2 mode (double resolution) rendering: Sonic 2, Combat Cars (“VS-Modes”) look far better
  • added TMSS BIOS support (optional)
  • rewrote part of the YM2162 MAME’s core: fixed internal FM timers handling, removed non-YM2612 emulation code and unused multiple cpu support
  • implemented “cycle accurate” FM timers & sound samples rendering
  • improved Z80 Interrupt timing accuracy: fix Sonic 3 music slowdowns
  • updated Z80 & 68000 cores to last MAME versions
  • improved Soft Reset emulation: X-Men 2 and Eternal Champions (random character selection) now work more like on real hardware
  • added full overscan emulation (vertical & horizontal borders) for “pixel perfect” aspect ratio (tested against a real genesis)


  • fixed rom checksum calculation (only used for rom information)
  • some modifications in GX rendering code
  • added support for original Genesis/Megadrive NTSC & PAL video modes: this makes games looking exactly as on original hardware (progressive rendering with reduced resolution)
  • added “Aspect” option to switch between ORIGINAL (aspect ratio is fixed and borders are emulated) and MANUAL SET (horizontal and vertical scaling can be manually configured, borders are not emulated)
  • added “Overscan” option to disable the original borders color and always use black borders (only used when ORIGINAL Aspect mode is enabled)
  • added support for up to 720 pixels horizontal resolution (needed for proper aspect ratio emulation)
  • added “TV Mode” option to enable automatic switching to PAL(50Hz) TV mode when the Genesis runs in PAL mode
  • added “Xshift” & “Yshift” settings to let you adjust display area position while keeping the original aspect ratio
  • added option to disable/enable SSG-EG support in FM cores: this special mode is indeed not properly emulated and some games might sound wrong when enabled
  • removed “CPU Type” option, you can also now force Region (JAP/EUR/USA) without reseting the game, choose USA or JAP for 60hz, EUR for 50hz, this can be useful to bypass game region protection at startup.

I also updated the EEPROM guide and the User Manual to fully describe the new available options.

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.


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.

I have recently decided to rewrite completely the EEPROM emulation code used in Genesis Plus. The previous one was based on Notaz’s Picodrive sourcecode but was not compatible with some games (Rings of Power, College Slam, Micromachines’ serie, …) and, beside from preventing game backup to work properly, also make some games crashing.

Since not so many Genesis games use serial EEPROM as backup RAM, this feature is generally not supported by common emulators (so far I know, only Kega, Picodrive and Jenesis have some kind of eeprom support but none of them seem to have support for every existing EEPROM games), which make me think it could be interesting to code a complete support myself.


The emulation itself is not very difficult since EEPROM datasheets (24Cxx eeprom are generally used) are freely available and the communication protocol is quite easy to reproduce. The main difficulty was to determine which games indeed use serial EEPROM (instead of classic parallel SRAM) and also which type of EEPROM it is and which type of EEPROM mapper they are using.


After testing many games on the emulator, I finally get some results and a list of games using EEPROM and their characteristic. I compiled this in a document, which emulator authors may find useful or not. In this document, there is also a quick note about how EEPROM read/writes work, covering all 3 EPROM’s modes that are used in known Genesis cartridges. Interested people could also have a look at eeprom.c in the genesis plus SVN repositery.


PS: there is no binary update actually available, I still need some time to test the upcoming release as I implemented many other modifications

Here is a summary of the previous changes made to Genesis Plus



  • corrected TeamPlayer support: fix multiplayer in Gauntlet 4 (Sept. version), Pengo and a lot of others
  • added J-Cart support: enable multiplayer in Codemasters games (Pete Sampras, Micromachines games, Super Skidmarks)
  • added serial EEPROM autodetection: fix games with bad SRAM informations in header (NBA Jam TE)
  • added SVP faking: display 2D graphics in Virtua Racing (the game is however still unplayable)
  • added support for more internal IO registers: fixe some unlicensed games (Wisdom Tree games…)
  • added preliminary support for unmapped protection device: fix some unlicensed games with special built-in hardware (Squirell King, Lion King 2…)
  • added “Soft Reset” combo (in game, use L+Z triggers): this should be like pressing the RESET button on a real Genesis and this is required in some games to enable special features or even complete the game (ex: X-Men).


  • added separate configuration for PortA/PortB inputs (GAMEPAD, MULTITAP or NONE, see Joypad Config): this let you setting PORTB as unplugged, which is needed in some games to access special modes or enable cheat codes (Alien Storm, X-Men…)
  • Freezestate & SRAM files are now compressed (using zlib)
  • FreezeState & SRAM files can now be saved/loaded to/from SDCARD: located in /genplus/saves/ from the root of your SDCARD
  • changed initial ROMS directory for SDCARD user: now looking for /genplus/roms/ from the root of your SDCARD
  • added user-transparent SRAM autoload (detection order is MCARD then SDCARD, SLOTA then SLOTB)
  • “System reboot” is now used for console reboot or SD/PSO reload if detected
  • added new font: now use original IPL font, extracted from Bootrom
  • modified controls when going into the rom selection menu (DVD or SDCARD):
    • use B button to go up one directory
    • use Z button to quit the file selection menu
    • use L/R triggers to go down/up one full page
    • use Left/Right buttons or Analog stick to scroll the selected entry’s filename when it can’t be full displayed
  • various menu rearrangment, minor bugfixes & sourcecode cleanup


  • added 4.7GB DVD support for WII drives (the maximal allowed size for Gamecube DVD is still 1.35GB)
  • removed MPAL video timings, always use 60Hz NTSC: fix display problems for PAL wii users (no more PAL50 version needed)
  • added Console Reboot option in main menu (IPL Reboot)
  • added Multitap support (EA 4-Way Play and Sega Teamplayer): allowed up to four players in games supporting those peripherals
  • added partial Sega Menacer lightgun support (use Analog Stick): automatically set when detecting the 6-in-1 Menacer game


  • you can now switch between FM cores without reseting the game. FM registers value are automatically restored when switching.
  • modified PAL framesync a little bit: the 20ms period is now applied between the start of 2 consecutive frames, no more between the end of the previous and the start of the next one, which seems more correct to me.
  • removed the previous VINT timings modification because it brokes some games (Rocket Knight, Thunderforce III,…)
  • added automatic Timing configuration (VDP latency, VINT timing & alternate Line Timing) at game loading, based upon specific romname detection. This means you can still modify some of these options afterwards but they are now automatically set/unset when loading a game which need special timing fixes. These fixes are also automatically desactivated when the current game doesn’t need them. For your information, games that are actually detected and need special timings to run properly are:
    • Legend of Galahad & Road Rash series (single line not rendered properly)
    • Sesame Street Counting Cafe (don’t boot)
    • Chaos Engine/Soldiers of Fortune (graphic glitches on scrolling)


  • corrected L & R buttons assignment: fixes Genesis X & Z buttons being inverted
  • VINT timings are now a little more accurate: fixes Sesame’s Street Counting Cafe
  • SN76496 MAX_OUTPUT back to normal
  • modified FB_WNOISE value in SN76496 core according to John Kortink’s last informations
  • added support for Maxim’s PSG core, same as used in SMSPLUS (it becomes the default PSG core)
  • updated FM core to the latest MAME version
  • corrected DAC output level (fixes voices and some special FX being too low)
  • added support for Gens YM2612 (FM) core (MAME’s one still remains default FM core)
  • added configurable preamplification for each sound cores (see Sound Options)
  • added some other configurable sound options (boost overall volume, FM improvment for Gens YM2612)


  • corrected MAX_OUTPUT value in SN76496 core: fix PSG sound (SFX) volume
  • removed unused sound buffer allocation


  • added DVD automount: automatically call libogc DVD_Mount function if ISO PVD reading failed (idea taken from softdev’s last neocdredux release). This may be useful for loading roms from a DVD after booting from SDLOAD or after stopping DVD motor.
  • added “DVD motor off” feature, like in others emulators
  • corrected Memory Card mounting function: EXI_ProbeReset() function was never called if the first mounting attempt failed. Should fix some of the “Unable to mount memory card” errors.


  • added SDCARD subdirectory browsing and LFN (255 char. max) support


  • remove some rendering unused code (only used by DOS version of genesis plus) for little speedup
  • added an option to enable alternate line rendering timing (fix single line error in Road Rash series and Legend of Galahad’s Intro)
  • Color RAM update now always reset color 0 to border color (fix color glitches in Mortal Kombat,…) (thanks to Nop’s for the idea)
  • added last Softdev’s modifications (normalised memory access and ASM GU functions used intead of ‘C’ ones) for some speedup
  • updated gcaram.c to be compatible with last libogc version


  • little rendering code speedups
  • modified HV counter tables (fix graphic glitches in Skitchin’s sky, Lotus 2 Recs, Panorama Cotton, Dashin Desperados & maybe more)
  • completely rewrote DMA timings emulation so that it works for all games (no more cpu freezing)
  • added all DMA tranfer rates handling for each three DMA modes and added dma busy flag emulation
  • modified interrupts handling on VDP register #0 and #1 writes (fix Lemmings status bar)
  • added VDP RAM write latency (fix Chaos Engine/Soldier of Fortune gfx glitches)
  • modified FM timers handling a little bit (fix Vectorman2 music)
  • corrected Sprite Limit rendering (fix Sonic 1 & Micromachines 2 title screens)
  • corrected IO Registers writes (fix Decap’ Attack controls, no more need for alternate input)
  • corrected 6 Buttons Pad emulation (fix 6buttons detection in Mortal Kombat 3, Comix Zone and other 6-buttons compatible games)
  • modified sound mixing a bit according to Generator sourcecode (FM and PSG ratios seems more correct)
  • added separate CPU Region (USA, Europe, Japan,…) & Speed (PAL or NTSC) choice in menu options
  • modified main frame synchro in PAL mode (fix sound glitch in this mode), thanks to Softdev for the solution
  • added savestates support


  • added correct FM Timers emulation (fix missing music in Castle of Illusion, Quackshot, Undead Line, Wonderboy in Monster Lair, Cal 50, Turbo Outrun, Thundeforce 4 and certainly more)
  • added partial EEPROM emulation, used by few games as backup RAM: SRAM support now works fine in Wonderboy5, Megaman Willy Wars, NBA Jam… (credits to Notaz, adapted from Picodrive code)
  • added preliminar dma timing emulation (fix bottom screen in Legend of Galahad) (credits to Notaz, adapted from Picodrive code)
  • hack: clear Vint pending after Hint (INT level 4) acknowledge (fix Fatal Rewind)
  • hack: modify read_bus16 to return a random value (fake fetch) (fix Time Killers)
  • modified cpu execution timings, with more correct hblank and interrupts timing (fix ISS Deluxe, Double Dragon 2 and certainly more) (Based on Gens code)
  • modified busreq mechanism: better synchro between z80 & 68k (no need to dejitter anymore) (Based on Gens code)
  • added sprite collision detection (fix Strider 2)
  • modified dma fill operation for big endian platform(fix Contra Hardcorps gfx garbage)

Softdev’s initial releases (some WIP changes are missing)


  • Added partial zip support


  • Added six button pad support from x86 Gens
  • Additional changes based on Charles MacDonald’s gen-hw.txt

WIP1    07 March 2006

  • Updated SN76496 driver
  • Added GX Hardware Scaling