These routines are implemented as functions and declared in DOS.H.
Routine | Use |
_bdos | Invokes DOS system call; uses only DX and AL registers |
_chain_intr | Chains one interrupt handler to another |
_disable | Disables interrupts |
_dos_allocmem | Allocates a block of memory, using DOS system call 0x48 |
_dos_close | Closes a file, using DOS system call 0x3E |
_dos_commit | Flushes a file to disk, using DOS system call 0x68 |
_dos_creat | Creates a new file and erases any existing file having the same name, using DOS system call 0x3C |
_dos_creatnew | Creates a new file and returns an error if a file having the same name exists, using DOS system call 0x5B |
_dos_findfirst | Finds first occurrence of a given file, using DOS system call 0x4E |
_dos_findnext | Finds subsequent occurrences of a given file, using DOS system call 0x4F |
_dos_freemem | Frees a block of memory, using DOS system call 0x49 |
_dos_getdate | Gets the system date, using DOS system call 0x2A |
_dos_getdiskfree | Gets information on a disk volume, using DOS system call 0x36 |
_dos_getdrive | Gets the current default drive, using DOS system call 0x19 |
_dos_getfileattr | Gets current attributes of a file or directory, using DOS system call 0x43 |
_dos_getftime | Gets the date and time a file was last written, using DOS system call 0x57 |
_dos_gettime | Gets the current system time, using DOS system call 0x2C |
_dos_getvect | Gets the current value of a specified interrupt vector, using DOS system call 0x35 |
_dos_keep | Installs terminate-and-stay-resident (TSR) programs using DOS system call 0x31 |
_dos_open | Opens an existing file, using DOS system call 0x3D |
_dos_read | Reads a file, using DOS system call 0x3F |
_dos_setblock | Changes the size of a previously allocated block, using DOS system call 0x4A |
_dos_setdate | Sets the current system date, using DOS system call 0x2B |
_dos_setdrive | Sets the default disk drive, using DOS system call 0x0E |
_dos_setfileattr | Sets the current attributes of a file, using DOS system call 0x43 |
_dos_setftime | Sets the date and time that the specified file was last written, using DOS system call 0x57 |
_dos_settime | Sets the system time, using DOS system call 0x2D |
_dos_setvect | Sets a new value for the specified interrupt vector, using DOS system call 0x25 |
_dos_write | Sends output to a file, using DOS system call 0x40 |
_dosexterr | Obtains in-depth error information from DOS system call 0x59 |
_enable | Enables interrupts |
_FP_OFF | Returns offset portion of a far pointer |
_FP_SEG | Returns segment portion of a far pointer |
_harderr | Establishes a hardware error handler |
_hardresume | Returns to DOS after a hardware error |
_hardretn | Returns to the application after a hardware error |
_int86 | Invokes DOS interrupts |
_int86x | Invokes DOS interrupts with segment register values |
_intdos | Invokes DOS system call using registers other than DX and AL |
_intdosx | Invokes DOS system call using registers other than DX and AL with segment register values |
_segread | Returns current values of segment registers |
The _dosexterr function obtains and stores the error information returned by DOS system call 0x59 (extended error handling). This function is provided for use with DOS versions 3.0 and later.
The _bdos routine is useful for invoking DOS calls that use either or both of the DX (DH/DL) and AL registers for arguments. However, _bdos should not be used to invoke system calls that return an error code in AX if the carry flag is set; since your program cannot detect whether the carry flag is set, it cannot determine whether the value in AX is a legitimate value or an error value. In this case, the _intdos routine should be used instead, since it allows the program to detect whether the carry flag is set. The _intdos routine can also be used to invoke DOS calls that use registers other than DX and AL.
The _intdosx routine is similar to the _intdos routine, but is used when ES is required by the system call, when DS must contain a value other than the default data segment (for instance, when a far pointer is used), or when making the system call in a large-model program. When calling _intdosx, give an argument that specifies the segment values to be used in the call.
The _int86 routine can be used to invoke any interrupt. The _int86x routine is similar; however, like the _intdosx routine, it is designed to work with large-model programs and far items, as described in the preceding paragraph.
The _FP_OFF and _FP_SEG routines allow easy access to the segment and offset portions of a far pointer value. _FP_OFF and _FP_SEG are implemented as macros and defined in DOS.H.
The _segread routine returns the current values of the segment registers. This routine is typically used with the _intdosx and _int86x routines to obtain the correct segment values.
The _chain_intr routine is useful for chaining interrupt handlers together. The _enable routine enables interrupts, while the _disable routine disables interrupts.
The routines prefixed with _dos_ are all direct system interfaces that use the system calls noted above. More detailed information on these system calls can be found in the MS-DOS Encyclopedia (Duncan, ed.; Redmond, WA: Microsoft Press, 1988) or the Programmer's PC Sourcebook 2nd ed. (Hogan; Redmond, WA: Microsoft Press, 1991).
Note:
The DOS interface I/O routines are generally incompatible with console, low-level, and stream I/O routines. Do not mix different types of I/O routines in the same source file.