How I got speech to work in Sinistar

Several people have asked me how I got sinistar to speak.  Instead of responding to each one individually, I figured it would be easier to post the code here.  First, I want to thank Sean Riddle for helping me find the information I needed to simulate the operation of the speech compression chip.  Sinistar has a Harris 55564 CVSD (Continuously Variable Slope Delta-Modulator) which uses a 1bit stream of data to simulate the ups and downs of an audio signal.  The Harris data sheet doesn't say a whole lot, so I found a similar chip from Motorola (AN1544) which had a decently detailed data sheet.   Like the DAC used to generate digitized sounds, the 55564 is hooked up to the PIA on the 6808 through two 1-bit ports (1 for clock, 1 for data).  I examined the operation of the 6808 code and it places the data on the output bit when it changes, and toggles the clock bit at a rate of 16Khz.  The basic way that it works is that the 1 bit data stream adds or subtracts the delta value from the current 10-bit DAC counter.   A flat (silent) analog signal would produce a series of alternating ones and zeros.   There is a 3-bit shift register which detects over or underflow conditions (when the step value is too small to keep up with the slope of the signal).  When this condition occurs, the step value is incremented, otherwise it is decremented.   So...the step value is constantly changing to meet the conditions of the compressed data.  The step value changes based on an RC network which has a time constant of 4ms.  I do not have good details about how the step value is chosen, but my approximation at least gives speech that you can understand.  My Sinistar emulation still does not play perfectly because I am not simulating the operation of the 6821 properly and this game makes heavy use of proper 6821 behavior.  This will have to be left for a future date...

Back