MS DOS overlay programming
Eric J Korpela
korpela at ssl.berkeley.edu
Thu Dec 28 17:56:54 CST 2006
> DEC bigots can skip this message safely. :-)
No they can't. ;) These techniques are of use on a lot of small memory
machines with rudimentary operating systems.
Sorry, have 5 minutes of spare time so I'm catching up on topics in
reverse order. Are you putting the TCP/IP stack in a TSR (and want to
reduce memory there). Or is it the application that you are trying to
reduce memory use in? If the application, is it a .com file or a
I think an overlay manager is overkill. The general way I handled
such things (in the distant past, when I had time to do such fun
If using a TSR or .COM file, place the initialization code after the
data section used by the initialization, feeling free to overwrite the
initialization code with data (.COM) or free the initialization code.
As long as you have your initialization variables in a static section
below the initialization code it's pretty easy.
It's a little bit more difficult in a .EXE file, since there is
(potentially) OS interaction with heap allocation. Methods I have used
1) copying the initialization code to the top of the heap prior to
execution and storing the initialization data on top of the code that
2) writing my own memory allocation code using a static variable as a
heap, and changing the link order to insure the initialization code
ends up above this variable.
3) manually modifying the heap pointers to "free" the initialization routines.
I'm sure there are other methods that I'm not thinking of, since this
was such a common problem.
More information about the cctalk