_chain_intr
Chains to another interrupt handler.
Defined in header <dos.h>
Syntax
#include <dos.h>
void _chain_intr(void (interrupt far *neivhandler){));
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
The _chaln_lntr functions passes control from the currently executing interrupt handler to the new interrupt handler whose address is newhandler. The current register set is NOT passed to the new handler. Instead, the new handler receives the registers that were stacked (and possibly modified in the stack) by the old handler. The new handler can simply return, as if it were the original handler. The old handler is not entered again.
The _chain_intr function may be called only by C interrupt functions. It is useful when writing a TSR that needs to insert itself in a chain of interrupt handlers (such as the keyboard interrupt).
Return value
_cliain_intr does not return a value.
See also
_dos_getvect_dos_setvect_dos_l<eep
Example
#include <dos.h>
#include <stdio.h>
#include <process.h>
ttifdef cplusplus
#def ine _CPPARGS .. .
#else
ttdefine _CPPARGS
tendif
typedef void interrupt (*fptr) (_CPPARGS) ;
static void mesg(char *s)
{
while (*s)
bdos(2,*s++,0);
}
#pragma argsused
void interrupt handler2 (unsigned bp, unsigned di)
_enable();
mesgC'In handler 2.\r\n");
if (di == 1)
mesgC'DI is l\r\n") ;
else
mesgC'DI is not l\r\n");
di+ + ;
#pragma argsused
void interrupt handlerl (unsigned unsigned di)
_enable() ;
mesgC'In handler l.\r\n");
if (di == 0)
mesgC'DI is 0\r\n") ;
else
mesgC'DI is not ■0\r\n");
di++;
mesg("Chaining to handler 2.\r\n");
_chain_intr (handler2);
}
void mainO
{
_dos_setvect (128,(fptr) handlerl);
printf ("About to generate interrupt 128\n");
_DI = 0;
geninterrupt (128);
printf ("DI was 0 before interrupt, is now Ox%x\n",_DI) ;
exit(0),•
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `chain intr` read as `_chain_intr`
Stable link: /3.1/dos.h/_chain_intr/
· short form /3.1/_chain_intr/