home *** CD-ROM | disk | FTP | other *** search
- page,132
- title INT24.ASM - CRITICAL ERROR PROCEDURES for MICROSOFT 'C' (4.0)
- ; Traps int24 critical error handler. int24error & int24result must
- ; be declared in C source code. int24error is set if an error occurs
- ; and int24result contains the cause.
- ;
- ; int24result
- ; Error Code Description
- ; =========== =============
- ; 0 Attempt to write on write-protected disk
- ; 1 Unknown unit
- ; 2 Drive not ready
- ; 3 Unknown Command
- ; 4 Data error (CRC)
- ; 5 Bad Request structure length
- ; 6 Seek error
- ; 7 Unknown media type
- ; 8 Sector not found
- ; 9 Printer out of paper
- ; A Write fault
- ; B Read fault
- ; C General failure
- ;
-
- public int24,__int24on,__int24off
-
- DGROUP GROUP _DATA
-
- _data segment word public 'DATA'
- extrn _int24error:byte, _int24result:byte ;you can find this variable in C's data segment
- OldInt24Seg dw 0
- OldInt24Off dw 0
- FCBFuncs db 14,15,21,22,27,28
- _data ends
-
- _text segment byte public 'CODE'
- assume cs:_text,ds:DGROUP
-
- int24 proc far
- push bp
- mov bp,sp
- push bp
- push ax
- mov ax,DGROUP
- mov ds,ax
- mov es,ax
- pop ax
- mov _int24error,1
- mov sp,bp
- add sp,8
- mov ax,di
- mov _int24result,al
- pop ax
- mov cx,6
- mov di,offset FCBFuncs
- repnz scasb
- jnz not_1
- mov al,1
- jmp go_to_prog
-
- not_1:
- cmp al,39h
- mov al,0ffh
- jb go_to_prog
- mov al,83h
-
- go_to_prog:
- pop bx
- pop cx
- pop dx
- pop si
- pop di
- mov bp,sp
- or byte ptr [bp+0ah],1
- pop bp
- pop ds
- pop es
- iret
- int24 endp
-
- __int24on proc near ;far for large model
- push ds
- push es
- push ax
- push bx
- push dx
- mov ax,DGROUP
- mov ds,ax
- mov ax,3524h
- int 21h
- mov OldInt24Seg,es
- mov OldInt24Off,bx
- mov ax,_text
- mov ds,ax
- mov dx,offset int24
- mov ax,2524h
- int 21h
- pop dx
- pop bx
- pop ax
- pop es
- pop ds
- ret
- __int24on endp
-
- __int24off proc near ;far for large model
- push ds
- push es
- push ax
- push dx
- mov ax,DGROUP
- mov ds,ax
- mov dx,OldInt24Off
- mov ds,OldInt24Seg
- mov ax,2524h
- int 21h
- pop dx
- pop ax
- pop es
- pop ds
- ret
- __int24off endp
-
- _text ends
- end
-
-
-
-
-
-
-
-
-
-