home *** CD-ROM | disk | FTP | other *** search
/ Audio Version 4.94 / audioversion4.94knowledgemediaresourcelibraryoctober1994.iso / msdos / players / ultradox / ultradox.exe / ULTRA.DOC < prev   
Text File  |  1992-12-21  |  10KB  |  253 lines

  1.                     │ Gravis Ultrasound Tech Specs │
  2.                     └──────────────────────────────┘
  3.                            The Unofficial Dox
  4.  
  5.                          Written December, 1992
  6.                 By Tran of Renaissance and Joshua Jensen
  7.  
  8. OK, folks, here it is.  This is the programming information that Gravis
  9. didn't and won't give you any time soon.  These dox have been obtained
  10. through long hours of debug sessions and experimentation.
  11.  
  12. Let's clear up some things that have been debated in comp.sys.ibm.pc.soundcard
  13. for quit sometime now:
  14.  
  15.   ■ The GUS can play 32 mono samples at once, fully pannable through 16
  16.     different positions.
  17.  
  18.   ■ This is still a bit unclear.  The SDK says that samples have to be
  19.     32-byte aligned in memory.  I've been following this.  Maybe that is
  20.     not the case, though, and I haven't tested it.
  21.  
  22. Credits:  Tran came up with the initial information about programming the
  23. card.  Josh documented it and included actual assembly language information
  24. in this archive on how it works.  It's relatively simple, but some things are
  25. unclear and are explained here in the dox and in the code.
  26.  
  27. ────────┬─────────────────────────────────────────────────────────────────────
  28. Methods │
  29. ────────┘
  30. @DELAY = (in byte 300h)*7
  31.  
  32. Description:  All this function does is give a short idle wait for the card
  33.               to do whatever processing it needs to.
  34. ──────────────────┬───────────────────────────────────────────────────────────
  35. Probe Ultra Sound │
  36. ──────────────────┘
  37.   out BASE+103h, 4Ch
  38.   out BASE+105h, 0
  39.   @DELAY
  40.   @DELAY
  41.   out BASE+103h, 4Ch
  42.   out BASE+105h, 1
  43.   Poke Data Byte   Loc:   0h, Byte: AA    ; Don't think this HAS to be an AA.
  44.   Poke Data Byte   Loc: 100h, Byte: 55    ; Don't think this is needed.
  45.   Peek Data Byte   Loc:   0h
  46.   Store Byte
  47.   out BASE+103h, 4Ch
  48.   out BASE+105h, 0
  49.   Restore Byte
  50.   Is it AA?  If so, then we have found a GUS.
  51.  
  52. ──────────────────────────────────────────────────┬───────────────────────────
  53. Test for amount of memory installed on UltraSound │
  54. ──────────────────────────────────────────────────┘
  55.   Poke Data Byte   Loc: 40000h, Byte: AA
  56.   Peek Data Byte   Loc: 40000h
  57.   Is it an AA?  If not, then there is 256k of DRAM.  Exit.
  58.   Poke Data Byte   Loc: 80000h, Byte: AA
  59.   Peek Data Byte   Loc: 80000h
  60.   Is it an AA?  If not, then there is 512k of DRAM.  Exit.
  61.   Poke Data Byte   Loc: C0000h, Byte: AA
  62.   Peek Data Byte   Loc: C0000h
  63.   Is it an AA?  If not, then there is 768k of DRAM.  Exit.
  64.   Poke Data Byte   Loc: 0FFFFFh, Byte: AA
  65.   Peek Data Byte   Loc: 0FFFFFh
  66.   Is it an AA?  If not, then there is 1024k of DRAM.  Exit.
  67.  
  68. Description:  Poke these bytes on the boundaries of 256k, 512k, 768k, and
  69.               1024k.  If the memory isn't there, then it won't return what
  70.               is poked.
  71. ───────────────┬──────────────────────────────────────────────────────────────
  72. Peek Data Byte │
  73. ───────────────┘
  74.   out BASE+103h, 43h
  75.   out BASE+104h, low word address
  76.   out BASE+103h, 44h
  77.   out BASE+105h, high byte address
  78.   in  BASE+107h, INBYTE
  79.  
  80. Description:  The card's memory can be from 00000h to fffffh.  INBYTE is the
  81.               byte value returned from the card that was at that memory
  82.               location.
  83. ───────────────┬──────────────────────────────────────────────────────────────
  84. Poke Data Byte │
  85. ───────────────┘
  86.   out BASE+103h, 43h
  87.   out BASE+104h, low word address
  88.   out BASE+103h, 44h
  89.   out BASE+105h, high byte address
  90.   out BASE+107h, OUTBYTE
  91. ────────────────────┬─────────────────────────────────────────────────────────
  92. Set Voice Frequency │
  93. ────────────────────┘
  94.   out BASE+102h, voice number
  95.   out BASE+103h, 1
  96.   out BASE+104h, word frequency number (actual frequency / 19.0579083837)
  97.  
  98. Description:  Tran thought he'd give you the exact value :)  Dividing by 19
  99.               will give enough accuracy for the task, though.
  100. ──────────────────┬───────────────────────────────────────────────────────────
  101. Set Voice Balance │
  102. ──────────────────┘
  103.   out BASE+102h, voice number
  104.   out BASE+103h, 0ch
  105.   out BASE+105h, byte balance (0-0fh)
  106.  
  107. Description: The Balance byte can range from 0 to 15.  0 is far left,
  108.              15 is far right, and 7 is right in the middle.
  109. ─────────────────┬────────────────────────────────────────────────────────────
  110. Set Voice Volume │
  111. ─────────────────┘
  112.   out BASE+102h, voice number
  113.   out BASE+103h, 9
  114.   out BASE+104h, word volume value (0-0ffffh, log ... not linear)
  115. ──────────────┬───────────────────────────────────────────────────────────────
  116. Set Loop Mode │
  117. ──────────────┘
  118.   out BASE+102h, voice number
  119.   out BASE+103h, 80h
  120.   in  BASE+105h, TEMP
  121.   out BASE+103h, 0
  122.   out BASE+105h, (TEMP & 0e7h) or MODE
  123.  
  124. Description:  This is not really necessary.  Actually, the Set Loop Mode and
  125.               Stop Voice Immediately could be one function.
  126. ───────────────────────┬──────────────────────────────────────────────────────
  127. Stop Voice Immediately │
  128. ───────────────────────┘
  129.   out BASE+102h, voice number
  130.   out BASE+103h, 80h
  131.   in  BASE+105h, TEMP
  132.   out BASE+103h, 0
  133.   out BASE+105h, (TEMP & 0dfh) | 3
  134.   @DELAY
  135.   out BASE+103h, 0
  136.   out BASE+105h, (TEMP & 0dfh) | 3
  137.  
  138. Description:  Dunno why the extra delay and duplicated code is there.
  139. ────────────────────┬─────────────────────────────────────────────────────────
  140. Start Voice Playing │
  141. ────────────────────┘
  142.   out BASE+102h, voice number
  143.   out BASE+103h, 0ah
  144.   out BASE+104h, word BEGIN >> 7
  145.   out BASE+103h, 0bh
  146.   out BASE+104h, word BEGIN << 9
  147.   out BASE+103h, 2
  148.   out BASE+104h, word START >> 7
  149.   out BASE+103h, 3
  150.   out BASE+104h, word START << 9
  151.   out BASE+103h, 4
  152.   out BASE+104h, word END >> 7
  153.   out BASE+103h, 5
  154.   out BASE+104h, word END << 9
  155.   out BASE+103h, 0
  156.   out BASE+105h, MODE & 0fch
  157.  
  158. ────────────────────┬─────────────────────────────────────────────────────────
  159. Read Voice Location │
  160. ────────────────────┘
  161.   out BASE+102h, voice number
  162.   out BASE+103h, 8ah
  163. ; in  BASE+104h, low byte TEMP0
  164. ; in  BASE+105h, high byte TEMP0
  165.   in  BASE+104h, word TEMP0
  166.   out BASE+103h, 8bh
  167. ; in  BASE+104h, low byte TEMP1
  168. ; in  BASE+105h, high byte TEMP1
  169.   in  BASE+104h, word TEMP1
  170.  
  171.     LOC = ((TEMP0 << 7) | (TEMP1 >> 9)) & 0xfffff
  172.  
  173. Note: Word read at BASE+104h seems to work same as sequential byte reads
  174.       from BASE+104h then BASE+105h.
  175. ──────────────────────────────────────────────────────────────────────────────
  176.  
  177. ──────┬───────────────────────────────────────────────────────────────────────
  178. Ports │ As you can see, there are a lot of blanks to be filled.  Hope Gravis
  179. ──────┘ will take a hint soon.
  180.  
  181. BASE - write only, mix control
  182. ┌───┬───┬───┬───┬───┬───┬───┬───┐
  183. │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  184. └─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┘
  185.   ?   ?   ?   ?   ?   │   │   │
  186.                       │   │   └ 0 = Line in on.  1 = Line in off.
  187.                       │   └──── 0 = Output on.   1 = Output off.
  188.                       └──────── 0 = Mic in off.  1 = Mic in on.   ???
  189.  
  190. BASE+102h - Active voice select (byte port)
  191.  
  192. BASE+103h - command port (byte port)
  193.   Bitmap so far:
  194.   ┌───┬───┬───┬───┬───┬───┬───┬───┐
  195.   │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  196.   └─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┘
  197.     │   │   ?   ?   │   │   │   │
  198.     │   │           │   │   │   │
  199.     │   │           │   │   └───┤
  200.     │   │           │   └───────┼ Command for voice
  201.     │   │           └───────────┘
  202.     │   └──────────────────────── Command for card.
  203.     └──────────────────────────── Read from voice.
  204.  
  205.    0h - write voice mode (loop and data type)           - byte on 105h
  206.   ┌───┬───┬───┬───┬───┬───┬───┬───┐
  207.   │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │     Designated as MODE through dox
  208.   └─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┘
  209.     ?   ?   ?   │   │   │   │   │
  210.                 │   │   │   │   └ Voice On/Off (If both set to 0, voice on.)
  211.                 │   │   │   └──── Voice On/Off (If both set to 1, voice off.)
  212.                 │   │   └──────── 0 = 8 bit data.  1 = 16 bit data.
  213.                 │   └──────────── 0 = No loop.     1 = Loop Sample.
  214.                 └──────────────── 0 = Go forward.  1 = Go backward.
  215.    1h - voice frequency                                 - word on 104h
  216.    2h - loop start location / 80h                       - word on 104h
  217.    3h - loop start location << 9                        - word on 104h
  218.    4h - loop end location / 80h                         - word on 104h
  219.    5h - loop end location << 9                          - word on 104h
  220.    9h - voice volume                                    - word on 104h
  221.   0ah - voice location / 80h                            - word on 104h
  222.   0bh - voice location << 9                             - word on 104h
  223.   0ch - voice balance                                   - byte on 105h
  224.   0eh - Unsure.  Has something to do with turning       - byte on 105h
  225.           stereo on and off.  See U_Reset for an
  226.           example of usage.
  227.   43h - low word of DRAM address                        - word on 104h
  228.   44h - high byte of DRAM address                       - byte on 105h
  229.   4Ch - Unsure exactly of what this does                - byte on 105h
  230.           However, a 1 must be output to BASE+105h for
  231.           the card to do memory writes.  At least, that's
  232.           the only way I could get it to work.
  233.   80h - read voice mode                                 - byte on 105h
  234.   8ah - read voice location                             - bytes on 104h, 105h
  235.   8bh - read voice location                             - bytes on 104h, 105h
  236.  
  237. Notes:  Any >= 80h plus a number might be the read mode of the value - 80h.
  238.         In other words, to read the voice volume (this is untested), you'd
  239.         output an 89h through BASE+103h and then read BASE+105h.
  240.  
  241. BASE+104h - word writes/reads
  242. BASE+105h - byte writes/reads
  243.  
  244. ──────┬───────────────────────────────────────────────────────────────────────
  245. Notes │
  246. ──────┘
  247. To stop an instrument when the sample ends (not immediately), change its
  248. loop type to 'no loop'.
  249.  
  250. If you are making a lot of changes to just ONE voice, the
  251. OUT BASE+102h, Channel needs only to be done once.
  252.  
  253.