New Documentation: An authoritative reference on the YM2612

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

GManiac
Very interested
Posts: 92
Joined: Thu Jan 29, 2009 2:05 am
Location: Russia

Post by GManiac » Wed Sep 22, 2010 5:13 pm

I made a tons of tests on real MD to get understanding for myself how YM really works. Information which I could read (MAME's source, YM2608 manual, posts by Nemesis) didn't give me the "whole picture" of understanding. And of course oscillograms will tell more than cold numbers and C source.
All of these tests I made 1 year ago and even wrote emulator, but then leaved all this job and it is still in unfinished state :(

Now I'm trying to write an articles about PSG and YM (in Russian), they will fully explain how chips work (info is based on my tests of course) and will consist of some "layers": entry level, detailed description, full description with tests and examples.

Back to DAC. I made such test:
algo 7, all operators are at +1 of sinus, all TL = $7f, freq = 0, so we have silence. Having prevoius knowledge:
- operator's output is -8168..+8168
- each 8 steps of TL are equal to 6 dB (division by 2)
and adjusting separate TL I realized that:
- operators are shifted first, then are summed
- operators are shifted arithmetically (not logically) by 5 bits
- levels -1 and -2 of DAC are the same. I mean that if you change output from -1 to -2 you won't notice difference on oscillogram. I know it's very strange, but it's true.
- AFAIR, there is level +256, and you can get it summing 2 or more operators, you can't reach it using only 1 operator. Calculations:
+8168 asr 5 = +255
-8168 asr 5 = -256
Setting one operator to +255 and adjusting TL of other operator I found that maximum is +256.
So we have 513 levels, but maybe here is how equality of -1 and -2 affects final output and we have only 512 uniqie levels? I don't know.


I need to revive my work on YM.

HardWareMan
Very interested
Posts: 732
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Fri Mar 18, 2011 3:09 pm

New records from Yamaha. Even Regen is not capable of such accuracy of emulation. Note the abundant presence of the ladder effect in all of decaying sounds.

TmEE co.(TM)
Very interested
Posts: 2388
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Mar 18, 2011 4:18 pm

ASIC YM has this effect definitely not present in its output. A while ago l_oliveira put a YM3438 into his MD1 (output is lower impedance on it so analog things had to be adjusted on MD side) and it has same problem in its output, which means ASIC YM is not based on it.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

GManiac
Very interested
Posts: 92
Joined: Thu Jan 29, 2009 2:05 am
Location: Russia

Post by GManiac » Fri Mar 18, 2011 8:11 pm

Question. Has MD2 REALLY higher precision DAC (>9 bits ) or not?
TmEE co.(TM), can you make a test?
Algo 7, TL about $3F, sine wave of any operator.
Explanation: TL $40 = attenuation of 256 times. So, output of operator will be from -31 to +31.
-31 asr 5 = -1
31 asr 5 = 0
Playing this sine wave on YM you'll see:
-1 0 0 0 -1 0 0 0 -1 0 0 0 -1 0 0 0

TL $3F = attenuation of 2^7.875 = 234.75 times, output of operator will be from -34 to +34 and output of DAC will be from -2 to +1 and you'll see
-2 -1 0 +1 0 -1 -2 -1 0 +1
In fact you won't see -2 because of glitch in DAC, I wrote earlier about it.

These calculations are fro 9-bit DAC. I made them "in mind", so there can be mistake. If MD2's DAC is more prceise, you'll see more precise ladder of sine wave.

TmEE co.(TM)
Very interested
Posts: 2388
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Mar 18, 2011 9:38 pm

This is what I got with the settings you provided :

Image

There seems to be -2, -1, 0 and +1 here. So even if there is none of higher percision DAC, there's no glitch that eats up few values.

I'd do more tests but right now my girl waits me to come to bed... :wink:
Need to remove the caps from my sound card input...

EDIT: Tried TL of 71 this morning and there seems to be 2 values left, alternating rapidly.
No 9-bit DAC, but no glitch either...
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

GManiac
Very interested
Posts: 92
Joined: Thu Jan 29, 2009 2:05 am
Location: Russia

Post by GManiac » Sat Mar 19, 2011 12:56 pm

Okay, I understand.
And if you run this test on MD1 you should see only 2 steps: from -1 to 0 and from 0 to +1. You won't see step from -2 from -1 because of glitch, so level "-1" will be last longer on X axis.
And step -1 to 0 will be HUGE (that is ladder effect).

Also, I noticed another glitch in MD1 DAC. Some larger levels have really less voltage. For example, +35 is higher than +36. I don't know concrete values. But you can record sine wave at 0.50 Hz, TL 0 and see this glitch.

HardWareMan
Very interested
Posts: 732
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Sat Mar 19, 2011 3:27 pm

Wrong value at sine table?

GManiac
Very interested
Posts: 92
Joined: Thu Jan 29, 2009 2:05 am
Location: Russia

Post by GManiac » Sat Mar 19, 2011 4:17 pm

No, we've discussed this. Glitch in DAC. Sine table is normal, I tested it using phase modulation.

TmEE co.(TM)
Very interested
Posts: 2388
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Mar 30, 2011 4:17 pm

I have confirmed that MD2 uses an YM3438.

I got a bunch of Yamaha chips today and YM3438 were among them. I did some tests as I did on my MD2 and to my surprise everything matched :D

downside of YM3438 is that it has very high impedance output that picks up lot of digital noise. Also the output is significantly louder than YM2612, and this all matches with MD2 output aswell.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

TmEE co.(TM)
Very interested
Posts: 2388
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Jun 03, 2011 12:11 pm

Does anyone have any info on how to program YMF288 ? It should be YM2608 without ADPCM and GPIO, ADPCM being replaced with a noise generator.
I've been searching for quite a while and have not been able to find any programming info.
AY and FM side should be identical to YM2608, but noise generator I know nothing about.

I have found pinouts of SOP and QFP version and it seems to use regular I2S DAC interface aswell so you don't need any Yamaha DACs.

http://sue.niko.to/ps98
http://sue.niko.to/ps98/ps98@ymf288-s_sch.png

http://www.kurusugawa-ele.jp
http://www.kurusugawa-ele.jp/product/pc ... _v1p42.pdf

It was also used on PC-9801-118 and someone has to know how it works. Some people have tried to get datasheets etc. form Yamaha and other places but without luck....



I am building a music making computer and for sound quality reasons I don't want to use YM2612/3438 (only 9bit internal DAC), so I thought I will use YM2151 but it seems this is a very whiny and slow chip, I am having very hard time making right sound with it over LPT (I still have not succeeded yet). YM2203, YM2608 and YM2610 all have external DACs but also very huge chip packages and things I don't need (ADPCM, GPIO).
YMF288 would be ideal, but I'd like to get a bit more info about it (the noise generator in particular).

EDIT: YM2610 is described having a controllable noise channel... is it AY noise or something else ? Search continues...
EDIT2: I found a japanese text that tells about differences, and there is no special noise channel.

So YMF288 is YM2608 with these changes :
*ADPCM is removed
*GPIO is removed
*Writes can be done much faster
*No CSM mode
*Added Standby mode
*Regular I2C audio output, so no need for Yamaha floating point DAC
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Nemesis
Very interested
Posts: 773
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Sat Jun 04, 2011 3:28 am

The only programming documentation I've seen for that chip is what I assume is the japanese document you've already come across, from this site:
http://www.ylw.mmtr.or.jp/~hosino/ma-ne ... ymf288.txt
It's comparing the differences between the YMF288 and the YM2608. Since we have complete documentation for the YM2608, hopefully that document gives enough info to figure out what it does.

Actually, looking at it, that same document is in the zip archive I gave in the very first post in this thread. There's some other documentation in that same archive on the PC-9801-86. Maybe something else in there is of use to you?

I tend to collect documentation whenever I come across it, whether it's useful to me at the time or not, just in case I need it later. Here's everything I've "harvested" about various sound chips over the years (warning, 140MB file!):
http://nemesis.hacking-cult.org/MegaDri ... /FMDocs.7z
It's a bit of a mess, lots of random stuff not really organized, but some of it might be useful to someone.

TmEE co.(TM)
Very interested
Posts: 2388
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sat Jun 04, 2011 8:31 am

That archive is a gold mine :D

It will take a while to go through it, but form first glance all I got is already in the archive.

Also I can provide better pics of YMF262-F, YM3812, YM2151, YM3438, YM2612, YM3012, YAC512, YAC513 and YMF278B.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

HardWareMan
Very interested
Posts: 732
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Sat Jun 04, 2011 2:21 pm

TmEE co.(TM) wrote:Also I can provide better pics of YMF262-F, YM3812, YM2151, YM3438, YM2612, YM3012, YAC512, YAC513 and YMF278B.
Image

Nemesis
Very interested
Posts: 773
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Sun Jun 05, 2011 10:35 pm

Cool, thanks for those images HardWareMan. It would be good to get more pictures of those chips too TmEE, some of those chips really don't have good images online.

I've always thought an online wiki, specifically around collecting and sharing documentation for various chips and systems, would be really good for the emulation community. You know, something specifically about the technical info you'd need to learn how to emulate or program for a device. Right now, everything is scattered everywhere, and it often takes a long time to find the "best" version of a document, simply because we have a dozen different versions of the same document floating around (case in point: The Genesis Software Manual). Most of the time you have to crawl old forum threads from various places in order to find info. Websites which are maintained by individuals, where other people can't contribute or maintain the information, always end up out of date. A wiki would be really great for allowing all the versions of a doucment to be hosted, but indicating which is the best of all of them, allowing users to submit more documents and write a community "errata", etc. We could also have a "most wanted" section, to try and get users to notice when they have things which other people want. All in all, I think it'd be a great idea. I might actually try and set something like that up. I've got unlimited download/upload and a static IP with my ISP now, so I could try and host a server.

TmEE co.(TM)
Very interested
Posts: 2388
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Mon Jun 06, 2011 8:05 am

I also foundo ne other very interesting FM chip that was used in FM Towns II, the YMF276, which is YM2612/3438 with i2s DAC interface... FM Towns did have a separate PCM chip in it so the DAC channel may be cut in YMF276... I am unable to find any definitive info though.

In any case I will order some YMF288 and YMF276 in nearer future.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Post Reply