旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커 � Programming the GameBlaster Sound Card � 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸 Written for the PC-GPE by Mark Feldman e-mail address : u914097@student.canberra.edu.au myndale@cairo.anu.edu.au 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� � THIS FILE MAY NOT BE DISTRIBUTED � � SEPARATE TO THE ENTIRE PC-GPE COLLECTION. � 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� 旼컴컴컴컴컴컫컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� � Disclaimer � 읕컴컴컴컴컴켸 I assume no responsibility whatsoever for any effect that this file, the information contained therein or the use thereof has on you, your sanity, computer, spouse, children, pets or anything else related to you or your existance. No warranty is provided nor implied with this information. 旼컴컴컴컴컴컴컫컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� � Introduction � 읕컴컴컴컴컴컴켸 The GameBlaster sound card (also known as the CMS) is now pretty much obsolete, well I haven't seen any apart from the one I own. The card was developped by Creative Labs, the same people who designed the SoundBlaster. You can still buy the CMS chips to place inside your SoundBlaster 1.0 and 2.0 cards to make them compatible, but believe me, it isn't worth it. The only reason I'm writing this file is because the GameBlaster chips are really easy to program (due to the fact that it can't do anything) so this should be of use to those of you who already own one. I have no idea how to detect the presence of the CMS chips in a SoundBlaster, trying to write to it's registers while the chips were not installed made my machine hang. 旼컴컴컴컴컴컴컴컴컴컴컴컴컫컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� � General Programming Info � 읕컴컴컴컴컴컴컴컴컴컴컴컴켸 The GameBlaster has 12 channels. Each channel can produce either a single sine wave of a given frequency and magnitude (in stereo), or noise. The GameBlaster is programmed through 4 ports as follows: For voices 1 to 6 Write 2x1 with register address Write 2x0 with data to register For voices 7 to 12 Write 2x3 with register address Write 2x2 with data to register The x value depends on the jumper setting on your card, x = 1 for 210h, x = 2 for 220h etc... 旼컴컴컴컴컴컴컴컴컴컴컴컴컫컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� � Reseting the GameBlaster � 읕컴컴컴컴컴컴컴컴컴컴컴컴켸 First you have to reset the GameBlaster and enable all voices. This is done by setting register 1Ch, which is laid out as follows: 旼컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴� � 7 � 6 � 5 � 4 � 3 � 2 � 1 � 0 � 읕컴좔컴좔컴좔컴좔컴좔컴좔컴좔컴� � � Sound Enable for all channels 컴컴컴컴컴컴컴컴컴� � 0 all channels disabled � 1 all channels enabled � � Reset signal to all generators 컴컴컴컴컴컴컴컴컴컴켸 0 all generators enabled 1 all generators reset and synchronized The following Pascal code will reset and enable the card (assuming jumper setting is for 220h) : Port[$221] := $1C; Port[$220] := $02; { Reset voices } Port[$221] := $15; Port[$220] := $00; { Disable noise * } Port[$221] := $1C; Port[$220] := $01; { Enable voices } * Noise is discussed in the next section 旼컴컴컴컴컴컴컴컴컴컴컴컴컫컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� � Enabling Voice Frequency � 읕컴컴컴컴컴컴컴컴컴컴컴컴켸 To hear a frequency from a voice you must set the appropriate bit in register 14h: 旼컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴� � 7 � 6 � 5 � 4 � 3 � 2 � 1 � 0 � 읕컴좔컴좔컴좔컴좔컴좔컴좔컴좔컴� � � � � � � � � � � � 읕� Frequency enable 1/7 � � � � 읕컴컴� Frequency enable 2/8 � � � 읕컴컴컴컴� Frequency enable 3/9 � � 읕컴컴컴컴컴컴� Frequency enable 4/10 � 읕컴컴컴컴컴컴컴컴� Frequency enable 5/11 읕컴컴컴컴컴컴컴컴컴컴� Frequency enable 6/12 Note that for each bit in the above table two voice numbers are given. If ports 2x1 and 2x0 are used then the first voice is modified. If ports 2x3 and 2x2 are used then the second voice is modified. Setting a bit to 1 enables the voice. Clearing it to 0 disables the voice. 旼컴컴컴컴컴컴컴컴컴컴컴컫컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� � Setting a Voice Volume � 읕컴컴컴컴컴컴컴컴컴컴컴켸 Each voice can have a volume between 0 and 15 on both left and right channels. The amplitude registers are laid out as follows: 旼컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴� � 7 � 6 � 5 � 4 � 3 � 2 � 1 � 0 � 읕컴좔컴좔컴좔컴좔컴좔컴좔컴좔컴� 읕컴컴쩡컴컴� 읕컴컴쩡컴컴� � � Right channel volume 컴컴컴컴� 읕컴컴컴� Left channel volume To set a channel volume you write the register address to the appropriate Register Address port and write the volume byte to the Data To Register port. The register address map for amplitudes is as follows: 旼컴컴컴컴컴컴컴컴컴컴컴컴컴커 � Register Address Voice � 쳐컴컴컴컴컴컴컴컴컴컴컴컴컴캑 � 00h 1/7 � � 01h 2/8 � � 02h 3/9 � � 03h 4/10 � � 04h 5/11 � � 05h 6/12 � 읕컴컴컴컴컴컴컴컴컴컴컴컴컴켸 旼컴컴컴컴컴컴컴컴컴컴컴컴컴쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� � Setting a Voice Frequency � 읕컴컴컴컴컴컴컴컴컴컴컴컴컴� Setting a voice frequency is similar to setting the volume, one byte is written to the appropriate register. The frequency register map is as follows: 旼컴컴컴컴컴컴컴컴컴컴컴컴컴커 � Register Address Voice � 쳐컴컴컴컴컴컴컴컴컴컴컴컴컴캑 � 08h 1/7 � � 09h 2/8 � � 0Ah 3/9 � � 0Bh 4/10 � � 0Ch 5/11 � � 0Dh 6/12 � 읕컴컴컴컴컴컴컴컴컴컴컴컴컴켸 The following table is a list of the bytes you write for each note: 旼컴컴컴컴컴컴커 � Note Value � 쳐컴컴컴컴컴컴캑 � A 3 � � A# 31 � � B 58 � � C 83 � � C# 107 � � D 130 � � D# 151 � � E 172 � � F 191 � � F# 209 � � G 226 � � G# 242 � 읕컴컴컴컴컴컴켸 This is the first octave available. The C frequency in this octave is 55 Hz. To get tones in higher octaves you need to set the octave register for a voice. Each octave register stores the octave number for two voices. The octave registers are laid out as follows: 旼컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴� � 7 � 6 � 5 � 4 � 3 � 2 � 1 � 0 � 읕컴좔컴좔컴좔컴좔컴좔컴좔컴좔컴� 읕컴쩡컴� 읕컴쩡컴� � � Octave Number 2 컴컴컴컴� 읕컴컴� Octave number 1 The octave register address map is as follows: 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커 � Register Address Voices � 쳐컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캑 � 10h 2;1 / 8;7 � � 11h 4;3 / 10;9 � � 12h 6;5 / 12;11 � 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸 旼컴컴컴쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� � Noise � 읕컴컴컴� There are 4 noise generators, each noise genrator can be connected up to any of three voices: 旼컴컴컴컴컴컴컴컴컴컴커 � Noise � � Generator Voices � 쳐컴컴컴컴컴컴컴컴컴컴캑 � 1 1,2,3 � � 2 4,5,6 � � 3 7,8,9 � � 4 10,11,12 � 읕컴컴컴컴컴컴컴컴컴컴켸 The noise generators are controlled via two registers: Register 16h at ports 2x1 and 2x0 : 旼컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴� � 7 � 6 � 5 � 4 � 3 � 2 � 1 � 0 � 읕컴좔컴좔컴좔컴좔컴좔컴좔컴좔컴� 읕쩡� 읕쩡� � � Noise Gen 2 컴컴컴컴� 읕컴컴� Noise Gen 1 Register 16h at ports 2x3 and 2x2 : 旼컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴� � 7 � 6 � 5 � 4 � 3 � 2 � 1 � 0 � 읕컴좔컴좔컴좔컴좔컴좔컴좔컴좔컴� 읕쩡� 읕쩡� � � Noise Gen 4 컴컴컴컴� 읕컴컴� Noise Gen 3 Each generator has two bits associated with it which control the noise generator rate: 旼컴컴컴컴컴컴컴컴컴컴커 � Nn1 Nn0 Frequency � 쳐컴컴컴컴컴컴컴컴컴컴캑 � 0 0 28.0 kHz � � 0 1 14.0 kHz � � 1 0 6.8 kHz � 읕컴컴컴컴컴컴컴컴컴컴켸 A voice can be connected to it's noise generator by setting the appropriate bit in register 15h: 旼컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴쩡컴� � 7 � 6 � 5 � 4 � 3 � 2 � 1 � 0 � 읕컴좔컴좔컴좔컴좔컴좔컴좔컴좔컴� � � � � � � � � � � � 읕� Noice enable 1/7 � � � � 읕컴컴� Noice enable 2/8 � � � 읕컴컴컴컴� Noice enable 3/9 � � 읕컴컴컴컴컴컴� Noice enable 4/10 � 읕컴컴컴컴컴컴컴컴� Noice enable 5/11 읕컴컴컴컴컴컴컴컴컴컴� Noice enable 6/12 Setting a bit to 1 enables the voice. Clearing it to 0 disables the voice.