Posted: Mon Feb 23, 2009 7:30 pm
Wow, huge post Kind of odd that you would post this right now. I have a ton of SSG-EG samples I did years ago, but I lost the test ROMs that created them, so I didn't know what I was looking at. This weekend I found them and spent most of it looking into this again. I'll read your post properly later and see if it matches what I came up with, a brief look says that some of it does, but there's stuff I didn't get around to yet that you've probably covered. So, all in all, I probably just wasted a weekend
All the other stuff seems to be correct, at first glance anyway.
[edit] ok, so the bits I hadn't gotten to yet seem to be the bits that make the least sense. "Surprising" isn't the word. Given what the thing is supposed to do, you'd have to be on crack to implement it this way. I don't doubt that what you posted does indeed match the output of the real chip - it does seem to explain exactly what I'm seeing (all except one case which I won't be able to confirm without testing). But I do wonder if there is another way of getting the same results from some of this, just because - well - it's pretty insane I'd be interested to hear more about how you came to some of these conclusions and the tests you did to verify.
[edit again] I missed this...
This is a sample I produced long ago while investigating the detune bug, and the filters. Top is a Genesis model 1, bottom is a Genesis model 2. Throughout the entire test, everything is played at max volume. The large bars you see are a normal note which is in a range which does not get filtered at all, showing you what the actual output volume is supposed to be. Everything else is a note played utilising the detune bug.
All of the frequencies produced are the same on both consoles. But the filter in the Genesis 2 has a fair amount of ripple, whereas the Genesis 1 filter flattens out nicely. As you can see, most of the time the Genesis 2 filters out more than the Genesis 1. But the 4th, 5th and 9th note in this picture show the Genesis 2 letting through significantly more than the Genesis 1 does. The 5th note played is, I believe, the one used by Battletech. The Genesis 1 cuts out most of the high frequency created by using this note as a modulator, the Genesis 2 lets a lot of it through. As a side note, this would be much softer than it actually is on a Genesis 1 if it wasn't for the distortion created at this low volume.
All the other stuff seems to be correct, at first glance anyway.
[edit] ok, so the bits I hadn't gotten to yet seem to be the bits that make the least sense. "Surprising" isn't the word. Given what the thing is supposed to do, you'd have to be on crack to implement it this way. I don't doubt that what you posted does indeed match the output of the real chip - it does seem to explain exactly what I'm seeing (all except one case which I won't be able to confirm without testing). But I do wonder if there is another way of getting the same results from some of this, just because - well - it's pretty insane I'd be interested to hear more about how you came to some of these conclusions and the tests you did to verify.
Not that it's important, but I would agree with you that writing to registers while the envelope generator is running is really something you're not supposed to do, and the odd things that can happen when you do this can't really be considered 'bugs'. But I disagree on the oddness that happens when AR!=0x1F. The fact that the documentation tells you to do that just strikes me as a "oops, we didn't test this" from Yamaha. Any sensible implementation of SSG-EG wouldn't have this problem, there should be no reason it's needed, and there's plenty of places where they could have, should have, and probably would have (if they'd thought of it) just forced the attenuation to zero - IF that was how it was originally intended to work. "You must use 0x1F" is a workaround, definitely a bug imo.Nemesis wrote:These aren't bugs, simply areas of undefined behaviour where the result is not specified, because "you're not supposed to do that".
Yeah, I thought I'd covered every case that was actually used, and planned to go further later, but then lost the ability to do so. Didn't know about that damn olympics game...Nemesis wrote:Note that existing emulators, including MAME and Kega, get a lot of the above implementation wrong.
There's something that you could test. Fairly unimportant, but I believe the reason why it's 3 cycles is that the YM2203 updates the envelopes for channel 1 on the first cycle, channel 2 on the second cycle... The YM2612 probably does one channel from each 'half' every cycle.Nemesis wrote:In fact, the envelope generator is updated once every 3 fm update cycles, which was the existing behaviour in the MAME core.
[edit again] I missed this...
I think there are a number of things that cause the difference, but this is I believe the main one.Nemesis wrote:I've also figured out the cause of the different sound in Battletech track 12
This is a sample I produced long ago while investigating the detune bug, and the filters. Top is a Genesis model 1, bottom is a Genesis model 2. Throughout the entire test, everything is played at max volume. The large bars you see are a normal note which is in a range which does not get filtered at all, showing you what the actual output volume is supposed to be. Everything else is a note played utilising the detune bug.
All of the frequencies produced are the same on both consoles. But the filter in the Genesis 2 has a fair amount of ripple, whereas the Genesis 1 filter flattens out nicely. As you can see, most of the time the Genesis 2 filters out more than the Genesis 1. But the 4th, 5th and 9th note in this picture show the Genesis 2 letting through significantly more than the Genesis 1 does. The 5th note played is, I believe, the one used by Battletech. The Genesis 1 cuts out most of the high frequency created by using this note as a modulator, the Genesis 2 lets a lot of it through. As a side note, this would be much softer than it actually is on a Genesis 1 if it wasn't for the distortion created at this low volume.