Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ int86x(DOS) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought

     Name
          int86x - Executes an interrupt.

     Syntax
          #include <dos.h>

          int int86x(intno, inregs, outregs, segregs)
          int intno;
          union REGS *inregs;
          union REGS *outregs;
          struct SREGS *segregs;

     Description
          The int86x function executes the 8086-processor-family
          interrupt specified by the interrupt number intno. Unlike
          the int86 function, int86x accepts segment-register values
          in segregs, letting programs that use large-model data
          segments or far pointers specify which segment or pointer
          should be used during the system call.

          Before executing the specified interrupt, int86x copies the
          contents of inregs and segregs to the corresponding
          registers. Only the DS and ES register values in segregs are
          used. After the interrupt returns, the function copies the
          current register values to outregs, copies the current ES
          and DS values to segregs, and restores DS. It also copies
          the status of the system carry flag to the cflag field in
          outregs. The inregs and outregs arguments are unions of type
          REGS. The segregs argument is a structure of type SREGS.
          These types are defined in the include file dos.h.

          The int86x function is used to directly invoke DOS
          interrupts that take an argument in the ES register, or that
          take a DS register value different from the default data
          segment.

     Return Value
          The return value is the value in the AX register after the
          interrupt returns. If the cflag field in outregs is nonzero,
          an error has occurred; in such cases, the _doserrno variable
          is also set to the corresponding error code.

     See Also
          bdos(DOS), FP_SEG(DOS), intdos(DOS), intdosx(DOS),
          int86(DOS), segread(DOS)

     Notes
          Segment values for the segregs argument can be obtained by
          using either the segread function or the FP_SEG macro.

     Example
          #include <signal.h> #include <dos.h> #include <stdio.h>
          #include <process.h>

          #define SYSCALL     0x21  /* INT 21H invokes system calls */
          #define CHANGE_ATTR 0x43  /* System call 43H */
          char far *filename = "int86x.c";  /* filename in 'far' */
                                            /* data segment */ union
          REGS inregs, outregs; struct SREGS segregs; int result;
          main()
           {
                  /*
                  ** AH is system call number
                  ** AL is function (get attributes)
                  ** DS:DX points to file name
                  */

                  inregs.h.ah = CHANGE_ATTR;
                  inregs.h.al = 0;
                  inregs.x.dx = FP_OFF(filename);
                  segregs.ds  = FP_SEG(filename);
                  result = int86x(SYSCALL, &inregs, &outregs,
          &segregs);
                  if (outregs.x.cflag)
                  {
                          printf( "Can't get file attributes; error
          no. %d\n",
                                  result);
                          exit(1);
                  }
                  else
                          printf("Attributes = %#x\n", outregs.x.cx );
            }

          In this program, int86x executes an INT 21H instruction to
          invoke DOS system call 43H (change file attributes). The
          program uses int86x because the file, which is referenced
          with a far pointer, may be in a segment other than the
          default data segment.  Thus, the program must explicitly set
          the DS register with the SREGS structure.

                                                (printed 6/18/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026