R&D Books Book Cover
[Return]

Listing 4: The installint Function

.DATA
descrbuffer      DB 8 DUP(0)
offsetint        DW 0      ;old int. vector
selectorint      DW 0      ; /
.CODE
dsselector       DW 0      ;data alias to code seg
hwndcs           DW 0      ;save window handle for use in isr
;
installint     PROC      ;no params
  pusha
  push   es
  push   ds
;will create alias in ldt of current task...
  mov    ax,000Ah         ;create alias data descr. for code seg.
  push   cs
  pop    bx                ;selector to be aliased
  int    31h               ;returns ax
     push ax
     pop es
     mov ax,hwnd
     mov es:hwndcs,ax      ;handle of window
     mov ax,es
     mov es:dsselector,ax  ;alias
;now to get the old INT-51h vector, and save it ...
  mov al,51h               ;get vector in idt
  mov ah,35h              ;-->ES:BX
  int 21h
  push es
  pop ax
  mov offsetint,bx         ;save the old vector.
  mov selectorint,ax       ;    /
  mov dx,OFFSET runtime    ;get the new vector
  push cs                  ;    /
  pop ds                   ;new vector in ds:dx
  mov al,51h
  mov ah,25h              ;set vector
  int 21h
;
  pop ds                   ;restore ds.
  push ds                  ;save it again
;let's hook int60, to use as old vector...
  mov dx,offsetint
  mov ax,selectorint
  mov ds,ax
  mov ax,2560h
  int 21h
;installation now finished ....
  pop ds
  pop es
  popa
  ret
 

[Return]

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