R&D Books Book Cover

[Return]

Listing 1: TSR Install Routine

.DATA
offsetint DW 0                      ;old int-vector
selectorint DW 0                    ; /
.CODE
install PROC PASCAL NEAR           ;no params
   USES   ax,bx,cx,dx,si,di,es
   mov    al,16h                    ;get vector in idt
   mov    ah,35h
   int    21h                       ;returns vector in es:bx
   mov    offsetint,bx              ;save old vector.
   mov    selectorint,es            ; /
   mov    dx,OFFSET runtime         ;new vector.
   push   ds                        ;save ds.
   push   cs
   pop    ds                        ;new vector in ds:dx
   mov    al,16h                    ;int to be hooked.
   mov    ah,25h                   ;set vector
   int    21h
   pop    ds                        ;restore ds.
   ret
install ENDP

[Return]

Copyright © 1997, R&D Books, an imprint of Miller Freeman, Inc. All rights reserved. Last updated: 10/09/97