<< Newer Article #156 Older >>

Long Time Coming…

And so another month and a half without a post. So what's been keeping me busy recently?

Well, the MAME 0.105 release for one thing. When I started out doing some initial cleanup work, I did not expect to stretch the dev cycle for that release into two months! But I just kept finding more and more ways of getting the core system into better shape, and decided it was best to get as much of it done at once while I still had the interest. And then there was the usual cycle of bugs. But in the end, I'm much happier with the way the system is initialized and cleaned up. It all makes much more sense now, and is much better documented.

Near the end of 0.105, I started getting the itch to actually emulate some stuff again instead of breaking a bunch of already-working things some more (imagine that!) Sega's Universal Sound Board is something I've been meaning to dive into for quite some time. Only two games were known to use it: Star Trek and Tac/Scan. As Sega vector games, they were also on my list to fix for another reason ... MAME was far too accurate at emulating the vector generator.

Wait, what do you mean, "too accurate?" you might be asking. Well, I couldn't help but notice when I was at California Extreme last year, playing Zektor, that after the big face taunts you at the start of the level and it begins to shrink down, the arcade game was very jerky -- it wasn't a nice, smooth scaling like I had always seen it in MAME. I looked into it a bit then, and found that the vector generation code in MAME used real double precision floating point sine and cosine values to accuracies that were not likely for 1981.

So I decided to completely rewrite the Sega vector generator according to the schematics. Turns out I was right. The Sega vector generator lets you specify an angle and length for each vector in a shape, and an overall angle and size for each shape as a whole. This is done by adding the vector and shape angles, computing the sine/cosine, and multiplying them by the vector length and shape size. In MAME, this was done to high precision, using a sine/cosine lookup table with full accuracy, and 32-bit math. On the actual hardware, the sine/cosine lookup table was sigificantly smaller with less resolution, and only the top 9 bits were used out of the multiplcation result. So now if you play any of the Sega vector games, you may notice some jerkiness that wasn't there before. It's most noticeable in the lower window in Star Trek and during the previously mentioned shrinking effect in Zektor.

But back to the Universal Sound Board. I figured this wouldn't be too difficult because it had some similarities to the Exidy sound board (used in Venture-era games), and I had already conquered that one many years ago. But the Sega board had its own share of interesting surprises. It is really a hybrid digital/analog system, so I ended up having to emulate a number of RC and CR filters along the various paths. It also used a digital noise source which produced white noise, but then ran it through an interesting series of filters that I just couldn't figure out. Luckily Frank Palazzolo had the insight that it was filtering the white noise into pink noise, and from there I was able to generate a pretty reasonable facsimile of the correct effect. In fact, if I run the sound self-test in Star Trek using the old samples and the new emulation, they are very close to identical apart from volume (maybe not as good as Derrick's stuff, but pretty good). Unfortunately Tac/Scan doesn't quite match up as well as I'd like, but it's actually pretty close. Hopefully with some more advice from the analog experts, I can nail that one soon.

After I did that, someone pointed out to me that Pig Newton also used the Universal Sound Board. Sweet! Plugging that it did indeed confirm that the main CPU uploads the sound code to the USB and plays some sound effects at the appropriate time. I love it when a plan comes together. :)

With all that work behind me, and most of the bugs caused by my core shuffling quashed, it was finally time to get 0.105 out the door. And then on to something new. I've been curious for a long time why the Arcadia games -- which are based off the Amiga hardware -- didn't have sound. Turns out it's just that it hadn't been implemented yet. So I started (re-)learning about the Amiga. But that's for another post.