_intdosx

Description

Executes a DOS system call; accepts segment-register values.

#include <dos.h>

int _intdosx( union _REGS *inregs, union _REGS *outregs,
struct _SREGS *segregs );

inregs Register values on call  
outregs Register values on return  
segregs Segment-register values on call  

Remarks

The _intdosx function invokes the DOS system call specified by register values defined in inregs and returns the results of the system call in outregs. Unlike the _intdos function, _intdosx 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. The _REGS and _SREGS types are defined in the include file DOS.H.

To invoke a system call, _intdosx executes an INT 21H instruction. Before executing the instruction, the function copies the contents of inregs and segregs to the corresponding registers. Only the DS and ES register values in segregs are used. After the INT instruction returns, _intdosx copies the current register values to outregs and restores DS. It also copies the status of the system carry flag to the cflag field in outregs. A nonzero cflag field indicates the flag was set by the system call and also indicates an error condition.

The _intdosx function is used to invoke DOS system calls that take an argument in the ES register or that take a DS register value different from the default data segment.

Segment values for the segregs argument can be obtained by using either the _segread function or the _FP_SEG macro.

Return Value

The _intdosx function returns the value of the AX register after the system call is completed. If the cflag field in outregs is nonzero, an error has occurred; in such cases, _doserrno is also set to the corresponding error code.

Compatibility

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

See Also

_bdos, _FP_SEG, _intdos, _segread

Example

/* INTDOSX.C Sends a $-terminated string to the standard output device */

#include <dos.h>

#include <stdio.h>

char __far *buffer = “Dollar-sign terminated string\n\r\n\r$”;

void main( void )

{

union _REGS inregs, outregs;

struct _SREGS segregs;

/* Print a $-terminated string on the screen using DOS function 0x09. */

inregs.h.ah = 0x9;

inregs.x.dx = _FP_OFF( buffer );

segregs.ds = _FP_SEG( buffer );

_intdosx( &inregs, &outregs, &segregs );

}

Output

Dollar-sign terminated string