home *** CD-ROM | disk | FTP | other *** search
-
- Version 3.3 DigPak
-
- written by
-
- John W. Ratcliff
-
- THIS DOCUMENTATION IS FOR THE SBDIRECT, PUBLIC DOMAIN VERSION OF
- DIGPAK ONLY. THIS DOES NOT GIVE YOU THE RIGHTS TO USE OR DISTRIBUTE
- ANY DIGPAK DRIVERS. ONLY THIS VERSION IS BEING RELEASED IN THE PUBLIC
- DOMAIN.
-
- RELEASED INTO THE PUBLIC DOMAIN, August 1, 1993
- I WILL PROVIDE NO TECHNICAL SUPPORT FOR THIS CODE, THIS DOES NOT GIVE YOU
- THE RIGHT TO USE OR DISTRIBUTE DIGPAK DRIVERS. YOU MAY USE THIS ONLY IN
- CONJUNCTIONS WITH THE SBDIRECT.ASM HARD CODED SOUNDBLASTER DRIVE PROVIDED
- WITHIN. USE AT YOUR OWN RISK. RELEASED SO THAT YOU MAY PROVIDE TURNKEY
- DIGITAL SOUND APPLICATIONS THAT ARE SOUNDBLASTER COMPATIBLE. I REQUEST
- THAT ANY SOFTWARE DEVELOPED THAT MAKES USE OF THIS DRIVER, HAVE A COPY
- SENT TO ME ON MY BBS AT 1-314-939-0200. YOU CAN LEAVE ME E-MAIL ON
- COMPUSERVE AT 70253,3237, OR ON GENIE AS J.RATCLIFF3. I CANNOT STRESS
- ENOUGH, THAT I CANNOT PROVIDE TECHNICAL SUPPORT FOR THIS CODE. YOU DO
- NOT HAVE RIGHTS TO USE OTHER DIGPAK DRIVERS ANY ANY WAY. THIS TURNKEY
- SOUNDBLASTER IS THE ONLY THING BEING RELEASED IN THE PUBLIC DOMAIN.
- BUG FIXES OR IMPROVMENTS TO THIS CODE MUST BE FOWARDED TO ME ON MY BBS
-
- Includes one set of sources that works in all memory models. Full
- MIDPAK compatible support.
-
- The set of digitized sound drivers hook into user interrupt vector 66h
- to provide a clean clear programmers interface. This document describes
- the two ways you can access the digitized sound package. The first is
- the interrupt level interface. The second is a link library interface
- that provides a set of C or assembly language callable functions to
- access not only the digitized sound drivers but also provides usefull
- support routines. These glue code functions are located in the source
- file DIGPLAY.ASM.
-
- ************** VERSION 3.1 CHANGES ***************
-
- int far *ReportPendingAddress(void); // Reports the far address of the pending
- // flag. If this memory location pointed to by this address is 1 that means
- // a pending sound effect is still pending. When this becomes zero, then your
- // application software can post the next piece of audio to play. It is
- // preferable to use this semaphore to know when to post the next buffer
- // rather than to use the AudioPendingStatus call.
-
- int far *ReportSemaphoreAddress(void); // Reports the far address of the DigPak
- // semaphore. If this semaphore is true, then DigPak is currently active
- // and you shouldn't post any DigPak calls. This is EXTREMELY important if
- // you are trying to invoke DigPak functions via a hardware interrupt, where
- // you could potentially have interrupted DigPak itself.
-
- int far ReportVersionNumber(void); // Report the DigPak version number.
- // Return code is times 100, meaning that version 3.1 would be returned
- // as the decimal number 310. This function wasn't supported prior to
- // version 3.1 release, so it will be returned as 0, for versions prior
- // to 3.1.
-
- ***********************************************************************
- *************** INT 66h Interface Specification ***********************
- ***********************************************************************
-
- When invoking digplay functions to play sound you pass the address of
- a sound structure (SNDSTRUC) that contains the basic information
- describing the sound effect you wish to play.
-
-
- typedef struct
- {
- unsigned char far *sound; // Far address of audio data.
- unsigned int sndlen; // Length of audio sample.
- int far *IsPlaying; // Address of play status flag.
- int frequency; // Playback frequency.
- } SNDSTRUC;
-
- ********* DIGPAK functions ************************************
-
- Function #1: DigPlay, Play an 8 bit digitized sound.
-
- INPUT: AX = 688h Command number.
- DS:SI Point to a sound structure that
- describes the sound effect to be played.
-
- Function #2: SoundStatus, Check current status of sound driver.
- and report VERSION number of the driver, 3.1 and later.
-
- INPUT: AX = 689h
- OUTPUT: AX = 0 No sound is playing.
- = 1 Sound effect currently playing.
- DX = 0 No sound is looping.
- = 1 A sound effect is looping.
- BX = version Starting with version 3.1, the BX register
- of the SoundStatus call will return the
- version number. The version number is in
- decimal, and multiplied times 100. Meaning
- a return of 310, is equal to version 3.10.
- Versions before 3.1, did not set the BX
- register to anything, so you should zero
- out the BX register before you check the
- version number. If the BX register is still
- zero, then the DigPak driver loaded is less
- than 3.1.
-
-
- Function #3: MassageAudio, Preformat audio data into ouptut hardware format.
-
- INPUT: AX = 68Ah
- DS:SI Point to address of sound structure.
-
- Function #4: DigPlay2, Play preformatted audio data.
-
- INPUT: AX = 68Bh
- DS:SI Point to address of sound structure.
-
- Function #8: StopSound, stop currently playing sound.
-
- INPUT: AX = 68Fh
- OUTPUT: None.
-
- Will cause any currently playing sound effect to be
- terminated.
-
-
- FUNCTION #14: PostAudioPending
-
- INPUT: AX = 695h
- DS:SI -> sound structure, preformated data.
-
- OUTPUT: AX = 0 Sound was started playing.
- AX = 1 Sound was posted as pending to play.
- AX = 2 Already a sound effect pending, this one not posted.
-
- FUNCTION #15: AudioPendingStatus
-
- INPUT: AX = 696h
-
- OUTPUT: AX = 0 No sound is playing.
- AX = 1 Sound playing, sound pending.
- AX = 2 Sound playing, no sound pending.
-
- FUNCTION #18: Report Pending Status Flag adddress and Semaphore address.
-
- int far *ReportPendingAddress(void);
- Reports the far address of the pending flag. If this memory location
- pointed to by this address is 1 that means a pending sound effect is
- still pending. When this becomes zero, then your application software
- can post the next piece of audio to play. It is preferable to use this
- semaphore to know when to post the next buffer rather than to use the
- AudioPendingStatus call.
-
- int far *ReportSemaphoreAddress(void);
-
- Report the address of the DigPak semaphore. This returns a far
- address to a word location inside DigPak. When this is true,
- then DigPak is currently active, and you shouldn't invoke any
- DigPak function from a hardware interrupt at this time.
-
- INPUT: AX=699h
- OUTPUT: AX:DX -> form far Address of Pending status flag.
- BX:DX -> form far address of digpak semaphore
-
- ***********************************************************************
- ** DigPlay, linkable interface to the Digitized Sound Package. *****
- ***********************************************************************
- The file DIGPLAY.ASM is a small assembly language source file that
- provides C compatible procedure calls to hook into the Digitized
- Sound Package. DIGPLAY.ASM uses one include file called PROLOGUE.MAC.
- This is a macro header file that defines some basic useful assembly
- language macros.
-
- DIGPLAY.ASM is written in Turbo Assebmler's IDEAL mode. The MASM syntax
- for 8086 assembler is abhorent. The Turbo Assembler IDEAL mode offers
- true local labels, real data structures, typecasting, automatic argument
- passing, and local memory allocation. Turbo Assembler in IDEAL mode
- provides many of the features of a high-level langauge. Turbo Assembler
- and Turbo Debugger combined are without question the most powerful
- assembly language tools available for any 8086 programmer. The last I
- checked, Turbo Assembler and Turbo Debugger sold for less than $99.
- Recently Microsoft released a new version of MASM that finally provides
- some of the features that Turbo Assembler has had for over three years;
- and requires a new assembly language syntax. For these reasons I can
- no longer consider MASM the standard for 8086 DOS based assemblers and
- that it why you will find all assembly language source code here
- provided in Turbo Assembler IDEAL mode format. If you do not have
- Turbo Assembler simply link to one of the two following object modules.
-
- All these link layer procedures are defined as far calls and accept far
- addresses for all pointers passed. The reason for this is so that you
- can link to one object module regardless of the memory model you are
- working in.
-
- The C prototype header file for DigPlay support functions are as follows:
-
-
- typedef struct
- {
- char far *sound; // address of audio data.
- unsigned int sndlen; // Length of audio sample.
- int far *IsPlaying; // Address of play status flag.
- int frequency; // Playback frequency.
- } SNDSTRUC;
-
- int far DigPlay(SNDSTRUC far *sndplay); // 688h -> Play 8 bit digitized sound.
- int far SoundStatus(void); // 689h -> Report sound driver status.
- void far MassageAudio(SNDSTRUC far *sndplay); // 68Ah -> Preformat 8 bit digitized sound.
- void far DigPlay2(SNDSTRUC far *sndplay); // 68Bh -> Play preformatted data.
- void far StopSound(void); // 68Fh -> Stop current sound from playing.
- int far PostAudioPending(SNDSTRUC far *sndplay);
-
- #define NOTPLAYING 0 // No sound is playing.
- #define PLAYINGNOTPENDING 1 // Playing a sound, but no sound is pending.
- #define PENDINGSOUND 2 // Playing, and a sound is pending.
- int far AudioPendingStatus(void);
-
- int far *ReportPendingAddress(void); // Reports the far address of the pending
- // flag. If this memory location pointed to by this address is 1 that means
- // a pending sound effect is still pending. When this becomes zero, then your
- // application software can post the next piece of audio to play. It is
- // preferable to use this semaphore to know when to post the next buffer
- // rather than to use the AudioPendingStatus call.
-
- int far *ReportSemaphoreAddress(void); // Reports the far address of the DigPak
- // semaphore. If this semaphore is true, then DigPak is currently active
- // and you shouldn't post any DigPak calls. This is EXTREMELY important if
- // you are trying to invoke DigPak functions via a hardware interrupt, where
- // you could potentially have interrupted DigPak itself.
-
- int far ReportVersionNumber(void); // Report the DigPak version number.
- // Return code is times 100, meaning that version 3.1 would be returned
- // as the decimal number 310. This function wasn't supported prior to
- // version 3.1 release, so it will be returned as 0, for versions prior
- // to 3.1.
-
- /* Support routines */
- void far WaitSound(void); // Wait until sound playback completed.
- int far CheckIn(void); // Is sound driver available? 0 no, 1 yes.
-
- int far LoadSoundDriver(char far *address); // Load a sound driver by filename, 1 success 0 fail.
- void far UnloadSoundDriver(void); // Unload a previously loaded sound driver.
-
-
-