First post, by OPLx
Hi everyone,
Since I just registered, I couldn't post this to the patches forum, so I'll try doing so here.
I had noticed a discrepancy between the Gameblaster note frequencies in DOSBox and that of actual hardware. From examining things a bit, it looks like SAA1099 emulator in DOSBox assumes that the clock frequency driving the chip is 8 MHz. This value is correct if one goes by the SAA1099's datasheet. Measuring the actual clock frequency on the Sound Blaster 1.5 that I have, it looks like it is actually somewhere around approximately 7.156 MHz.
While doing some related searches online, I found this formula for calculating the frequency (I'm assuming with an 8MHz clock):
frequency = (15625 * (2^octave)) / (511-note)
"note" here is the value that would be set on the SAA1099's frequency register.
Looking at the datasheet, it's not immediately apparent to myself how this formula was ascertained, but I noticed that the "15625" value may be related to the clock rate, so I tried this:
clock_divsor = 8000000 / 15625, the result being 512.
So doing a little math, one can figure out what the clock divisor should be for a particular input.
The generalized formulas seem to be:
frequency = (sample_frequency * (2^octave)) / (511-note)
note = 511 - ( (sample_frequency * (2^octave)) / frequency )
In the case of the Gameblaster's 7.156MHz clock, sample_frequency would be:
7156000 / 512 = 13977 (rounded up).
Inserting this value for the note and noise frequencies (noise is also driven off of multiples of the clock rate), DOSBox's Gameblaster sounds like that of actual hardware.
I've attached to this message the .diff/.patch file for gameblaster.cpp people to try out; I hope this is of use to everyone.