beautypg.com

National Instruments PC-DIO-96 User Manual

Page 64

background image

Register-Level Programming

Chapter 4

PC-DIO-96 User Manual

4-26

© National Instruments Corporation

; restore saved registers

ii_exit:
pop es
pop ds
pop dx
pop cx
pop bx
pop ax
pop bp
sti
ret
_install_isr endp

; remove_isr
;
; bp reg at [bp+0]
; ret addr ofs at [bp+2]
; ret addr seg at [bp+4]
;

_remove_isr proc far
cli
push ax
push bx
push cx
push dx
push ds
push es
mov ax,seg _DATA
mov ds,ax

; see if our vector is installed--if not, do not remove the vector

cmp vect_num,0 ; See if vect_num was ever set
jz short ri_exit ; Our vector never installed--exit
mov al,vect_num ; Get vector number
mov ah,35h ; Get current vector from DOS
int 21h ; Get previous int_addr in es:bx
mov cx,cs ; Prep to compare old/current vectors
mov dx,es
cmp dx,cx ; See if our vector is already there
jne short ri_exit ; Different vector segment--exit
cmp bx,offset _isr_handler
jne short ri_exit ; Different vector offset--exit

; restore old mask and vector values