home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name isinvint -- Invoke an interrupt service routine
- * (Formerly called PCINVINT.)
- *
- * Synopsis ercode = isinvint(intype,preg);
- *
- * int ercode Returned error code (0 if okay,
- * 1 if interrupt type is out of range,
- * 2 if interrupt vector is invalid).
- * int intype Interrupt type (0 to 255)
- * DOSREG *preg Pointer to register structure
- *
- * Description This function invokes the interrupt service routine
- * associated with the interrupt type intype. Information
- * may be passed to the service routine via values in the
- * register structure. The service routine may alter these
- * values for return. The software interrupt is invoked
- * using ISCALINT.
- *
- * This function should not be used to access BIOS or DOS
- * functions because error checking and register setting
- * are not performed. (For example, the stack segment and
- * pointer are not saved even when that is necessary to
- * avoid certain DOS bugs.) ISINVINT is intended to invoke
- * user-defined software interrupt service routines. Use
- * the C TOOLS PLUS functions bios() or dos() to access
- * BIOS or DOS functions, respectively.
- *
- * Returns ercode Error code (0 if okay,
- * 1 if interrupt type is out of range,
- * 2 if interrupt vector is invalid).
- * *preg The values of the registers may be altered
- * by the service routine.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- **/
-
- #include <bisr.h>
-
- int isinvint(intype,preg)
- int intype;
- DOSREG *preg;
- {
- ADS vector;
- ALLREG regs;
-
- if (isretvec(intype,&vector)) /* Get interrupt vector */
- return 1; /* Interrupt type out of range */
-
- regs.ax.x = preg->ax;
- regs.bx.x = preg->bx;
- regs.cx.x = preg->cx;
- regs.dx.x = preg->dx;
- regs.si = preg->si;
- regs.di = preg->di;
- regs.ds = preg->ds;
- regs.es = preg->es;
- regs.flags = DEF_FLAGS;
-
- if (iscalint(&vector,®s))
- return 2; /* Invalid interrupt vector */
-
- preg->ax = regs.ax.x;
- preg->bx = regs.bx.x;
- preg->cx = regs.cx.x;
- preg->dx = regs.dx.x;
- preg->si = regs.si;
- preg->di = regs.di;
- preg->ds = regs.ds;
- preg->es = regs.es;
-
- return 0; /* Success. */
- }