Executes an 8086 interrupt; accepts segment-register values.
#include <dos.h>
int _int86x( int intnum, union _REGS *inregs, union _REGS *outregs,
struct _SREGS *segregs );
intnum | Interrupt number | |
inregs | Register values on call | |
outregs | Register values on return | |
segregs | Segment-register values on call |
The _int86x function executes the 8086-processor-family interrupt specified by the interrupt number intnum. Unlike the _int86 function, _int86x accepts segment-register values in segregs, enabling programs that use large-model data segments or far pointers to 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 _REGS and _SREGS types are defined in the include file DOS.H.
Segment values for the segregs argument can be obtained by using either the _segread function or the _FP_SEG macro.
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.
Standards:None
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:None
_bdos, _FP_SEG, _int86, _intdos, _intdosx, _segread
/* INT86X.C: 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.
*/
#include <signal.h>
#include <dos.h>
#include <stdio.h>
#include <process.h>
char __far *filename = “_int86x.c”;
void main( void )
{
union _REGS inregs, outregs;
struct _SREGS segregs;
int result;
inregs.h.ah = 0x43; /* DOS function to change attributes */
inregs.h.al = 0; /* Subfunction 0 to get attributes) */
inregs.x.dx = _FP_OFF( filename ); /* DS:DX points to file name */
segregs.ds = _FP_SEG( filename );
result = _int86x( 0x21, &inregs, &outregs, &segregs );
if( outregs.x.cflag )
printf( “Can't get file attributes; error no. %d\n”, result);
else
printf( “Attribs = 0x%.4x\n”, outregs.x.cx );
}
Attribs = 0x0020