int86 and int86x functions
These functions are the general 8086 software interrupt interfaces defined in dos.h. Registers are set to the desired values and these functions are called to invoke the MS-DOS interrupts. The declaration of the int86 function is as follows:
int int86(int intno, union REGS *inregs,
union REGS *outregs);
int86x is the variation of int86 function. It is declared as follows:
int int86x(int intno, union REGS *inregs,
union REGS *outregs, struct SREGS *segregs);
Both the functions int86 and int86x execute an 8086 software interrupt specified by the argument intno Or we can say interrupt to generate is specified by intno.
With int86x function access is possible only to ES and DS and not to CS and SS so you can invoke an 8086 software interrupt that takes a value of DS different from the default data segment and/or takes an argument in ES.
These functions copy register values from inregs into the registers before execution of the software interrupt. The function int86x also 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.
The functions copy the current register values to outregs, 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, after the software interrupt returns. The function int86x also restores DS and sets the segregs->es and segregs->ds fields to the values of the corresponding segment registers.
In both functions inregs and outregs can point to the same structure and both functions return the value of AX after completion of the software interrupt. If the carry flag is set, it usually indicates that an error has occurred.
|