I need to figure out how to make some TSR progrrams unloadable, I'm a rather good C/C++ programer with minimal asm know-how.
Thanks
VoidLogic
a real mode MS-DOS qestion
RE:a real mode MS-DOS qestion
Do TSRs work basically like BIOS services? When you write a BIOS service you're loading a little program into memory and setting a int vector to point to your program. If you just have your service save the original int vector that way you can restore it.....
RE:a real mode MS-DOS qestion
A TSR is a normal DOS program, except it exits by calling a different INT 21 routine that leaves it in memory. For it to work you need to tie into INT 9 (if it's a keyboard handler), or whatever interrupt you need.
If you want to disable interrupts, you can try to tie into INT 21, just return if the exit-to-TSR routine is called or pass the call on to the original INT 21 if it's ok. I'm not sure if DOS will automatically reset INT 21, though.
If you want to disable interrupts, you can try to tie into INT 21, just return if the exit-to-TSR routine is called or pass the call on to the original INT 21 if it's ok. I'm not sure if DOS will automatically reset INT 21, though.
RE:a real mode MS-DOS qestion
my TSRs basicaly act as runtime librarys so that exes can make function calls to them via pointers. _dos_keep(0, (_SS + (_SP/16) - _psp)); makes the exe a TSR, how would i unload it?
Thanks
-VoidLogic
Thanks
-VoidLogic
RE:a real mode MS-DOS qestion
it's possible to unload it.. iirc there was a special exit function on int 0x21 or some other dos functions to free up your memory.
can't look it up at the moment, the book in which there's an example how it works is at home and i'm far away from there.. perhaps i can look it up on friday
can't look it up at the moment, the book in which there's an example how it works is at home and i'm far away from there.. perhaps i can look it up on friday
RE:a real mode MS-DOS qestion
to unload your tsr you have to reset your interrupt vectors to their original values and free the mem your tsr occupies.
you can do that using
on tsr init you have to save es:
mov psp,es
;mov es, the seg addr of the memblock you want to free
mov es,psp
mov ah,49h ; dos function: free mem
int 21h
i think that should work (hey, it's long time ago since i coded some things in dos...
you can do that using
on tsr init you have to save es:
mov psp,es
;mov es, the seg addr of the memblock you want to free
mov es,psp
mov ah,49h ; dos function: free mem
int 21h
i think that should work (hey, it's long time ago since i coded some things in dos...
RE:a real mode MS-DOS qestion
Cool! Thanx a ton.
Now I just need to firgure out how to use this ASM in relation to my C\C++ program.
*VoidLogic
Now I just need to firgure out how to use this ASM in relation to my C\C++ program.
*VoidLogic