Borland C++ reference

int86x

raw OCR

General 8086 software interrupt interface.

Defined in header <dos.h>

Syntax

#include <dos.h>
int int86x(int intno,union REGS *inregs, union REGS *outregs,
          struct SREGS *segregs);

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

int86x executes an 8086 software interrupt specified by the argument intno. Before executing the software interrupt, it copies register values from inregs into the registers.

In addition, int86x copies the segregs ->ds and segregs ->es values into the corresponding registers before executing the software interrupt. This feature allows programs that use far pointers or a large data memory model to specify which segment is to be used for the software interrupt.

After the software interrupt returns, intSSx copies the current register values to outregs, the status of the carry flag to the x.cflag field in outregs, and the value of the 8086 flags register to the x.flags field in outregs. In addition, int86x restores DS and sets the segregs ->es and segregs ->ds fields to the values of the corresponding segment registers. If the carry flag is set, it usually indicates that an error has occurred.

int86x lets you invoke an 8086 software interrupt that takes a value of DS different from the default data segment, and/or takes an argument in ES.

Note that inregs can point to the same structure that outregs points to.

Return value

int86x returns the value of AX after completion of the software interrupt. If the carry flag is set (outregs -> x.cflag ! = 0), indicating an error, this function sets the global variable _doserrno to the error code.

See also

Example

*include <dos.h>
#include <process.h>
#include <stdio.h>

int main(void)
{
   char filename [80];
   union REGS inregs,  outregs;
   struct SREGS segregs;
   printf ("Enter file name: ");
   gets(filename) ;
   inregs.h.ah = 0x43;
   inregs.h.al = 0;
   inregs.x.dx = FP_OFF(filename) ;
   segregs.ds = FP_SEG(filename) ;
   int86x(0x21, &inregs,  &outregs, &segregs);
   printf ("File attribute: %X\n", outregs.x.ex)
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.