TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Robin Sheppard
from: George White
date: 1998-08-22 19:36:06
subject: TSR code

Hi Robin,

RS>   As to making it terminate and stay resident, that's a tricky part.
RS>   There's a DOS call that gets a process's PSP (program segment
RS>   prefix, I believe it stands for), and then you need to call another
RS>   DOS function that terminates that process, but doesn't free the
RS>   memory.

Not really. You have to know how much RAM the program uses, and reserve
that (by a system call). You can then exit back to the OS using the
"Terminate and Stay Resident" system call.

RS>   After loading something resident, however, I don't know how to get
RS>   it out of there, short of a reboot.  I know it can be done- many
RS>   TSR programs have an 'uninstall' option- I just have no clue how
RS>   they do it.

You restore the original interrupt vectors, but you can only do this if
they have not been taken over by another program. So first you check
that the interrupt vectors are set to the values you put in them
originally. If they are you can restore them to the values saved when
loading the TSR. If not, all you can do is set a flag to make the TSR
inactive, you can't unload it as the interrupt chaining will be broken.
I'm not sure how you return the memory to the system, but if it can be
done it'll be by a system call.

The necessary system calls are all documented in Ralf Brown's interrupt
list.

George

 * SLMR 2.1a * Computers eliminate spare time.

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-717904) (2:440/4)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728 810
SEEN-BY: 639/252 670/213 218
@PATH: 440/4 255/1 251/25 2320/38 270/101 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.