[comp.sys.ibm.pc] TSR programs and memory allocation

jal@ur-valhalla.UUCP (John Lefor) (10/26/87)

This is my first posting, so please try to bear with me.

I am experiencing a great deal of difficulty with getting
a TSR program (I have written) to be able to change the 
memory it is using after it has terminated.

Under some circumstances I want the TSR to get smaller
and then to recover the memory it released, if possible.
When I want it to shrink I set my PSP to my original
PSP and then issue a SETBLOK.  The TSR does shrink 
but this is the beginning of the problems.  In order to
recover the lost memory I tried to simply SETBLOK it
but the block of memory I released is not marked as
FREE, instead it is owned by DOS and hence cannot be allocated
(even though it is the last block in the system and is
not in use).  I proceed to mark the block free manually and then
the SETBLOK will work. All is well until I try to get the
TSR out of memory because all the work is done.  Now
future memory allocations have the parent PSP in the memory
block marked as my TSR not DOS.  (I get this info from
MKS Toolkit ps command).

Any ideas about how to do this??

I can be reached at:
716-275-8265 (work)    716-248-9420 (home)
rochester!ur-valhalla!jal%galaxy

Thanks.