Page 1 of 58

New Documentation: An authoritative reference on the YM2612

Posted: Fri Jun 06, 2008 3:17 pm
by Nemesis
As anyone who's tried to emulate it will know, there's a significant lack of solid information on the YM2612. The only official reference we have comes from 14 pages in the Genesis Sound Software Manual ( http://nemesis.hacking-cult.org/MegaDri ... Manual.pdf ), and they're a little light on the details. There are some manuals out there for other Yamaha FM chipsets, but the problem is there are a LOT of different "lines" of FM chips that Yamaha released, such as the OPL, OPN, OPM, OPZ, etc. The YM2612 is an OPN chip, and all the documents which are publicly available are for chips from entirely different lines. Thanks to Malfunction from http://www.soundshock.se , we've now got something which could fill this gap. Here's a link to an official document from Yamaha describing the YM2608:
http://nemesis.hacking-cult.org/MegaDri ... M2608J.PDF

This is the first time this document has been publicly posted on the internet. This isn't just a datasheet, it's a complete Programming/Technical Reference Manual, weighing in at 67 pages. It's full of hard numbers, tables, and equations. There is a catch however: The manual is in Japanese. I wouldn't hold out for an official version in English. There's a good chance this document was never fully translated from Japanese, even by Yamaha. We've got the information now though. The language barrier can be solved with time and the help of the right people.


The language issue aside, as you'll note, this document is for the YM2608 not the YM2612. This leads to the question, what are the differences between the YM2608 and the YM2612? I've been doing a fair bit of research on this, and the news is good. Here's a list of the all the known Yamaha OPN chips:
-YM2203 (OPN)
-YM2608 (OPNA)
-YM2610 (OPNB)
-YM2612 (OPN2)
-YM3438 (OPN2C) (CMOS implementation of the YM2612. Functionally identical)
-YMF288 (OPN3)

As you can see, both the YM2612 (OPN2) and YM2608 (OPNA) are part of this line. More significantly, after comparing information about all these OPN chips, and particularly after looking through this new manual, it seems that the YM2608 is the direct and immediate ancestor of the YM2612. More than that, the YM2612 seems to just be a "stripped down" version of the YM2608. The documentation for the YM2608 may in fact be better than an official YM2612 reference, as it contains a description of all the features they removed, while still containing all the information on the features provided by the YM2612.

The YM2608 came in a 64-pin package, and required a separate DAC (YM3016) in order to actually produce an analog sound output. The goal of the YM2612 seems to have been to provide a lower cost single-chip solution for systems which didn't require all the features of the YM2608. It seems the parts to get the chop were external I/O Ports, a Rhythm generator with internal ROM samples, a full ADPCM module, and the SSG module (well, most of it anyway :)). Apart from the addition of DAC registers at 0x2A/0x2B to provide some basic PCM without the ADPCM module, everything in the YM2612 seems to be unchanged from the YM2608 implementation, meaning the YM2608 manual above should be extremely relevant.


I was sent a number of other documents along with this one. There's a datasheet and some info on the YM3016 DAC, the ADPCM module in the YM2608, a short document on the YMF288, and a full manual on the "86 Sound Board" for the PC-9801-86, which uses a YM2608. One tidbit the 86 Sound Board manual seems to have which I didn't see in the doc from Yamaha is timing information on the busy flag in the status register. Here's the full archive I got sent:
http://nemesis.hacking-cult.org/MegaDri ... YM2608.ZIP

Hopefully some of you will find this info useful. I know I will.



...So, anyone read Japanese? :D


EDIT:
Here's a transcribed and translated version using an online translator:
http://nemesis.hacking-cult.org/MegaDri ... slated.PDF

Posted: Fri Jun 06, 2008 5:14 pm
by TmEE co.(TM)
This is incredible :D

And now I've got another reason to learn Japanese :) I hope this gets translated someday, I somehow feel it contains all the answers to the issues I've encountered while writing my sound engine (and I think Steve Snake knows a lot, since he's emulator does emulate ALL the quirks I've encountered 1:1 to real HW).

Posted: Fri Jun 06, 2008 5:17 pm
by Oerg866
I think that's not quite correct, if you check out the ending sound of MicroMachine96's SuperSonic intro screen, that is totally messed.

Posted: Fri Jun 06, 2008 5:25 pm
by TmEE co.(TM)
Gimme a link... so far, all has been 1:1 to my audio-modded MD2 sound.

Posted: Sat Jun 07, 2008 12:29 am
by Nemesis
One interesting thing to note about this document is the numbering of the operators. In the Genesis document, we know they've got operators 2 and 3 switched somewhere, either in the register map or in the operator connection charts. Generally, we switch operators 2 and 3 in the connection charts to fix the problem. It's interesting to note from this document however, that the operator numbering in the chart is correct. According to this document, it's the register order numbers which are switched.

Image
Image

Notice that the register order is S1, S3, S2, S4. Of course, the two numbering systems are functionally equivalent, it's just interesting to note the "official" order numbers they use.

Posted: Sat Jun 07, 2008 3:26 am
by 1magus
People have problems emulating this or writing games while using it?

Posted: Sat Jun 07, 2008 5:51 am
by AamirM
Hi,

Thanks a lot Nemesis! You just made my day. I can try to get some of my japanese friends to translate it. I've been trying to get some sound problems in my core fixed without any success but I guess this will help me. This is a huge find. Thanks again.

stay safe,

AamirM

Posted: Sat Jun 07, 2008 9:09 am
by Stef
Of course i don't read japanese but from schems i don't see anything news compared to the sega manual. Maybe japanese comments are importants though ;)

Posted: Sat Jun 07, 2008 10:29 am
by Nemesis
There's quite a bit of stuff in there which isn't covered in the Sega documentation, like self-feedback, conversion to real frequencies, the actual way sounds are generated and operators are combined, etc. And of course there's lots of misc stuff like SSG-EG and the test register which aren't included in the Sega documentation. Just have a close look at pages 15 and 16. I really wish I could read those pages.

Posted: Sat Jun 07, 2008 11:17 am
by Eke
yes, but doesn't every chip differ in term of frequencies value, internal conversion tables, etc... I think I've seen the YM2413 and YM2149 programmer manuals somewhere with lot of value tables but they can not be used for the YM2612 for example

About the SSG, the interesting part is that it uses the same register location and envellope shape is pretty well explained, but this does not mean that YM2612 has SSG working the same way, same thing about CHM mode, why didn't they even mentionned these features in the YM2612 "short" manual if it was working ? probably because it was only partially working and "broken" in some way...

anyway, this is really exciting news, big thanks to everyone who participated in releasing it, I'm definitely waiting for a translation


PS: about operator combination, I don't think there is something new or different from the way it is actually emulated, we already discussed about that somewhere on this board and this is only a matter of naming convention (M1,C1,M2,C2 or OP1, OP3, OP2, Op4 or S1, S2, S3, S4)

Posted: Sat Jun 07, 2008 2:05 pm
by Nemesis
yes, but doesn't every chip differ in term of frequencies value, internal conversion tables, etc... I think I've seen the YM2413 and YM2149 programmer manuals somewhere with lot of value tables but they can not be used for the YM2612 for example
That's the reason this manual is so significant: The FM process seems to be identical between the two chips. As I said, the YM2612 is a "stripped down" version of the YM2608. They cut out extra self-contained modules like ADPCM and simplified its external connections, but it seems they left the FM module untouched. The YM2612 is little more than the YM2608 FM module in a different box. By all means, prove me wrong, but I've looked into this enough now to be convinced of this point, and nothing I've seen in the documentation so far suggests otherwise.
About the SSG, the interesting part is that it uses the same register location and envellope shape is pretty well explained, but this does not mean that YM2612 has SSG working the same way, same thing about CHM mode, why didn't they even mentionned these features in the YM2612 "short" manual if it was working ? probably because it was only partially working and "broken" in some way...
There could be a number of reasons for this. The Genesis sound manual is written by Sega, not Yamaha. The Genesis sound manual is based on the Japanese "Mega Drive" sound manual. The Japanese sound manual was written based on the information Yamaha provided to Sega. You've got three organizations involved there, plus the language barrier, plus the fact that we know that Sega of America and Sega of Japan had very poor communication with each other. All we know is what is written in the Genesis sound manual, which is this:
SSG-EG - A proprietary register whose usage is unknown. It should be set to zero.
That seems to say to me quite clearly that the people writing this manual simply didn't know what it was for. I'd say that information either wasn't passed on from SOJ to SOA, or it wasn't passed on from Yamaha to SOJ in the first place.

This idea of SSG-EG being "buggy" in the YM2612 seems unfounded to me. I don't know where that rumor came from, but I've certainly never seen a case presented, or even a case mentioned, where SSG-EG has been seen to play up. It's quite possible they were officially "unsupported" features of the chip (IE, they were only included because it wasn't worth removing them), but in terms of being buggy, I'm not convinced of that at all.
PS: about operator combination, I don't think there is something new or different from the way it is actually emulated, we already discussed about that somewhere on this board and this is only a matter of naming convention (M1,C1,M2,C2 or OP1, OP3, OP2, Op4 or S1, S2, S3, S4)
Yes, it really doesn't make a difference what they're called or how they're numbered. I just find it interesting to know how they designated them. I like to use the "official" names and designations for things where possible.

Posted: Sat Jun 07, 2008 2:53 pm
by Shiru
Eke wrote:I think I've seen the YM2413 and YM2149 programmer manuals somewhere with lot of value tables but they can not be used for the YM2612 for example
YM2413 is a OPLL, cut-down and very limited version of OPL1. It's different family, so of course information about this chip can't be used for YM2612.

YM2149 is a slightly enhanced clone of AY-3-8910, it's not FM synth. It's quite simple and very well documented PSG chip. YM2203 has it as addition to FM part.

FM part of OPN family chips is compatible in general (at least between YM2203, YM2610, YM2612), so documentation for any of chips of this family can be useful.

Posted: Sat Jun 07, 2008 5:34 pm
by AamirM
Hi,

Shiru is right. You can't use YM2413 info for YM2612 as it is different.

I hope this manual contains those little details that I am looking for. First of all SSG-EG sounds different on all emulators so there is something that needs to be corrected here. Secondly there is the CSM key control which nobody seems to have a clue about. Thirdly I recently discovered (by listening to real hardware recordings and emulated sound) that in 3 slot mode, channel 6's envelope generator seems to speed up. I maybe wrong but this fixes sound in some games.

BTW, I was told that Dune's soundtrack called 'Ammons Advice' doesn't sound correct in Kega either. Can't confirm it though.

stay safe,

AamirM

Posted: Sun Jun 08, 2008 1:30 am
by Nemesis
Well, there's a section in this manual about CSM on page 36. Here's what OCR + web-based Japanese to English translator has to say:

Code: Select all

2-8-4 Setting of mode of CH3

      Channel 3 can set the mode by $27 “D7,D6". 

                       Table 2-1C CH3 mode
------------------------------------------------------------------------
|D7|D6|Mode        |           Ki E                                    |
|--|--|------------|---------------------------------------------------|
| 0| 0|Normality   |It pronounces normally as well as other CH.        |
|--|--|------------|---------------------------------------------------|
| 0| 1|CSM         |It becomes CSM voice synthesis mode, and F-Number  |
|  |  |            |can be set each every of the four slots. Key-on/off|
|  |  |            |at the CSM mode is done with timer A.              |
|--|--|------------|---------------------------------------------------|
| 1| 0|Effect sound|Separate F-Number can be set to each slot as well  |
| 1| 0|            |as CSM.                                            |
------------------------------------------------------------------------
That last row is probably suppost to be for bit patterns 10 and 11, but I've written it exactly as it appears in the document.

Posted: Sun Jun 08, 2008 1:50 am
by Nemesis
Hah, here's something I didn't know about the envelope generator:
*The shape of waves of the envelope changes in exponential when
attacking it, and it changes in the straight line at other rates.
Does anyone emulate this correctly?