Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>harderr() establish a hardware error handler</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
harderr()                Establish a Hardware Error Handler

 #include   <dos.h>

 void       harderr(fptr);
 int        (*fptr)();                   Pointer to function

    harderr() establishes a hardware error handler for the current
    program.  This handler is invoked whenever an interrupt 0x24 occurs.
    The function pointed to by 'fptr' will be called when such an
    interrupt occurs.  The handler function will be called with the
    following arguments:

          handler(errval,ax,bp,si);
          int errval;         Error code set by MS-DOS in the DI register
          int ax;             Value set by MS-DOS in AX register
          int bp;             Value set by MS-DOS in BP register
          int si;             Value set by MS-DOS in SI register

    'ax' indicates whether a disk error or other device error was
    encountered.  If 'ax' is non-negative, a disk error was encountered;
    otherwise, the error was a device error.  For a disk error, 'ax'
    ANDed with 0x00FF will give the failing drive number (1 = A, 2 = B,
    etc).  'bp' and 'si' together point to the device driver header of
    the failing driver.

    The named function is called indirectly.  harderr() establishes a DOS
    interrupt handler that calls the function.

    Returns:    The handler returns:

                   0  =  ignore
                   1  =  retry
                   2  =  abort

      Notes:    peek() and poke() can be used to retrieve device
                information from this driver header . ('bp' is the
                segment address, and 'si' is the offset).

                The handler may issue 'bdos' calls 1 through 0x0C, but
                any other 'bdos' calls will corrupt MS-DOS.  In
                particular, none  of the C standard I/O or UNIX-emulation
                I/O calls may be used.

                The driver header may not be altered via poke() or
                pokeb(). The error handler may return or call
                hardresume() to return to MS-DOS.

                The return value of the handler (or of hardresume()
                ('rescode')) contains an abort (2), retry (1) or ignore
                (0) indicator.  The abort is accomplished by invoking DOS
                interrupt 0x023 (control-break interrupt).

                Calling hardretn() will cause the error handler to return
                directly to the application program.

See Also: hardresume() hardretn() peek() poke() setjmp()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson