home *** CD-ROM | disk | FTP | other *** search
- ;----------------------------------------------------------------------------
- ; ISFIXED.ASM
- ;
- ; by Leonard Zerman
- ;
- ; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- ;----------------------------------------------------------------------------
-
- PUBLIC isfixed
- EXTRN __PARINFO:FAR
- EXTRN __PARC:FAR
- EXTRN __RETL:FAR
-
- ;----------------------------------------------------------------------------
- vect_num1 equ 24h ; the int to redirect
- dos_int equ 21h ;
- toupper equ 0DFh ; force to upper case
- ;----------------------------------------------------------------------------
- isfixed_text segment byte public 'CODE'
- assume cs:isfixed_text
- isfixed proc far ;
- ;----------------------------------------------------------------------------
- start: jmp begin ;
- ;
- old_v_1 dd ? ; storage for old int vector
- errorflag db 0 ;
- db ? ; alignment
- ;----------------------------------------------------------------------------
- crit_handler: mov cs:errorflag,1 ;
- xor ax,ax ;
- iret ;
- ;----------------------------------------------------------------------------
- begin: push bp ;
- mov bp,sp ;
- xor ax,ax ;
- mov cs:errorflag,al ;
- push ax ;
- call __PARINFO ; check for 1 parm
- add sp,2 ;
- cmp ax,1 ;
- je check4parm ;
- mov cs:errorflag,1 ;
- jmp exit ;
- check4parm: mov ax,1 ;
- push ax
- call __PARINFO ; check for character
- add sp,2 ;
- cmp ax,1 ;
- je getvect ;
- mov cs:errorflag,1 ;
- jmp exit ;
- getvect: push ds ;
- mov ah,35h ; get vector address
- mov al,vect_num1 ;
- int dos_int ;
- mov word ptr old_v_1,bx ; save old int address
- mov word ptr old_v_1[2],es ;
- ;----------------------------------------------------------------------------
- mov ah,25h ; set new pointer
- mov al,vect_num1 ;
- mov dx,cs ;
- mov ds,dx ;
- mov dx,offset crit_handler ; set pointer IP (CS & DS same)
- int dos_int ;
- pop ds ;
- ;----------------------------------------------------------------------------
- push es ;
- push bx ;
- mov ax,1 ;
- push ax ;
- call __PARC ;
- add sp,2 ;
- mov es,dx ;
- mov bx,ax ;
- mov dl,byte ptr es:[bx] ; Load drive letter
- pop bx ;
- pop es ;
- and dl,toupper ;
- sub dl,'A' ;
- inc dl ;
- push ds ;
- push bx ;
- mov ah,1Ch ;
- int dos_int ;
- ;----------------------------------------------------------------------------
- cmp byte ptr ds:[bx],0F8h ; isfixed true if equal
- je resetvec ;
- mov cs:errorflag,1 ;
- resetvec: mov ah,25h ;
- mov al,vect_num1 ;
- mov dx, word ptr old_v_1 ;
- mov ds, word ptr old_v_1[2];
- int dos_int ;
- ;----------------------------------------------------------------------------
- pop bx ;
- pop ds ;
- exit: xor ah,ah ;
- mov al,cs:errorflag ;
- xor ax,1 ;
- push ax ;
- call __RETL ;
- add sp,2 ;
- pop bp ;
- retf ;
- isfixed endp ;
- isfixed_text ends ;
- end
- ;----------------------------------------------------------------------------
-