===========================================================================
Packet: ROMEO
Date: 08-24-93 (12:44)             Number: 1983
From: Bernie Pallek                Refer#: NONE
  To: All                           Recvd: NO
Subj: [2/3] GUS Programming          Conf: (26) 80xxx
---------------------------------------------------------------------------
<=- Gravis Ultrasound programming, part 2/3 -=>

----- Set Voice Frequency -----
  out BASE+102h, voice number
  out BASE+103h, 1
  out BASE+104h, word frequency number (actual frequency / 19.0579083837)

Notes: Dividing by 19 will give enough accuracy for the task.

----- Set Voice Balance -----
  out BASE+102h, voice number
  out BASE+103h, 0ch
  out BASE+105h, byte balance (0-0fh)

Notes: The Balance byte can range from 0 to 15.  0 is far left,
       15 is far right, and 7 is right in the middle.

----- Set Voice Volume -----
  out BASE+102h, voice number
  out BASE+103h, 9
  out BASE+104h, word volume value (0-0ffffh, log ... not linear)

----- Set Loop Mode -----
  out BASE+102h, voice number
  out BASE+103h, 80h
  in  BASE+105h, TEMP
  out BASE+103h, 0
  out BASE+105h, (TEMP & 0e7h) or MODE

Notes: This is not really necessary.  Actually, the Set Loop Mode and
       Stop Voice Immediately could be one function.

----- Stop Voice Immediately -----
  out BASE+102h, voice number
  out BASE+103h, 80h
  in  BASE+105h, TEMP
  out BASE+103h, 0
  out BASE+105h, (TEMP & 0dfh) | 3
  @DELAY                               ; dunno why the extra delay and
  out BASE+103h, 0                     ; duplicated code is used
  out BASE+105h, (TEMP & 0dfh) | 3

----- Start Voice Playing -----
  out BASE+102h, voice number
  out BASE+103h, 0ah
  out BASE+104h, word BEGIN >> 7
  out BASE+103h, 0bh
  out BASE+104h, word BEGIN << 9
  out BASE+103h, 2
  out BASE+104h, word START >> 7
  out BASE+103h, 3
  out BASE+104h, word START << 9
  out BASE+103h, 4
  out BASE+104h, word END >> 7
  out BASE+103h, 5
  out BASE+104h, word END << 9
  out BASE+103h, 0
  out BASE+105h, MODE & 0fch

----- Read Voice Location -----
  out BASE+102h, voice number
  out BASE+103h, 8ah
; in  BASE+104h, low byte TEMP0
; in  BASE+105h, high byte TEMP0
  in  BASE+104h, word TEMP0
  out BASE+103h, 8bh
; in  BASE+104h, low byte TEMP1
; in  BASE+105h, high byte TEMP1
  in  BASE+104h, word TEMP1

    LOC = ((TEMP0 << 7) | (TEMP1 >> 9)) & 0xfffff

Note: Word read at BASE+104h seems to work same as sequential byte reads
      from BASE+104h then BASE+105h.

<=- end of 2/3, continued in next message -=>


--- Maximus 2.01wb
 * Origin: * idiot savant * +1 416 935 6628 * (1:247/128)
