Metropoli BBS
VIEWER: vect.rt MODE: TEXT (ASCII)
ideal

; In : bx - IRQ
;      si:di - Routine to setup
; Out: si:di - Routine retrieved
proc            SetVect
                pushf
                cli
                in      al,0A1h
                mov     ah,al
                in      al,21h

                mov     cl,bl
                mov     dx,1
                shl     dx,cl
                not     dx
                and     ax,dx
                out     21h,al
                mov     al,ah
                out     0A1h,al

                cmp     bx,7
                jle     @@Add8
                add     bx,60h
@@Add8:         add     bx,8
                shl     bx,2
                push    es
                xor     ax,ax
                mov     es,ax
                push    [Word es:bx]
                push    [Word es:bx+2]
                mov     [es:bx],di
                mov     [es:bx+2],si
                pop     si di es
                popf
                ret
endp            SetVect


; In : BX - IRQ to restore
;      SI:DI - Address to restore to.
proc            RestoreVect
                pushf
                cli
                in      al,0A1h
                mov     ah,al
                in      al,21h
                mov     cl,bl
                mov     dx,1
                shl     dx,cl
                or      ax,dx
                out     21h,al
                mov     al,ah
                out     0A1h,al
                cmp     bx,7
                jle     @@Add8
                add     bx,60h
@@Add8:         add     bx,8
                shl     bx,2
                push    es
                xor     ax,ax
                mov     es,ax
                mov     [es:bx],di
                mov     [es:bx+2],si
                pop     es
                popf
                ret
endp            RestoreVect

[ RETURN TO DIRECTORY ]