Programming The SCC
What follows here is a technical description of how the chip works. Official documentation was never released to the public so all of this is reverse-engineered.
The SCC is accessed through memory-mapped I/O. First 3Fh (the two high bits are unimportant, so FFh is fine too) must be written to somewhere between 9000h and 97FFh. Now the SCC is active (you can read and write) at 9800h to 9FFFh.
Address | read/write | Function |
---|---|---|
9800h - 981Fh | rw | waveform channel 1 |
9820h - 983Fh | rw | waveform channel 2 |
9840h - 985Fh | rw | waveform channel 3 |
9860h - 987Fh | rw | waveform channel 4 and 5 |
9880h - 9881h | w | frequency channel 1 |
9882h - 9883h | w | frequency channel 2 |
9884h - 9885h | w | frequency channel 3 |
9886h - 9887h | w | frequency channel 4 |
9888h - 9889h | w | frequency channel 5 |
988Ah | w | volume channel 1 |
988Bh | w | volume channel 2 |
988Ch | w | volume channel 3 |
988Dh | w | volume channel 4 |
988Eh | w | volume channel 5 |
988Fh | w | on/off switch channel 1 to 5 |
9890h - 989Fh | same as 9880h to 988Fh | |
98A0h - 98DFh | no function | |
98E0h - 98FFh | rw | deformation register |
The waveform is made up of 32, signed (two's complement) bytes. The waveform represents the actual form of the tone the sound chip produces. It's played back from byte 0 to 31 and then again from the start.
The frequency is stored the same way as in the PSG. It is a 12-bit value. The first byte contains bits 0 to 7 from the frequency and bits 0 to 3 of the second byte contain bits 8 to 11 of the frequency. Bits 4 to 7 of the second byte are ignored. Remember that the value you enter is really a period: a higher value gives a lower frequency.
The formula for calculating the frequency of the tone is almost the same than for the PSG:
is the clock of the computer (always 3,579,545Hz on an MSX) and P is the 12 bits period set in the frequency register.
The volume is stored in the same way as in the MSX PSG, though it does not support envelopes. Bits 0 to 3 contain a volume of 0 to 15, and bits 7 to 4 are ignored. A volume of 0 is silent, and a volume of 15 is maximum volume.
Note: SCC volume is linear while the MSX PSG (usually the AY8910) has logarithmic levels according to (execept for n=0 that gives no output).
The on/off switch register switches the different channels on or off. Set bit 0 to activate channel 1, bit 1 for channel 2, and so on to bit 4 for channel 5. Bits 5 through 7 are ignored.
Read more about this topic: Konami SCC
Famous quotes containing the word programming:
“If there is a price to pay for the privilege of spending the early years of child rearing in the drivers seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.”
—Melinda M. Marshall (20th century)