Thak--Sound
SetBlaster (Tim Zadigian)
    Purpose: To look in the Program Segment Prefix and find the offset where the system variables are held.  It then
                   searches through the system variables untill it finds the BLASTER section.  It will then looks at A- the
                   BASE, I- the IRQ, and D- the DMA, and it will the set the BASE, IRQ, and DMA variables.  It will allow
                   the game to use sound on computers which may not have the sound card installed to the defaults.
    Inputs: None
    Outputs: Sets DMA, IRQ, and BASE variables.

AssignDMARegs (Tim Zadigian)
        Purpose: Once the DMA has been found, the Page, address and count registers must be set because they are different
                       for every DMA.  It takes the DMA and maps it to those registers.
        Inputs:  None. Uses DMA and DMACH Variables.
        Output:         Sets the PAGEREG, ADDRREG, and COUNTREG

PlayWav (Tim Zadigian)
        Purpose:  Is called when you want a wav to be played.  It will call all the funcitons to load the wav, setup the DMA,
                       setup the DSP, and finialy plays the wav file.
        Inputs:  dx- the offset variable for wav sound to be played
                    bl- the sampling rate for that specific wav file
        Outputs: Plays a Wav file

LoadWav (Tim Zadigian)
        Purpose:  Takes a wav file and used the dos file handlers to open the file, read it to the wav buffer, and then
                       to close the file.
        Inputs:  FileName: the variable with the offset of the wave sound to be opened
        Outputs:  loads a wav file to the WavBuffer, and sets the WavLength variable

dsp_reset  (from 291 web notes)
        Purpose:  It resets the DSP so that it is ready to accept commands so we can play our wav files.  This Code is taken
                                from the 291 web notes, and varibles where change to work with our Program.
        Inputs:  None. Checks BASE, RESET, AVAIL, READ
        Outputs:  Resets the DSP.

SetDMA (Tim Zadigian)
        Purpose: Sets up the DMA transfer to transfer the wav data to the sound card.  It uses the standard procedure
                      turning off the channel, resetting the byte register, setting the address of the data
                      setting the length of the data, setting the page number, and finially reactivation the channel.
        Inputs:  None. Checks DMA, MASKREG, BYTEREG, MODEREG, ADDRREG, COUNTREG, PAGEREG,
                    WavLength
        Outputs:  Sets up DSP.
        Macro:  DSPWRITE

LoadMIDI (Tim Zadigian)
        Purpose: Loads an XMI file to the MIDIBuffer so It can be played.  Like LoadWav it used the dos handlers to take
                      care of the file.
        Inputs:  MIDIFile: the offset of the name of the midi file to be played
        Outputs: Loads the MIDI file to the MIDIBuffer segment

PlayMIDI (Tim Zadigian)
        Purpose:  To call the midpak INT 66h with the play function.  It will play the current registered XMI file.
        Inputs:  None. Checks midiLength
        Outputs:  Plays a XMI file
 

StopMidi  (Tim Zadigian)
        Purpose:  To call the midpak INT 66h wiht the stop funcion.  It will stop the current XMI file.
        Inputs: None
        Outputs: stops midi file

RegisterXMI (Tim Zadigian)
        Purpose: This takes an XMI, located in the MIDISeg file and registers it to midpak using int 66h.  With the file
                        registered midpak is able to play the XMI file.
        Inputs: midiLength, the length of the midi file to be registered.
                   uses MIDISeg
        Outputs: Nothing

SequenceStat   (Tim Zadigian)
        Purpose: Tells whether midpak is still playing an XMI file using 66h.
        Inputs: None.
        Outputs:  ax= 2 if sequence is stopped, no XMI is playing
                      1 if sequence is still playing


Back to Main