Unloading TSRs 
Author Message
 Unloading TSRs

    Hi, I've written a couple of TSRs that work as expected, but want to be
able to unload them.  Can anyone tell me how to remove a TSR from memory
(and how I can do so using the tsr itself and/or from the command line)?

Thanks alot

Alec Soroudi



Sat, 05 Jan 2002 03:00:00 GMT  
 Unloading TSRs

Quote:
>     Hi, I've written a couple of TSRs that work as expected, but want
to be
> able to unload them.  Can anyone tell me how to remove a TSR from
memory
> (and how I can do so using the tsr itself and/or from the command

line)?

   Set one of programmingly callable interrupts as an UNLOAD entry
point. When this entry point is called TSR frees its allocated memory,
restores trapped interrupt vectors and returns to the caller.

   E.g.:

TSR_CODE SEGMENT
ASSUME CS:TSR_CODE

StartTsr:
 jmp TsrInit

OrigInt98 DW ?, ?

; Put other TSR stuff here.

Unload:
 push es
 push ax
 push bx

 sub ax, ax
 mov es, ax

; Restore original INT 98h handler.
 mov ax, OrigInt98
 es:[98h*4], ax
 mov ax, OrigInt98[2]
 es:[98h*4][2], ax

; Free TSR memory.
 mov ah, 49
 mov bx, cs
 int 21h

; Return
 pop bx
 pop ax
 pop es
 iret

TSR_SIZE = ($ - StartTsr) / 10h + 11h

; TSR initialization code.
TsrInit:
 cli
 sub ax, ax
 mov es, ax

; Trap UNLOAD interrupt 98h.
 mov ax, es:[98h*4]
 mov OrigInt98, ax
 mov ax, es:[98h*4][2]
 mov OrigInt98[2], ax
 mov es:[98h*4], offset Unload
 mov es:[98h*4][2], cs
 sti

; TSR
 mov dx, TSR_SIZE
 mov ah, 31h
 int 21h

TSR_CODE ENDS
END StartTsr

-- Sclerosis cannot be healed but can be forgotten --

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Sat, 05 Jan 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Unloading TSRs

2. unloading tsrs

3. Unloading TSRs

4. Use of RETF in a TSRs ISR

5. TSRs in VM

6. TSRs in VM

7. TSRs allowed?

8. Clipper TSRs with DR. Switch ASE

9. TSRs in CLIPPER

10. Tutorial for TSRs

11. TSRs

12. question on win95 TSRs...

 

 
Powered by phpBB® Forum Software