Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>intr() alternate 8086 software interrupt interface</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 intr()                  Alternate 8086 Software Interrupt Interface

 #include   <dos.h>

 void            intr(intr_num, preg);
 int             intr_num;               Interrupt number
 struct REGPACK  *preg;                  Pointer to structure

    intr() generates 'intr_num', a specified 8086 software interrupt.
    Before the interrupt is executed, intr() copies the register values
    from 'preg' into the registers; after the interrupt is executed,
    intr() copies the current register values into 'preg'.  The flags are
    preserved.  The arguments passed to intr() are:

          intr_num  the number of the 8086 software interrupt to
                    be executed.
          preg      the address of a structure containing
                    the input registers, before the call; and
                    the output registers, after the call.

    The 'REGPACK' structure has the form:

          struct REGPACK  {
               unsigned r_ax, r_bx, r_cx, r_dx;
               unsigned r_bp, r_si, r_di, r_ds, r_es, r_flags;
          };

       Returns:     Nothing.  'preg' contains the value of the registers
                    after the interrupt call.

   Portability:     MS-DOS only.

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

    The following statements use the DOS functions to get and set the
    time in order to advance the time by one hour (for daylight savings
    time).

           #include <dos.h>     /* for intr */

           main()
           {
               struct REGPACK tregs;

               tregs.r_ax = 0x2C;  /* get time function # */
               intr(0x21,&tregs);  /* DOS interrupt 0x21 */
               tregs.r_cx = 0x100; /* high byte of cx has hours */
               tregs.r_ax = 0x2D;  /* set time function # */
               intr(0x21,&tregs);  /* get new time */
           }


See Also: int86() intdos()

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