home *** CD-ROM | disk | FTP | other *** search
/ Audio 4.94 - Over 11,000 Files / audio-11000.iso / msdos / sndbords / proaudio / mvdoc / sfdma.doc < prev    next >
Text File  |  1992-12-28  |  4KB  |  93 lines

  1. SETDMA.EXE FREEDMA.EXE
  2.  
  3. Source: setdma.c     source to setdma.exe
  4.     freedma.c     source to freedma.exe
  5.     doenv.c        source for affecting environment
  6.     sfdma.m        make/nmake build file
  7.     sfdma.doc    this document
  8.  
  9. Build:    cl -c setdma.c
  10.     cl -c freedma.c
  11.     cl -c doenv.c 
  12.     link setdma.obj doenv.obj;
  13.     link freedma.obj doenv.obj;
  14.  
  15. These two complementary programs are used together to obtain and return
  16. memory from the system.
  17.  
  18. They do not use any standard means of accomplishing this!
  19.  
  20. There are three areas that are especially non-standard:
  21.  
  22.     1. They use the (officially) undocumented function 
  23.     to retrieve the address of the DOS "List of Lists" 
  24.     in order to obtain the address of the first MCB in 
  25.     the chain of memory control blocks.
  26.  
  27.     This is actually the standard means of accomplishing 
  28.     such, although it uses an "undocumented" int 21h call.
  29.  
  30.     2. It updates the Master Environment block.
  31.  
  32.     There is no official, undocumented or in any way 
  33.     "bulletproof" means of locating this area of memory.
  34.     The means used here is merely one of of several which
  35.     can fail under different system configurations.
  36.  
  37.     3. It directly affects the MCB chain; it does not use
  38.     DOS to allocate or release memory.
  39.  
  40.     Of course, this sort of activity must be "frowned upon".
  41.     Without writing a TSR, allocating memory without having
  42.     it freed upon exit is otherwise impossible.  But, the
  43.     definition of a memory control block is straightforward,
  44.     so this works.
  45.  
  46. The whole point of this exercise is to allocate an area of memory
  47. to be used for DMA transfers with the Pro Audio Spectrum series of
  48. sound boards from Media Vision.  
  49.  
  50. Because the DMA buffer must not cross a 64K segment, it is not possible
  51. to simply allocate a block of memory using DOS and use it because it may
  52. cross such a boundary.  If you were to try to do this "early" in the
  53. boot sequence, you may have success;  after loading a number of TSR's,
  54. though, who knows?
  55.  
  56. SETDMA will search all the way to the top of memory, back up 16K, and
  57. take that block from the system (if it determines that it is okay to
  58. do so).  DOS does not provide the ability to allocate from the top of
  59. memory reliably (the last-fit strategy has been reported to me as not
  60. always implemented).
  61.  
  62. It takes the memory by simply adjusting the size of the last MCB and 
  63. creating a new MCB and marking it as "owned".  That's it.
  64.  
  65. Since you have the source code, you can modify the program to take
  66. as or as little memory as possible.
  67.  
  68. Oh, and you will notice that after the program traces the MCB chain
  69. for conventional memory, it follows on up through the Upper Memory 
  70. (memory above A000).  You might want to modify the program to allocate
  71. a block in this area, thereby freeing up that 16K in conventional 
  72. (actually, that is what I am going to do)!
  73.  
  74. FREEDMA will release the memory allocated by setdma.  You either 
  75. specify the address of memory (not the MCB;  the MCB + 1 paragraph)
  76. on the command line, or let the program find the environment variable
  77. "DMABUF".
  78.  
  79. The program "TPCM.exe" (which uses "PCM.com", the TSR for PCM services)
  80. can be told to use a specific area of memory for its DMA buffer, which
  81. is the whole point between these two programs.  It will use the environment
  82. variable "DMABUF" (if so directed), and when SETDMA is modified to use
  83. UMB's, PCM output will no longer take 64K+ of buffer space!
  84.  
  85.  
  86. WARNING!  Use these programs at your own risk!  
  87. Distributed for Informational Purposes Only.
  88.  
  89. Copyright (c) 1992.  Media Vision, Inc.  All Rights Reserved.
  90. Programmer: Bart Crane
  91.  
  92.  
  93.