Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>int86() execute 8086 software interrupt</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
int86()                  Execute 8086 Software Interrupt

 #include   <dos.h>

 int         int86(intno,inregs,outregs);
 int         intno;                      Interrupt number
 union REGS  *inregs;                    Register values going into call
 union REGS  *outregs;                   Register values on return

    int86() executes the 8086 software interrupt 'intno'. The registers
    are set to the values in 'inregs' before the interrupt is executed.
    'outregs' is set to the value of the registers after the interrupt is
    executed.  The 'cflag' field of 'outregs' is set to the status of the
    system carry flag.

    Returns:    The value of the AX register after the system call. If
                the 'cflag' field in 'outregs' is non-zero, an error has
                occurred and '_doserrno' (defined in <stdlib.h>) is set
                to the error code.

      Notes:    If 'far' or 'huge' addresses are passed to the interrupt
                routine, int86x() may needed instead of int86().

                DOS interrupts (interrupt #21H) can also be executed with
                intdos().

                The union type REGS is defined in <dos.h>.

  -------------------------------- Example ---------------------------------

    The following statements clear the screen by using BIOS interrupt 10H
    to first read the current video mode, then reset the video mode to
    its current mode:

          #include <dos.h>       /* for int86() and union REGS */

          main()
          {
              union REGS inregs, outregs;

              inregs.h.ah = 0x0F;              /* set BIOS function number */
              int86(0x10, &inregs, &outregs);  /* read video mode */

              inregs.h.ah = 0;                 /* set BIOS function number */
              inregs.h.al = outregs.h.al;      /* set video mode number */
              int86(0x10, &inregs, &outregs);  /* set video mode */
                                               /* also clears the screen) */
          }

See Also: bdos() intdos() intdosx() int86x()

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