YM2612 reveals his secrets

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 YM2612constants. It has beenseveral times updated to improve sound renderingin someSega Genesis games. For example, Stef added an interpolationmethod to emulate the YM2612 at his original frequency (quite but not completely similar as the KegaSuperHQ 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 interpolationto 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.

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.

Like this:

LikeLoading...

7 Responses to “YM2612 reveals his secrets”

Sorry, if this has been asked before, but are there plans to add Sega CD support to GenPlusGX? Are there significant hardware differences between the CD and the Genesis or would it be as simple as adding iso support?