Invokes the DOS system call.
#include <dos.h>
int _bdos( int dosfunc, unsigned int dosdx, unsigned int dosal );
dosfunc | Function number | |
dosdx | DX register value | |
dosal | AL register value |
The _bdos function invokes the DOS system call specified by dosfunc after placing the values specified by dosdx and dosal in the DX and AL registers, respectively. The _bdos function executes an INT 21H instruction to invoke the system call. When the system call is complete, _bdos returns the contents of the AX register.
The _bdos function is intended to be used to invoke DOS system calls that either take no arguments or take arguments only in the DX (DH, DL) and/or AL registers.
Do not use the _bdos function to call interrupts that modify the DS register. Instead, use the _intdosx or _int86x function. The _intdosx and _int86x functions load the DS and ES registers from the segregs argument and also store the DS and ES registers into segregs after the function call.
This call should not be used to invoke system calls that indicate errors by setting the carry flag. Since C programs do not have access to this flag, your program cannot determine whether the return value is an error code. The _intdos function should be used in these cases.
The _bdos function returns the value of the AX register after the system call has completed.
Standards:None
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:None
/* BDOS.C: This example calls DOS function 0x9 (display string)
* to display a $-terminated string.
*/
#include <dos.h>
/* Function 0x09 assumes that DS will contain segment of the string.
* This will be true for all memory models if the string is declared near.
*/
char __near str[] = "Hello world!\r\n$";
void main( void )
{
/* Offset of string must be in DX, segment in DS. AL is not needed,
* so 0 is used.
*/
_bdos( 0x09, (int)str, 0 );
}
Hello world!