home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / FAQSYS18.ZIP / FAQS.DAT / GAMEBLST.TXT < prev    next >
Text File  |  1996-01-04  |  12KB  |  276 lines

  1.  
  2.                ┌────────────────────────────────────────┐
  3.                │ Programming the GameBlaster Sound Card │
  4.                └────────────────────────────────────────┘
  5.  
  6.                   Written for the PC-GPE by Mark Feldman
  7.               e-mail address : u914097@student.canberra.edu.au
  8.                                myndale@cairo.anu.edu.au
  9.  
  10.              ┌───────────────────────────────────────────┐
  11.              │      THIS FILE MAY NOT BE DISTRIBUTED     │
  12.              │ SEPARATE TO THE ENTIRE PC-GPE COLLECTION. │
  13.              └───────────────────────────────────────────┘
  14.  
  15.  
  16. ┌────────────┬───────────────────────────────────────────────────────────────
  17. │ Disclaimer │
  18. └────────────┘
  19.  
  20. I assume no responsibility whatsoever for any effect that this file, the
  21. information contained therein or the use thereof has on you, your sanity,
  22. computer, spouse, children, pets or anything else related to you or your
  23. existance. No warranty is provided nor implied with this information.
  24.  
  25. ┌──────────────┬─────────────────────────────────────────────────────────────
  26. │ Introduction │
  27. └──────────────┘
  28.  
  29. The GameBlaster sound card (also known as the CMS) is now pretty much
  30. obsolete, well I haven't seen any apart from the one I own. The card was
  31. developped by Creative Labs, the same people who designed the SoundBlaster.
  32. You can still buy the CMS chips to place inside your SoundBlaster 1.0 and
  33. 2.0 cards to make them compatible, but believe me, it isn't worth it. The
  34. only reason I'm writing this file is because the GameBlaster chips are really
  35. easy to program (due to the fact that it can't do anything) so this should be
  36. of use to those of you who already own one.
  37.  
  38. I have no idea how to detect the presence of the CMS chips in a SoundBlaster,
  39. trying to write to it's registers while the chips were not installed made
  40. my machine hang.
  41.  
  42. ┌──────────────────────────┬─────────────────────────────────────────────────
  43. │ General Programming Info │
  44. └──────────────────────────┘
  45.  
  46. The GameBlaster has 12 channels. Each channel can produce either a single
  47. sine wave of a given frequency and magnitude (in stereo), or noise.
  48.  
  49. The GameBlaster is programmed through 4 ports as follows:
  50.  
  51.     For voices 1 to 6
  52.         Write 2x1 with register address
  53.         Write 2x0 with data to register
  54.  
  55.     For voices 7 to 12
  56.         Write 2x3 with register address
  57.         Write 2x2 with data to register
  58.  
  59. The x value depends on the jumper setting on your card, x = 1 for 210h, x =
  60. 2 for 220h etc...
  61.  
  62. ┌──────────────────────────┬─────────────────────────────────────────────────
  63. │ Reseting the GameBlaster │
  64. └──────────────────────────┘
  65.  
  66. First you have to reset the GameBlaster and enable all voices. This is done
  67. by setting register 1Ch, which is laid out as follows:
  68.  
  69.                       ┌───┬───┬───┬───┬───┬───┬───┬───┐
  70.                       │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  71.                       └───┴───┴───┴───┴───┴───┴───┴───┘
  72.                                                 │   │
  73. Sound Enable for all channels ──────────────────┘   │
  74.   0 all channels disabled                           │
  75.   1 all channels enabled                            │
  76.                                                     │
  77. Reset signal to all generators ─────────────────────┘
  78.   0 all generators enabled
  79.   1 all generators reset and synchronized
  80.  
  81. The following Pascal code will reset and enable the card (assuming jumper
  82. setting is for 220h) :
  83.  
  84.   Port[$221] := $1C;
  85.   Port[$220] := $02; { Reset voices }
  86.   Port[$221] := $15;
  87.   Port[$220] := $00; { Disable noise * }
  88.   Port[$221] := $1C;
  89.   Port[$220] := $01; { Enable voices }
  90.  
  91. * Noise is discussed in the next section
  92.  
  93.  
  94. ┌──────────────────────────┬─────────────────────────────────────────────────
  95. │ Enabling Voice Frequency │
  96. └──────────────────────────┘
  97.  
  98. To hear a frequency from a voice you must set the appropriate bit in
  99. register 14h:
  100.  
  101.        ┌───┬───┬───┬───┬───┬───┬───┬───┐
  102.        │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  103.        └───┴───┴───┴───┴───┴───┴───┴───┘
  104.                  │   │   │   │   │   │
  105.                  │   │   │   │   │   └── Frequency enable 1/7
  106.                  │   │   │   │   └────── Frequency enable 2/8
  107.                  │   │   │   └────────── Frequency enable 3/9
  108.                  │   │   └────────────── Frequency enable 4/10
  109.                  │   └────────────────── Frequency enable 5/11
  110.                  └────────────────────── Frequency enable 6/12
  111.  
  112. Note that for each bit in the above table two voice numbers are given. If
  113. ports 2x1 and 2x0 are used then the first voice is modified. If ports 2x3
  114. and 2x2 are used then the second voice is modified.
  115.  
  116. Setting a bit to 1 enables the voice. Clearing it to 0 disables the voice.
  117.  
  118. ┌────────────────────────┬───────────────────────────────────────────────────
  119. │ Setting a Voice Volume │
  120. └────────────────────────┘
  121.  
  122. Each voice can have a volume between 0 and 15 on both left and right
  123. channels. The amplitude registers are laid out as follows:
  124.  
  125.                       ┌───┬───┬───┬───┬───┬───┬───┬───┐
  126.                       │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  127.                       └───┴───┴───┴───┴───┴───┴───┴───┘
  128.                         └─────┬─────┘   └─────┬─────┘
  129.                               │               │
  130.  Right channel volume ────────┘               └──────── Left channel volume
  131.  
  132.  
  133. To set a channel volume you write the register address to the appropriate
  134. Register Address port and write the volume byte to the Data To Register
  135. port. The register address map for amplitudes is as follows:
  136.  
  137.                    ┌────────────────────────────┐
  138.                    │ Register Address     Voice │
  139.                    ├────────────────────────────┤
  140.                    │       00h             1/7  │
  141.                    │       01h             2/8  │
  142.                    │       02h             3/9  │
  143.                    │       03h             4/10 │
  144.                    │       04h             5/11 │
  145.                    │       05h             6/12 │
  146.                    └────────────────────────────┘
  147.  
  148. ┌───────────────────────────┬────────────────────────────────────────────────
  149. │ Setting a Voice Frequency │
  150. └───────────────────────────┘
  151.  
  152. Setting a voice frequency is similar to setting the volume, one byte is
  153. written to the appropriate register. The frequency register map is as
  154. follows:
  155.  
  156.                    ┌────────────────────────────┐
  157.                    │ Register Address     Voice │
  158.                    ├────────────────────────────┤
  159.                    │       08h             1/7  │
  160.                    │       09h             2/8  │
  161.                    │       0Ah             3/9  │
  162.                    │       0Bh             4/10 │
  163.                    │       0Ch             5/11 │
  164.                    │       0Dh             6/12 │
  165.                    └────────────────────────────┘
  166.  
  167. The following table is a list of the bytes you write for each note:
  168.  
  169.  
  170.                          ┌──────────────┐
  171.                          │ Note   Value │
  172.                          ├──────────────┤
  173.                          │  A        3  │
  174.                          │  A#      31  │
  175.                          │  B       58  │
  176.                          │  C       83  │
  177.                          │  C#     107  │
  178.                          │  D      130  │
  179.                          │  D#     151  │
  180.                          │  E      172  │
  181.                          │  F      191  │
  182.                          │  F#     209  │
  183.                          │  G      226  │
  184.                          │  G#     242  │
  185.                          └──────────────┘
  186.  
  187. This is the first octave available. The C frequency in this octave is
  188. 55 Hz.
  189.  
  190. To get tones in higher octaves you need to set the octave register for a 
  191. voice. Each octave register stores the octave number for two voices. The
  192. octave registers are laid out as follows:
  193.  
  194.                       ┌───┬───┬───┬───┬───┬───┬───┬───┐
  195.                       │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  196.                       └───┴───┴───┴───┴───┴───┴───┴───┘
  197.                             └───┬───┘       └───┬───┘
  198.                                 │               │
  199.         Octave Number 2 ────────┘               └────── Octave number 1
  200.  
  201. The octave register address map is as follows:
  202.  
  203.                     ┌──────────────────────────────────┐
  204.                     │ Register Address     Voices      │
  205.                     ├──────────────────────────────────┤
  206.                     │     10h              2;1 / 8;7   │
  207.                     │     11h              4;3 / 10;9  │
  208.                     │     12h              6;5 / 12;11 │
  209.                     └──────────────────────────────────┘
  210.  
  211. ┌───────┬────────────────────────────────────────────────────────────────────
  212. │ Noise │
  213. └───────┘
  214.  
  215. There are 4 noise generators, each noise genrator can be connected up to
  216. any of three voices:
  217.  
  218.                           ┌──────────────────────┐
  219.                           │   Noise              │
  220.                           │  Generator   Voices  │
  221.                           ├──────────────────────┤
  222.                           │   1           1,2,3  │
  223.                           │   2           4,5,6  │
  224.                           │   3           7,8,9  │
  225.                           │   4         10,11,12 │
  226.                           └──────────────────────┘
  227.  
  228.  
  229. The noise generators are controlled via two registers:
  230.  
  231. Register 16h at ports 2x1 and 2x0 :
  232.  
  233.                    ┌───┬───┬───┬───┬───┬───┬───┬───┐
  234.                    │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  235.                    └───┴───┴───┴───┴───┴───┴───┴───┘
  236.                              └─┬─┘           └─┬─┘
  237.                                │               │
  238.            Noise Gen 2 ────────┘               └────── Noise Gen 1
  239.  
  240. Register 16h at ports 2x3 and 2x2 :
  241.  
  242.                    ┌───┬───┬───┬───┬───┬───┬───┬───┐
  243.                    │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  244.                    └───┴───┴───┴───┴───┴───┴───┴───┘
  245.                              └─┬─┘           └─┬─┘
  246.                                │               │
  247.            Noise Gen 4 ────────┘               └────── Noise Gen 3
  248.  
  249. Each generator has two bits associated with it which control the noise
  250. generator rate:
  251.  
  252.                        ┌──────────────────────┐
  253.                        │ Nn1 Nn0    Frequency │
  254.                        ├──────────────────────┤
  255.                        │ 0   0     28.0 kHz   │
  256.                        │ 0   1     14.0 kHz   │
  257.                        │ 1   0      6.8 kHz   │
  258.                        └──────────────────────┘
  259.  
  260. A voice can be connected to it's noise generator by setting the appropriate
  261. bit in register 15h:
  262.  
  263.                 ┌───┬───┬───┬───┬───┬───┬───┬───┐
  264.                 │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  265.                 └───┴───┴───┴───┴───┴───┴───┴───┘
  266.                           │   │   │   │   │   │
  267.                           │   │   │   │   │   └── Noice enable 1/7
  268.                           │   │   │   │   └────── Noice enable 2/8
  269.                           │   │   │   └────────── Noice enable 3/9
  270.                           │   │   └────────────── Noice enable 4/10
  271.                           │   └────────────────── Noice enable 5/11
  272.                           └────────────────────── Noice enable 6/12
  273.  
  274. Setting a bit to 1 enables the voice. Clearing it to 0 disables the voice.
  275.  
  276.