📄 crit.asm
字号:
; File : $Workfile: CRIT.ASM$
;
; Description :
;
; Original Author : DIGITAL RESEARCH
;
; Last Edited By : $CALDERA$
;
;-----------------------------------------------------------------------;
; Copyright Work of Caldera, Inc. All Rights Reserved.
;
; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL,
; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC.
; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES
; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF
; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO
; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE
; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE
; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED,
; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST,
; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF
; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND
; CIVIL LIABILITY.
;-----------------------------------------------------------------------;
;
; *** Current Edit History ***
; *** End of Current Edit History ***
;
; $Log$
; CRIT.ASM 1.11 94/12/01 10:05:21
; Changed critical error message display so that the default message
; is 'I/O error' and that all share-related codes are converted to
; 'File sharing conflict'
;
; CRIT.ASM 1.9 93/09/10 15:56:08
; Use device driver header at BP:SI instead of AH to determine if disk/char device
; That way we get "device NETWORK" rather than "drive D" on VLM critical errors
; ENDLOG
;
; 19/Sep/88 Move the messages into a separate module
; 15/Dec/88 Critical Error messages processed by STDERR
; 06/Apr/89 DR DOS version taken from PCMODE & put in COMMAND.COM
; 10/Aug/89 Issue INT 2F's so application can give it's own error message
; 08/Sep/89 'No FCBs' message
; 02/Nov/89 abort_char etc become ABS rather than CHAR (saves a few bytes)
; 13/Nov/89 Reduced number of external messages referenced to one
; (crit_top) to aid Dual Language Support.
; 12/Feb/90 Changed code to avoid problems with double byte character sets.
; 8/Mar/90 Remove extra pair of CR/LF's that were output after error
; 20/Apr/90 DLS data into R_TEXT for Watcom C v7.0
; 9/May/90 Critical errors go to STDERR on command PSP, not current_psp
include msdos.equ
include mserror.equ
include driver.equ
;
dataOFFSET equ offset DGROUP:
PSP_XFTPTR equ es:dword ptr 34h ; from i:PSP.DEF
; Critical Error responses from the default INT 24 handler and
; the DO_INT24 routine.
;
ERR_IGNORE equ 0 ; Ignore Error
ERR_RETRY equ 1 ; Retry the Operation
ERR_ABORT equ 2 ; Terminate the Process
ERR_FAIL equ 3 ; Fail Function
;
OK_FAIL equ 00001000b ; Fail is a Valid Response
OK_RETRY equ 00010000b ; Retry is a Valid Response
OK_IGNORE equ 00100000b ; Ignore is a valid Response
OK_RIF equ 00111000b ; All Responsese are Valid
OK_RI equ 00110000b ; Retry and Ignore are Valid
OK_RF equ 00011000b ; Retry and Fail are Valid
;
;
; The following equates allow us to access the users registers
; and flags during normal system call emulation.
;
;NOTE:- The users INT21 structure is not normally available because of the
; stack switch which occurs on entry and only the general purpose
; registers are copied to the new stack.
;
dos_AX equ word ptr 0[bp]
dos_BX equ word ptr 2[bp]
dos_CX equ word ptr 4[bp]
dos_DX equ word ptr 6[bp]
dos_SI equ word ptr 8[bp]
dos_DI equ word ptr 10[bp]
dos_BP equ word ptr 12[bp]
dos_DS equ word ptr 14[bp]
dos_ES equ word ptr 16[bp]
;
;
;
ifdef CDOSTMP
DGROUP GROUP R_TEXT
R_TEXT SEGMENT byte public 'CDOS_DATA'
else
DGROUP GROUP _DATA, R_TEXT, ED_TEXT
R_TEXT SEGMENT byte public 'CDOS_DATA'
R_TEXT ENDS
_DATA SEGMENT byte public 'DATA'
endif
extrn _country:WORD
extrn __psp:WORD
ifdef DLS
TEXT_LEN equ 320 ; it needs to be this size for Japanese
Public _crit_msgs
; crit_table gives offset into crit_msgs table.
crit_table db 0 ; (00) Write to Read Only Disk
db 2 ; (01) Unknown Unit
db 4 ; (02) Drive Not Ready
db 2 ; (03) Unknown Command
db 6 ; (04) Data Error (CRC)
db 2 ; (05) Bad Request Length Structure
db 8 ; (06) Seek Error
db 10 ; (07) Unknown Media Type
db 12 ; (08) Sector Not Found
db 14 ; (09) Printer Out Of Paper
db 2 ; (0A) Write Fault
db 2 ; (0B) Read Fault
db 2 ; (0C) General Failure
db 16 ; (0D) File Sharing Error
db 16 ; (0E) Locking Error
db 18 ; (0F) FCB Unavailable
_crit_msgs dw TEXT_LEN ; size of this message buffer
crit_top dw 0,0,0,0,0,0,0,0,0,0
msg_crlf dw 0
readmsg dw 0
writemsg dw 0
drivemsg dw 0
charmsg dw 0
abort_char dw 0
abort_msg dw 0
retry_char dw 0
retry_msg dw 0
ignore_char dw 0
ignore_msg dw 0
fail_char dw 0
fail_msg dw 0
prompt_msg dw 0
dw 0 ; end of list
public _crit_text
_crit_text db TEXT_LEN dup(?) ; message text is placed here
CRIT_LEN equ $-crit_top
else
extrn msg0:byte, msg2:byte, msg3:byte, msg4:byte
extrn msg6:byte, msg7:byte, msg8:byte
extrn msg20:byte, msg21:byte, msg22:byte
crit_top dw offset DGROUP:msg0 ; (00) Write to Read Only Disk
dw offset DGROUP:msg3 ; (01) Unknown Unit
dw offset DGROUP:msg2 ; (02) Drive Not Ready
dw offset DGROUP:msg3 ; (03) Unknown Command
dw offset DGROUP:msg4 ; (04) Data Error (CRC)
dw offset DGROUP:msg3 ; (05) Bad Request Length Structure
dw offset DGROUP:msg6 ; (06) Seek Error
dw offset DGROUP:msg7 ; (07) Unknown Media Type
dw offset DGROUP:msg8 ; (08) Sector Not Found
dw offset DGROUP:msg21 ; (09) Printer Out Of Paper
dw offset DGROUP:msg3 ; (0A) Write Fault
dw offset DGROUP:msg3 ; (0B) Read Fault
dw offset DGROUP:msg3 ; (0C) General Failure
dw offset DGROUP:msg20 ; (0D) File Sharing Error
dw offset DGROUP:msg20 ; (0E) Locking Error
dw offset DGROUP:msg22 ; (0F) FCB Unavailable
Extrn msg_crlf:byte
Extrn readmsg:byte, writemsg:byte, drivemsg:byte, charmsg:byte
Extrn abort_char:byte, abort_msg:byte
Extrn retry_char:byte, retry_msg:byte
Extrn ignore_char:byte, ignore_msg:byte
Extrn fail_char:byte, fail_msg:byte, prompt_msg:byte
endif
ifndef CDOSTMP
_DATA ends
ED_TEXT SEGMENT para public 'CDATA'
endif
assume cs:DGROUP, ds:nothing, es:nothing, ss:nothing
;
; This is the default critical error handler which will prompt
; the user with an error message and wait for a response. This handler
; is usually replaced by the DOS application
;
; +++++++++++++++++++++++++++++++
; Int 24 - Critical Error Handler
; +++++++++++++++++++++++++++++++
;
; INT 24 Critical Error:-
; On Entry:- AH/7 0 = Disk Device
; AH/5 0 = IGNORE is an Invalid Response
; AH/4 0 = RETRY in an Invalid Response
; AH/3 0 = FAIL is an Invalid Response
; AH/2-1 00= DOS Area
; 01= File Allocation Table
; 10= Directory
; 11= Data
; AH/0 0 = Read, 1 = Write
;
; AL Failing Disk Drive if AH/7 == 0
; BP:SI Device Header Control Block
; DI High Byte DRNET server (inverted, CDOS only)
; Low Byte Error Code
;
; On Exit:- AL 0 = IGNORE Error
; 1 = RETRY the Operation
; 2 = TERMINATE using INT 23
; 3 = FAIL the current DOS function
;
;
Public com_criterr
com_criterr:
;
; This is called by the int24 handler 'critical_error', in CSTART.ASM.
;
sti
cld
push es
push ds
push bp
push di
push si
push dx
push cx
push bx
push ax
mov bp,sp
mov ah,MS_P_GETPSP
int DOS_INT ; Get PSP into DS
mov ds,cs:__psp
mov al,ds:byte ptr 1ah ; use COMMAND STDERR for Console INPUT
mov ah,al ; and OUTPUT
mov es,bx
lds bx,PSP_XFTPTR ; Get the handle table pointer
push word ptr [bx] ; Save the current Values
mov word ptr [bx],ax
push cs
pop ds ; DS == CS
call i24_crlf ;output carriage return - line feed
mov ah,MS_F_ERROR
xor bx,bx
int DOS_INT ; Get extended error code
mov cx,ax ; Get the Real Error Code (ie INT21/59)
mov bx,0Fh ; assume FCB unavailable
cmp al,-(ED_NOFCBS) ; if FCB exhausted/closed then generate
je int24_e10 ; a more appropriate error message
dec bx
dec bx
cmp al,-(ED_SHAREFAIL) ; check for sharing failure which
je int24_e10 ; is forced to be a DRIVE NOT READY
cmp al,-(ED_NOLOCKS) ; check for sharing buffer overflow
je int24_e10
dec bx ; BX = 0Ch, default error
mov ax,dos_DI ; get the REAL error code
cmp ax,0Eh ; is it a sensible value ?
ja int24_e10 ; no, return GENERAL FAILURE
xchg ax,bx ; yes, use it
int24_e10:
call int24_errmsg ; print out the offending error msg
call i24_crlf ; Print CR/LF
;
; This section of the Critical Error handler prints the correct
; prompt repeatedly until the user responds with a correct
; response. This value is returned to the PCMODE.
;
i24_query:
ifdef DLS
mov dx,abort_msg ; Print "Abort" as this is always
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -