ErrorMode Flag
█▌Overview▐█
If you have control when a critical disk error occurs you must not call
any system functions (including INT 21H and other DOS services).
This situation can arise if your program hooks INT 24H (Critical Error
handler) or if your TSR gets control via a timer interrupt such as
INT 08H or INT 1cH while a critical disk error is taking place.
Note that a similar caution is described about the InDOS Flag, but when
that flag is set, it is still OK to use DOS fns 01H-0cH. The ErrorMode
Flag indicates a more dire situation, with DOS being in a very unstable
state. When it is set, you must avoid all DOS fns.
█▌ErrorMode Detection▐█
Your program can check the state of the ErrorMode Flag as follows:
■ Early on (before you need it!) use DOS fn 34H (get InDOS addr). The
address of the ErrorMode Flag is one byte before the address returned
by fn 34H. Save it.
■ Before popping up, check the byte at the ErrorMode Flag address.
A non-zero value means beware!. When ErrorMode is non-zero, DOS is
processing a critical disk error and you must NOT use any DOS
services.
█▌INT 28H: Toggling ErrorMode▐█
It is common for a pop-up TSR to take control by hooking INT 28H (DOS Idle
Handler).
When INT 28H is called, it is OK to use most DOS services (including disk
I/O and all higher-level fns. But you must avoid fns 01H-0cH. If you
simply must use fns 01H-0cH, the DOS tech ref suggests that you first set
ErrorMode to 01H.
In general, it is pretty easy to avoid fns 01H-0cH by accessing CON or
PRN, etc. via Handle-Oriented File I/O or by dropping down to BIOS-level
services such as INT 16H (keyboard services).
See Also: DOS fn 34H (get InDOS and ErrorMode address)
DOS fns 01H-0CH (low-level character I/O)
InDOS Flag
INT 24H (Critical Error Handler)
Process Control Functions
TSR Functions
-♦-