home *** CD-ROM | disk | FTP | other *** search
/ Audio 4.94 - Over 11,000 Files / audio-11000.iso / msdos / sndbords / proaudio / tpcm35 / pcm.doc < prev    next >
Text File  |  1993-03-22  |  24KB  |  738 lines

  1. PCM - TSR Providing PCM Access - version 5.1
  2.  
  3.  
  4. Syntax
  5.  
  6.     pcm            # display command syntax and TSR status
  7.     pcm -h            # to display more information
  8.     pcm -s            # to display status on the ISR/TSR
  9.     pcm -i            # to install PCM routines as a TSR 
  10.     pcm -u            # to unload the TSR
  11.     pcm -l [command]    # to load the ISR, run command, then unload
  12.  
  13.  
  14. Options
  15.  
  16.     q -    toggle quiet mode (-l sets quiet)
  17.     h -    display additional information 
  18.     s -    display install status
  19.  
  20.     i -     install as TSR
  21.     u -     uninstall TSR
  22.  
  23.     l program.exe
  24.         -     load ISR, run "program.exe", unload and exit
  25.         -    returns as "errorlevel" the result of "program.exe"
  26.  
  27.     bXXX    -    XXX= port address of PAS board (default: find it)
  28.     pcm -tAAA,D,I    AAA= port, D= DMA, I= IRQ of TB (Sound Blaster)
  29.     pcm -pAAA,D,I    AAA= port, D= DMA, I= IRQ of Pro Audio Spectrum
  30.  
  31.  
  32. What is PCM.COM?
  33.  
  34. pcm.com is a program that can operate as either a TSR (Terminate, Stay
  35. Resident), or as a set of installable ISR's (Interrupt Service Routines).
  36.  
  37. As a TSR, it provides interrupt service routines for other programs in
  38. order to access PCM (sound) routines for the Media Vision Spectrum/CDPC
  39. interface boards, for either the native (PAS) or the compatible (SB) DAC.  
  40.  
  41. The program includes code to access both the PAS and the on-board SB.
  42. The program checks the environment at load-time for a "BLASTER=..."
  43. statement, and configures the SB side accordingly, unless the "-t..."
  44. option is specified.
  45.  
  46. As an ISR, it provides these same services, but instead of terminating
  47. and staying resident, it loads and runs another program that expects 
  48. these services to be available, and then uninstalls these routines
  49. before terminating.
  50.  
  51.     Programs that expect pcm.com services include "tpcm.exe",
  52.     "srs16.exe", "play.exe", and other sound programs from 
  53.     Media Vision.
  54.  
  55.     These programs, and others, do not include the PCM access
  56.     routines in their own body of code.  This makes each of the 
  57.     programs smaller, and allows changes/improvements to the
  58.     PCM code more easily implemented among the various programs.
  59.  
  60.     An example is "tpcm.exe", which was written to play on the
  61.     PAS;  when the SB-compatible code was added to "pcm.com",
  62.     the tpcm.exe program needed merely to accept another option
  63.     (-T) and set a bit in the [si] register during calls to
  64.     interrupt 94h, and immediately the program could play on
  65.     both sides of the PAS.
  66.  
  67. In short, pcm.com is a flexible program that provides PCM services 
  68. via interrupt 94h to other programs requiring such, either as a TSR
  69. or as a front-end loader, and can also add extra sound-playing 
  70. capabilities to your computer by using extended memory, the timer, 
  71. and your keyboard (see "pcmfun.com").
  72.  
  73.  
  74. Operation
  75.  
  76. Use the "pcm.com" program in order to provide access to PCM functions 
  77. via interrupt 94h.  
  78.  
  79. There are two ways to utilize these functions: resident at all times,
  80. or loaded before program execution.
  81.  
  82.     When run as:
  83.  
  84.     C:> pcm -i
  85.  
  86.         The program will install into interrupts not already
  87.         hooked, and go resident if installation took place.
  88.  
  89.         Some programs, such as "tpcm.exe", will load pcm.com
  90.         if it is not already loaded, and so do not required 
  91.         that be installed as a TSR.
  92.  
  93.         To unload the program, use:
  94.  
  95.         C:> pcm -u
  96.  
  97.     When run as:
  98.  
  99.     C:> pcm -l "program -options arguments"
  100.  
  101.         The program will install into all its interrupts, 
  102.         regardless of previous installation, run "program"
  103.         with its options and arguments, then remove itself
  104.         from the interrupts and exit.
  105.  
  106.         Note: the quotation marks are not required.  
  107.  
  108.         C:> pcm -l "command.com"
  109.  
  110.         This will install the routines and run the command 
  111.         shell, thus making the routines available, but 
  112.         after typing "exit" to the command shell, pcm.com
  113.         unloads the ISR's and exits.
  114.  
  115.         Programs must be in the current directory in order
  116.         to be found and loaded, or their location must be
  117.         explicitly specified:
  118.  
  119.             pcm -l c:\usr\bin\tpcm.exe -v *.wav
  120.  
  121.             pcm -l ..\test\test.exe *.wav
  122.  
  123.     If you find that you are using frequently programs that 
  124.     require pcm.com, you can load it as a TSR.  If you find
  125.     that you only need it for one program, you can use it as
  126.     a front-end loader, manually or in a .bat file.
  127.  
  128. This program can handle different board addresses, and can handle
  129. multiple boards, by use of the "-bXXX" option.
  130.  
  131.     The default "Base Port Address" for the Pro Audio Spectrum
  132.     is "388h".  Use "proas.exe" to wake up and initialize any
  133.     additional boards (see "proas.doc").
  134.  
  135.     The "tpcm.exe" program (and others) also handle multiple
  136.     boards, by means of the "Base Port Address", and can
  137.     access specific instances of "pcm.com" using these values.
  138.  
  139.     C:> pcm -ib388            # install for board at 388h
  140.     C:> tpcm -b384 sound.wav    # search for and fail to find
  141.                     # pcm.com at 384h, so install
  142.                     # at 384h and play "sound.wav"
  143.  
  144. Use the "-tAAA,D,I" option to specify the Thunder Board (Sound Blaster)
  145. port/dma/irq parameters;  if this option is specified, then the 
  146. environment variable "BLASTER=" is not searched for.  
  147.  
  148.     This is useful with multiple boards, instead of changing
  149.     the BLASTER variable before each installation of the pcm.com.
  150.  
  151. Use the "-pAAA,D,I" option to specify the PAS port/dma/irq parameters.
  152. This is useful when running without "mvsound.sys" (as with any extra
  153. boards, or with the PAS Original).
  154.  
  155. Errorlevel Return Values
  156.  
  157. The program returns to DOS an errorlevel using the following logic:
  158.  
  159.     if the "-l" option was used to run another program, the
  160.         errorlevel is that returned by the other program
  161.  
  162.     if the "-i" option is specified, the returned values are:
  163.  
  164.         0    successfully installed
  165.         1    not installed, detected pcm.com resident code
  166.  
  167.     if the "-u" option is specified, the returned values are:
  168.  
  169.         0    successfully uninstalled
  170.         #-1    not uninstalled, number of routines found
  171.         #    not uninstalled, no routines found resident
  172.  
  173.         Here, "#" is the number of routines normally installed.
  174.  
  175.             For the "fun" version, this # is 5.
  176.             For the standard "pcm.com", this # is 1.  
  177.  
  178.             Note: the standard "pcm.com" returns either
  179.  
  180.                 0 (successfully uninstalled) or 
  181.                 1 (already resident)
  182.         
  183.     if the "-s" option is specified, the returned values are:
  184.  
  185.         0    not installed
  186.         1    number of installed vectors
  187.  
  188. These returned errorlevels can be used in .bat files:
  189.  
  190.     pcm -s
  191.     if errorlevel 1    echo PCM.COM is installed
  192.  
  193.     pcm -i
  194.     if errorlevel 1 echo PCM.COM failed installation
  195.  
  196.     pcm -u
  197.     if errorlevel 1 echo PCM.COM could not unload
  198.  
  199.  
  200. Auxiliary Programs
  201.  
  202. Use "loadpcm.exe" to load sounds into extended memory for background play.
  203.  
  204.     Some versions of pcm.com may intercept other interrupts in 
  205.     order to provide additional services, such as background play.  
  206.  
  207.     Most likely to be hooked are the keyboard, timer, console i/o;  
  208.     with these versions, the TSR can be programmed to provide timed, 
  209.     random, or initiated asynchronous sound output when loaded 
  210.     with an extended-memory service provider, such as "himem.sys",
  211.     using the int 2F interface.
  212.  
  213.     With this version of the program, you can use "loadpcm.exe"
  214.     to load sound files into extended memory, and the TSR will
  215.     then play these files using the keyboard, the timer, or
  216.     intercept CONTROL-G, at any time.
  217.  
  218.     You will know if your version does by the following:
  219.  
  220.     If after installing pcm.com using "pcm -i" you see only:
  221.     
  222.         94h- Digital Audio   Installed.
  223.  
  224.     then the version provides only PCM access routines.
  225.  
  226.     If after installing pcm.com using "pcm -i" you see:
  227.  
  228.         94h- Digital Audio   Installed.
  229.         09h- Keyboard        Installed.
  230.         10h- Video Services  Installed.
  231.         29h- Fast Putchar()  Installed.
  232.         08h- Hardware Timer  Installed.
  233.  
  234.     then the version provides these extra "fun" features.
  235.  
  236.     See "pcmfun.doc".
  237.  
  238. Use "setdma.exe" to fix an area of memory for DMA transfers.  
  239.  
  240.     This program searches the Memory Arena for the end, then
  241.     subtracts 16K from the top and allocates it as system 
  242.     memory, thereby ensuring that the DMA buffer does not
  243.     cross a 64K segment boundary.  
  244.  
  245.     This program could search the UMB's, effectively providing a
  246.     DMA buffer that is completely out of conventional memory.
  247.  
  248.     The program adds the string "DMABUF=SEGADDR PARASIZE" to the
  249.     master environment, which can be used in a .bat file by the
  250.     "loadpcm.exe" program:
  251.  
  252.         loadpcm %dmabuf% 64
  253.  
  254.     This causes loadpcm to inform the pcm.com TSR to use memory 
  255.     at SEGADDR:0000 with a size in bytes of PARASIZE * 16 split
  256.     into 64 divisions.
  257.  
  258.     Use the "freedma.exe" program to release this memory.  
  259.  
  260.     Note: the program uses "undocumented" DOS information to
  261.     perform this memory allocation.
  262.  
  263.     See "sfdma.doc" for more information on these programs.
  264.  
  265. "proas.exe" will locate and initialize Media Vision hardware.
  266.  
  267.     This program will allow you to use your sound board without
  268.     the need for "mvsound.sys" being resident.
  269.  
  270.     pcm.com can read the DMA/IRQ channels from the hardware,
  271.     allowing programs using the int94 interface to function 
  272.     without mvsound.sys (requires MV101 Rev D).
  273.  
  274.         
  275. Programming using PCM.COM
  276.  
  277. Although programming by linking to the static libraries provided in
  278. the Media Vision SDK is easy enough, using this TSR provides 
  279. additional functionality:
  280.  
  281.     during load, the Hardware State Table is initialized.
  282.  
  283.     provide access to global DMA buffer for any program
  284.  
  285.     perform all initialization automatically (Function 8004)
  286.  
  287.     perform custom initialization automatically (Function 8011)
  288.  
  289.     internal User Functions to track your DMA buffer counters
  290.  
  291.     background sound play/record using extended memory 
  292.  
  293.     improvements to PCM routines incorporated through PCM.COM
  294.  
  295.     automatic 16- to 8-bit conversion on low-end hardware
  296.  
  297.  
  298. Some changes in these PCM routines over their ancestors in the SDK:
  299.  
  300.     Access to SB
  301.  
  302.         Use a "set blaster=..." statement before loading
  303.         "pcm.com" to have it configure itself to access
  304.         the on-board SB.
  305.  
  306.             C:> set blaster=a220 d1 i5 t3
  307.  
  308.                 aXXX    XXX= base port for SB (220h)
  309.                 dX    X= dma channel
  310.                 iX    X= irq channel
  311.                 tX    X= CT product number (not used)
  312.  
  313.         The program "tpcm.exe", written for the PAS, was
  314.         able to access the SB with only one program change:
  315.         "or" in the "sb request" bit into the function call.
  316.  
  317.         Access to the PAS and SB can be simultaneous and
  318.         is independent.
  319.  
  320.     DMA Buffer Divisions
  321.  
  322.         No longer must the number of divisions be a 
  323.         a multiple of two, and instead can be any number.
  324.  
  325.     DMA Buffer Size
  326.  
  327.         No longer must it be a multiple of 1024 bytes.
  328.         If the dma buffer size as passed in DMABuffer()
  329.         (function #3) is >= 100h, then it is assumed to
  330.         be the actual size and not the size in Kbytes.
  331.  
  332.         It is the responsibility of the calling program
  333.         to ensure that the Buffer Size is an integral
  334.         multiple of the Number of Divisions;  failure
  335.         can be as minor as "bumps" in the sound output
  336.         to destroying the memory control block arena.
  337.  
  338.     IRQ/DMA Channel Changes
  339.  
  340.         With the latest Media Vision hardware, it is
  341.         possible to program the board to use specific
  342.         DMA/IRQ channels.
  343.  
  344.         The pcm.com program retrieves this information
  345.         from mvsound.sys, but also uses the information
  346.         from the board, and, in case of conflict, uses
  347.         those values programmed into the hardware.
  348.  
  349.  
  350.     Running without, or in conflict with, MVSOUND.SYS
  351.  
  352.         pcm.com can read the hardware at load time, which
  353.         allows programs to function without mvsound.sys 
  354.         being loaded ("proas.exe" will wake up and 
  355.         initialize the board).
  356.  
  357.         Also, "proas.exe" can change the DMA/IRQ 
  358.         channels on the board, and pcm.com will detect
  359.         a conflict with mvsound.sys and use the values
  360.         programmed into the hardware.
  361.  
  362.         Note: changing channels should not be done with
  363.         pcm.com loaded;  the detection is made at "pcm -i"
  364.         time.  
  365.  
  366.         Note: with the PAS Original, the DMA/IRQ info
  367.         is not available from the hardware, so if you
  368.         do not have "mvsound.sys" loaded, use the "-p"
  369.         option ("-pPPP,D,I": PPP= port, D= dma, I= irq)
  370.  
  371.     Hardware Configuration Information
  372.  
  373.         pcm.com provides a function to retrieve a bitfield
  374.         describing the known hardware configuration.
  375.  
  376.     Playing 16-bit data on 8-bit Hardware
  377.  
  378.         pcm.com will convert the 16-bit data to 8-bit
  379.         if it detects that the hardware does not have
  380.         a 16-bit DAC onboard.
  381.  
  382.         It accomplishes this when the following logic
  383.         is used in the int 94h interface:
  384.  
  385.         call PCMInfo()    - notify 16-bit coming up
  386.         call DMABuffer()- calculate stuff
  387.         call PausePCM()    - set state to Paused
  388.         call PlayPCM()    - prepare to Play, but still paused
  389.  
  390.         load the DMA Buffer from the app
  391.  
  392.         call ResumePCM()- converts 1st division data
  393.  
  394.         thereafter, every IRQ the next division is converted
  395.             
  396.     Pause/Play/Record/Resume Operation
  397.  
  398.         Previously, calling PausePCM() then PCMPlay()
  399.         resulted in sound output.  So, in order to
  400.         "setup" and then use "pause" and "resume", 
  401.         you had to "Play" then "Pause", but then a
  402.         little bit of data played.  
  403.  
  404.         Now, the operation of the "PausePCM()" function
  405.         is like that of the "pause" button on a tape deck.
  406.  
  407.             Press Pause.
  408.             Press Play (or Record)
  409.  
  410.                 nothing happens
  411.  
  412.             Press Resume 
  413.  
  414.                 begin play/record
  415.  
  416.         This was desired, but required when run-time 
  417.         16- to 8-bit conversion was required.
  418.  
  419. ========================================================================
  420.  
  421. NOTE: There are two programs, pcmfun.com and pcmmin.com, that share
  422.     the same code.  Occasionally, one or the other is distributed
  423.     as "pcm.com".
  424.  
  425.     The intention is to maintain both "serious" and "fun"
  426.     sides to this set of routines, but leaving you the user
  427.     the option of deciding whether or not you want, or can,
  428.     use the "fun" stuff.
  429.  
  430.     If you prefer to not use the fun stuff, and thus not
  431.     allocate the memory, but you do like the programs that
  432.     depend on the int 94h services, then rename "pcmmin.com"
  433.     to "pcm.com", and leave it in the same directory as the
  434.     other programs (tpcm.exe, srs.exe).  These programs will
  435.     load "pcm.com" if it is not already installed. 
  436.  
  437.     Of course, I would prefer if the TSR were to dynamically
  438.     install those functions desired by the user via a command-
  439.     line option, but, alas, there has been too little time!
  440.     Know, though, that I know that this is a worthy goal.
  441.  
  442.     I apologize in advance for any confusion that may arise.
  443.  
  444. ========================================================================
  445.  
  446. Programming for Interrupt 94h
  447.  
  448. Use of the interrupt 94h interface is similar to that for "fm.com",
  449. which was based on the "sound.com" program.
  450.  
  451.     This could be considered unfortunate, as the "si"
  452.     register is used to pass the function number, and
  453.     this register must be preserved across function calls,
  454.     when programming in C.
  455.     
  456.  
  457.     The functions 0 - B are duplicate the similarly named
  458.     functions from the SDK.  Function C is new.  Functions
  459.     8000 - 8011 are functions that might simplify some 
  460.     programming for sound output.  Functions 8012 - 8016 are
  461.     included only in versions of pcm.com that provide the
  462.     background play ability (the "fun" stuff).
  463.  
  464. Additionally, the SI register also holds the requested "board address",
  465. as well as a "card" bit:
  466.  
  467.     SI Register Definition
  468.     ;; STPP PPPP PPff ffff
  469.     ;; S=             Special Function if set
  470.     ;;  T=             0= PAS, 1= ThunderBoard (Sound Blaster)
  471.     ;;   PP PPPP PPcc=     port address (388, 38C, 384: low 2 bits clear)
  472.     ;;             ff ffff= function number
  473.  
  474. Interrupt 94h Functions
  475.  
  476.     Entry
  477.     si    = special/card/port/function 
  478.     es:bx    = points to data buffer specific to function
  479.  
  480.     Exit
  481.     ax    = return integer or boolean value
  482.     dx:ax    = return long value or far address 
  483.     si    = 0 if recognized function
  484.  
  485.  
  486.     Description of Function
  487.    SI    ES:BX points to Buffer Containing...
  488.     Returned in AX (int) or DX:AX (void far *)
  489.     
  490.  
  491.     0    InitMVSound() - initialize the Hardware State Table
  492.         N/A
  493.     char far *    NULL if failed, else Hardware State Table address
  494.         
  495.        
  496.     1    InitPCM() - initialize PCM State Tables
  497.         N/A
  498.     int         0 if failed, else Library Version Number
  499.        
  500.     2    PCMInfo() - set samplerate and mono/stereo
  501.         struct pcminfo {long samplerate;  int stereoflag}; 
  502.     int        0 if okay, -1 if Samplerate Out of Range
  503.        
  504.     3    DMABuffer() - set DMA buffer address, size and partitions
  505.         struct dmabuf {char far * dmabuf, int bufkbsize, partitions;};
  506.     char far *    NULL if failed, else succeeded
  507.        
  508.     4    UserFunc() - set up callback routine for DMA interrupts
  509.         void far (*userfunction)();
  510.     void far *    NULL if failed, else succeeded
  511.        
  512.     5    PCMPlay() - play 
  513.         N/A
  514.     int        0 if successful, else failed
  515.        
  516.     6    PCMRecord() - record
  517.         N/A
  518.     int        0 if successful, else failed
  519.  
  520.     7    PausePCM() - pause playback or record
  521.         N/A
  522.     N/A
  523.  
  524.     8    ResumePCM() - resume paused playback or record
  525.         N/A
  526.     N/A
  527.  
  528.     9    StopPCM() - stop playback or record
  529.         N/A
  530.     N/A
  531.  
  532.     A    RemovePCM() - remove PCM hook to IRQ, clear internal DMA vars
  533.         N/A
  534.     N/A
  535.  
  536.     B    FindDMABuffer() - find area from memory within 64K block
  537.         struct fdmabuf {char huge *dmabuf; int bufkbsize};
  538.     char far *dmabuf    NULL if failed, else Valid DMA address
  539.  
  540.     C   GetHWVersionBits() - return a bitfield describing configuration
  541.     N/A
  542.     int        bitfield (see HWVersionBits below)
  543.  
  544.  8000     Retrieve Current DMA Address
  545.     N/A
  546.     char far *dmabuf    NULL if none, else Current DMA address
  547.  
  548.  8001     Retrieve Current DMA Size and Divisions
  549.     N/A
  550.     AX= Current DMA Size, DX= Current DMA Divisions
  551.  
  552.  8002 - 8003    NOT IMPLEMENTED
  553.  
  554.  8004     Make Ready For Play Mono at 11025Hz using B000:0 as 32K/2 DMA Buffer
  555.     N/A
  556.     N/A
  557.  
  558.  8005 - 8010     NOT IMPLEMENTED
  559.  
  560.  8011    Make Ready For Play using User Specified Parameters
  561.     struct pcmstate *{};    All Parms for PCMInfo, DMABuffer, UserFunc
  562.     struct pcmstate *{};    See Below for structure definition
  563.  
  564.  ----    The following functions are included only with the extra "fun"
  565.  ----    background play stuff.
  566.  
  567.  8012    Load Sound for Background Play
  568.     struct extstate *{};     All Parms for sound and access to XMS 
  569.     N/A
  570.  
  571.  8013    Return Bitfield Describing Background Sound Slot Usage
  572.     N/A
  573.     ax= bitfield of sounds used, dx= max sound slots (8)
  574.  
  575.  8014    Fill Structure for Specified Sound Slot
  576.     struct extstate *{};     desired sound number in field member
  577.     struct extstate *{};    structure filled with internal info
  578.  
  579.  8015    Set/Get/Unset Internal DMA Buffer
  580.     struct dmabuf *{};    if dmaoff != -1, set internal to contents
  581.     struct dmabuf *{};    if dmaoff == -1, set contents to internal
  582.  
  583.  8016    Simulate LeftShift-RightShift-# Keystroke
  584.     ax= 1 through 8        desired slot #
  585.     N/A
  586.  
  587.  8017    Control Background Processing Logic
  588.     al= 1    Control-G Intercept
  589.     ah= 0 Off, 1 On
  590.  
  591.     al= 2    Double-Shift Key Intercept
  592.     ah= 0 Off, 1 On
  593.  
  594.     al= 4    Random Sound 
  595.     ah= 0 Off, 1 On
  596.     cx= minimum delay in ticks (if turning on)
  597.     dx= maximum delay in ticks
  598.  
  599.     al= 8    No Activity
  600.     ah= 0 Off, 1 On
  601.     cx= delay in ticks (if turning on)
  602.  
  603.     al= F    Timer Control
  604.     ah= timer # (0-3)
  605.     dx:cx= delay in ticks, b15=0 reload, b15= 1 oneshot
  606.     
  607.  
  608.  
  609. Parameter Definitions
  610.  
  611. The "pcminfo" structure holds the Sample Rate and Mono/Stereo Flag.  
  612. The Sample Rate can vary from 100 to 88200 Hz Mono output, or 200 to 
  613. 44100 Hz for Stereo.
  614.  
  615. struct pcminfo            /* Passed to PCMInfo() */
  616. {
  617.     long samplerate;    /* 100 - 88200 (100 - 44100 for stereo) */
  618.     int stereoflag;        /* 0 = mono, 1 = stereo */
  619. };
  620.  
  621. The "dmabuf" structure contains the address of memory to be used as
  622. the DMA Load/Unload Buffer, the Size of this Buffer in KB, and the 
  623. Number of Partitions it is to be split into.  This buffer must not wrap
  624. around a 64KB block (the address should never get to ????:FFFF+ 1).
  625.  
  626. struct dmabuf            /* Passed to DMABuffer() */
  627. {
  628.     char far *dmabuf;    /* address of DMA buffer */
  629.     int bufkbsize;        /* size of DMA buffer in KB */
  630.     int partitions;        /* number of partitions */
  631. };
  632.  
  633. The "fdmabuf" structure contains a "huge" pointer to an area of memory
  634. that is at least twice as large as the associated "kbsize" parameter, 
  635. which specifies the desired size of memory in KB.
  636.  
  637. struct fdmabuf            /* Passed to FindDMABuffer() */
  638. {
  639.     char huge *dmabuf;    /* address of memory allocated */
  640.     int bufkbsize;        /* size of memory in KB */
  641. };
  642.  
  643. The "userfunc" parameter is the address of a routine that is to be
  644. called every time the PCM hardware has completed the output/input 
  645. of a partition of the DMA buffer.  Typically this routine decrements 
  646. a "flag" (see pcmstate.stat, below) which is monitored in the main
  647. program, allowing it to read/write data during PCM playback/record.
  648.  
  649. void (far *userfunc)();        /* address of callback routine 
  650.  
  651. The "pcmstate" structure is used to completely initialize the DMA and PCM
  652. state with user-supplied parameters, and includes space for the return
  653. values as well as a default DMA interrupt function that decrements the
  654. int pointed to by pcmstate.stat, and one that reads/writes files in the 
  655. background using the pcmstate.fh file handle.  Set pcmdir to 0 for play,
  656. set to 1 for record;  the internal user function decrements the stat flag
  657. during play, and increments during record.
  658.  
  659. struct pcmstate
  660. {
  661.    char far *f00r;     /* hardware state table returned from InitMVSound */
  662.    int f01r;         /* library code version returned from InitPCM */
  663.    long f02c1;         /* samplerate passed to PCMInfo */
  664.    int f02c2;         /* mono/stero flag passed to PCMInfo */
  665.    int f02r;         /* -1 returned by PCMInfo if error, else (?) */
  666.    void (far *f04c)();    /* address of interrupt function or index to internals */
  667.    void far *f04r;         /* 0 returned by UserFunc if error, else (?) */
  668.    char huge *f11c1;    /* not used at present FindDMABuffer */
  669.    int f11c2;         /* not used at present FindDMABuffer */
  670.    void far *f11r;         /* not used at present FindDMABuffer */
  671.    char far *f03c1;    /* DMA buffer passed to DMABuffer */
  672.    int f03c2;         /* size of DMA buffer in kilobytes passed to DMABuffer */
  673.    int f03c3;         /* number of partitions of DMA buffer passed to DMABuffer */
  674.    char far *f03r;     /* 0 returned by DMABuffer if error, else (?) */
  675.    int f10r;         /* returned by RemovePCM */
  676.    int f05r;         /* returned by PCMPlay */
  677.    int f07r;         /* returned by PausePCM */
  678.    int far *stat;     /* "volatile int" address decremented each DMA pass */
  679.    int fh    ;     /* file handle for input/output file (not implemented) */
  680.    int sbsize;         /* calculated size of each partition in bytes */
  681.    int f02c3;        /* compression flag */
  682.    int f02c4;         /* data size (8 or 16, specifying bit-size of sample)
  683.    int pcmdir;        /* 0= play, 1= record */
  684.    int unknown[16];    /* for expansion */
  685. };
  686.  
  687. struct extstate
  688. {
  689.    uint snum;    /* sound slot number */
  690.    uint xmsh;    /* XMS handle */
  691.    ulong xmso;    /* XMS offset for data */
  692.    ulong xmss;    /* XMS memory size */
  693.    ulong rate;     /* samplerate of sound */
  694.    uint chan;    /* number of sound channels */
  695.    uint comp;    /* code for compression */
  696.    uint dsiz;    /* bitsize of sample data */
  697.    char name;     /* name of sound file */
  698. };   
  699.  
  700. HWVersionBits Definition
  701.  
  702.     bMVA508     = 0000000000000001b ; MVA508(1) or National(0) mixer
  703.     bMVPS2        = 0000000000000010b ; PS2 bus stuff
  704.     bMVSLAVE    = 0000000000000100b ; CDPC Slave device is present
  705.     bMVSCSI     = 0000000000001000b ; SCSI interface
  706.     bMVENHSCSI    = 0000000000010000b ; Enhanced SCSI interface
  707.     bMVSONY     = 0000000000100000b ; Sony 535 interface
  708.     bMVDAC16    = 0000000001000000b ; 16 bit DAC
  709.     bMVSBEMUL    = 0000000010000000b ; SB h/w emulation
  710.     bMVMPUEMUL    = 0000000100000000b ; MPU h/w emulation
  711.     bMVOPL3         = 0000001000000000b ; OPL3(1) or 3812(0)
  712.     bMV101        = 0000010000000000b ; MV101 ASIC
  713.     bMV101_REV    = 0111100000000000b ; MV101 Revision
  714.  
  715. Note: this document and its associated programs are subject to change
  716. at any time and is being distributed for informational purposes only.
  717.  
  718. Copyright (c) 1992.  Media Vision, Inc.  All Rights Reserved. 
  719. Programmer: Bart Crane, Doug Cody
  720.  
  721. ************************************************************************
  722.  
  723. pcm.com         - main TSR/ISR
  724.  
  725. ctrlg.com    - turn on/off  CTRL-G intercept (plays sound #1)
  726.  
  727. keyx.com        - play a key # (syntax: keyx 14)
  728.  
  729. noact.com    - turn on/off  no-activity detection (plays sounds 25-32)
  730.  
  731. rndsnd.com       - turn on/off  random sounds (plays sounds 33-64)
  732.  
  733. sskey.com    - turn on/off left-right-shift key detection
  734.  
  735. tmr.com        - set timer 1 time
  736.  
  737.  
  738.