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 >
Wrap
Text File
|
1992-12-28
|
4KB
|
93 lines
SETDMA.EXE FREEDMA.EXE
Source: setdma.c source to setdma.exe
freedma.c source to freedma.exe
doenv.c source for affecting environment
sfdma.m make/nmake build file
sfdma.doc this document
Build: cl -c setdma.c
cl -c freedma.c
cl -c doenv.c
link setdma.obj doenv.obj;
link freedma.obj doenv.obj;
These two complementary programs are used together to obtain and return
memory from the system.
They do not use any standard means of accomplishing this!
There are three areas that are especially non-standard:
1. They use the (officially) undocumented function
to retrieve the address of the DOS "List of Lists"
in order to obtain the address of the first MCB in
the chain of memory control blocks.
This is actually the standard means of accomplishing
such, although it uses an "undocumented" int 21h call.
2. It updates the Master Environment block.
There is no official, undocumented or in any way
"bulletproof" means of locating this area of memory.
The means used here is merely one of of several which
can fail under different system configurations.
3. It directly affects the MCB chain; it does not use
DOS to allocate or release memory.
Of course, this sort of activity must be "frowned upon".
Without writing a TSR, allocating memory without having
it freed upon exit is otherwise impossible. But, the
definition of a memory control block is straightforward,
so this works.
The whole point of this exercise is to allocate an area of memory
to be used for DMA transfers with the Pro Audio Spectrum series of
sound boards from Media Vision.
Because the DMA buffer must not cross a 64K segment, it is not possible
to simply allocate a block of memory using DOS and use it because it may
cross such a boundary. If you were to try to do this "early" in the
boot sequence, you may have success; after loading a number of TSR's,
though, who knows?
SETDMA will search all the way to the top of memory, back up 16K, and
take that block from the system (if it determines that it is okay to
do so). DOS does not provide the ability to allocate from the top of
memory reliably (the last-fit strategy has been reported to me as not
always implemented).
It takes the memory by simply adjusting the size of the last MCB and
creating a new MCB and marking it as "owned". That's it.
Since you have the source code, you can modify the program to take
as or as little memory as possible.
Oh, and you will notice that after the program traces the MCB chain
for conventional memory, it follows on up through the Upper Memory
(memory above A000). You might want to modify the program to allocate
a block in this area, thereby freeing up that 16K in conventional
(actually, that is what I am going to do)!
FREEDMA will release the memory allocated by setdma. You either
specify the address of memory (not the MCB; the MCB + 1 paragraph)
on the command line, or let the program find the environment variable
"DMABUF".
The program "TPCM.exe" (which uses "PCM.com", the TSR for PCM services)
can be told to use a specific area of memory for its DMA buffer, which
is the whole point between these two programs. It will use the environment
variable "DMABUF" (if so directed), and when SETDMA is modified to use
UMB's, PCM output will no longer take 64K+ of buffer space!
WARNING! Use these programs at your own risk!
Distributed for Informational Purposes Only.
Copyright (c) 1992. Media Vision, Inc. All Rights Reserved.
Programmer: Bart Crane