[Front]
[Prev Chapter]
[Next Chapter]
DR-DOS supports the interrupts listed in Table 3-1.
|
DOS Interrupt |
Description |
|
20H |
Program Terminate |
|
21H |
DOS Function Request |
|
22H |
Terminate Address |
|
23H |
Ctrl-Break Exit Handler Vector |
|
24H |
Critical Error Handler Vector |
|
25H |
Absolute Disk Read |
|
26H |
Absolute Disk Write |
|
27H |
Terminate and Stay Resident |
|
2FH |
Multiplex Interrupt |
Issuing INT 20H restores the terminate (INT 22), Ctrl-Break (INT 23), and critical error handler address (INT 24) fields in the interrupt table to the values they contained when the current program was loaded.
DR-DOS flushes all file buffers in response to an INT 20H instruction. If any file that has changed in length is not closed prior to an INT 20H, the directory entries for its length, date, and time will not be correctly recorded (see the Close File (10H) and Close a File Handle (3EH) calls in Chapter 4, DR-DOS System Calls). If you want your program to pass an error or completion code before terminating, use Terminate a Process (4CH).
Section 2.1 in Chapter 2, DR-DOS System Call Parameters, describes how to use INT 21H to invoke a system call, and Chapter 4 describes the individual system calls.
This interrupt location contains the address to which DR-DOS transfers control when the current program terminates.
DR-DOS copies this address into offset 0AH of the programs Program Segment Prefix when the segment is created.
DR-DOS executes Interrupt 23H when the user enters Ctrl-Break during standard I/O or standard printer or asynchronous communications operations. If a user enters Ctrl-Break when the current state of Ctrl-Break checking is on (see Ctrl-Break Check (33H) system call), DR-DOS issues Interrupt 23H on the next system call.
If your Ctrl-Break routine saves all registers, it can continue program execution by ending with an interrupt return instruction (IRET). DR-DOS places no restrictions on the routine, including its use of DOS calls, when the registers are saved before it issues an IRET. If your interrupt routine returns with a long return, the Carry flag determines whether the program will continue to execute. When the flag is set, the program will end; otherwise, it will continue as with an IRET.
If Ctrl-Break interrupts system calls Print String (09H), or Buffered Keyboard Input (0AH), DR-DOS outputs a Ctrl-C, carriage-return, and linefeed. I/O then continues from the start of the new line if program execution is allowed to continue with an IRET. When the interrupt is issued, all registers are returned to the values they contained during the original DOS system call.
DR-DOS transfers control to Interrupt 24H when a critical error occurs during the execution of a DOS program. BP:SI is set to point to the Device Header Control Block, which provides additional information. See Figure 6-1 for full details of the Device Header Control Block. INT 24H sets the registers so that if an IRET is executed, DR-DOS responds according to one of the following values in AL:
0 = ignore the error
1 = retry the operation that resulted in the error
2 = terminate application
DR-DOS will not take an INT 24H exit for disk errors that occur during an INT 25H or 26H. It takes an INT 24H exit only when the disk error is the result of an INT 21H system call.
Bit 7 (high-order) of register AH equal to zero indicates a disk error. When AH bit 7 = 0, register AL contains the number of the drive on which the error occurred (0 corresponds to drive A). Bits 0 through 2 of AH indicate which operation was in effect and the area of the disk involved in the error. Bits 3 through 5 of AH indicate valid responses to the disk error. Table 3-2 lists the values assigned to these bits.
If the Critical Error handler returns an invalid response, then a default response is assumed, as shown below:
|
Invalid Response |
Default Response |
|
Ignore |
Fail |
|
Retry |
Fail |
|
Fail |
Terminate |
DR-DOS sets all registers to retry the operation and passes an error code in the low-order byte of register DI. The high-order byte of DI is undefined. Table 3-3 lists these error codes.
|
Value of DI (Low-order) |
Error |
|
00H |
Attempted write on protecteddiskette |
|
01H |
Unit unknown |
|
02H |
Drive not ready |
|
03H |
Command unknown |
|
04H |
CRC error |
|
05H |
Bad request structure length |
|
06H |
Seek error |
|
07H |
Media type unknown |
|
08H |
Sector not found |
|
09H |
Printer out of paper |
|
0AH |
Write failure |
|
0BH |
Read failure |
|
0CH |
General failure |
DR-DOS places the information shown in Figure 3-1 on the user stack.

Figure 3-1
User Stack at INT 24H
|
Interrupt 25H | ||
|
Absolute Disk Read | ||
|
Entry Parameters: | ||
|
Register AL: |
Drive number | |
|
CX: |
Number of sectors to read | |
|
DX: |
Beginning logical sector number | |
|
DS: |
Transfer address - Segment | |
|
BX |
Transfer address - Offset | |
|
Returned Values: | ||
|
Register AX: |
Error code, if Carry flag is set | |
INT 25H transfers data from a specified location on disk to memory. On entry, register CX specifies the number of sectors to be read from disk, starting at the logical sector number contained in register DX. Logical sector numbers are calculated from the start of the logical disk (this may also be the start of the physical disk, but not necessarily so). Numbering continues through the sectors on the same track, then sectors on the other tracks of the head, then the other heads. Sectors with consecutive logical sector numbers may not be adjacent on the disk if the disk uses sector interleaving.
If the transfer is successful, the Carry flag is set to zero on return. If the transfer failed the Carry flag is set to 1, and AX contains an error codes. The code returned in AL is one of those listed in Table 3-3. The code returned in AH is one of those listed in Table 3-4.
On return, only the segment registers are preserved by this call. DR-DOS returns to the caller with a Far Return instruction so the original flags remain on the stack and must be explicitly popped off.

Figure 3-2
Packet for Absolute Disk Read
Either the original format or the extended format may be used to address partitions smaller than 32Mb.
|
AH Value |
Error |
|
002 |
General error |
|
03H |
Attempted write on protected diskette |
|
04H |
Sector not found |
|
08H |
Bad CRC on read |
|
40H |
SEEK failed |
|
80H |
Attachment failed to respond |
Absolute Disk Write transfers data from memory to a specified location on disk. Like Absolute Disk Read (INT 25H), it uses a logical sector number to specify the disk location. The extended format described for INT 25H is also available for INT 26H. Return values are also handled in the same way. See Table 3-4 for error code definitions.
Issuing Interrupt 27H allows programs of less than 64K bytes to remain resident when the DR-DOS command processor regains control from the program. Programs that terminate but remain resident do not close files before returning control to DR-DOS. To improve the use of memory a program should call Free Allocated Memory (49H) with ES set to the segment contained in the word at offset 2CH of the PSP, before terminating with INT 27H. This de-allocates the block of memory containing the copy of the environment. Function call Keep Process (31H) allows the program to pass a completion code which can be interpreted within a batch file.
The INT 22H, INT 23H and INT 24H fields of the Interrupt table are restored to the values they contained when the program was loaded into the PSP. For this reason this method cannot be used to install a permanently resident Ctrl-Break or critical error handler routine.
Note that whenever possible Keep Process (31H) should be used instead of INT 27H to keep the program resident. INT 27H cannot be used for programs larger than 64K bytes, or by .EXE programs that are loaded into high memory.
INT 2FH is a general-purpose interrupt. The function performed is determined by the value passed in register AH. You may add functions by saving the contents of the INT 2FH vector and installing your own INT 2FH handler. Any additional function should check for its specific function code, perform its function if indicated, and then return; otherwise, if there is no specific function code, it should pass control to the saved interrupt handler entry point.
Function codes 0 to 7F Hex are reserved for internal use. One function, the PRINT spooler function, is available for general use.
INT 2FH PRINT spooler function (AH = 1)
Requests to the resident PRINT spooler allow files to be added to or removed from the spool queue, and enable the spool queue to be read.
|
Print Request Add File to Spool Queue | ||
|
Entry Parameters: | ||
|
Register AL: |
1 | |
|
Register DS:DX |
Request data address - offset 0 = 0 offset 1 = doubleword pointer (offset & segment) to null-terminated ASCII file specification. Wildcards are not allowed in the file specification. | |
|
Returned Values: | ||
|
Register AX: |
Error code if Carry flag set | |
|
Print Request Remove File from Spool Queue | ||
|
Entry Parameters: | ||
|
Register AL: |
2 | |
|
Register DS:DX |
Null-terminated ASCII file specification, which may contain wildcard characters. | |
|
Returned Values: | ||
|
Register AX: |
Error code if Carry flag set | |
|
Print Request Remove All Files from Spool Queue (includes the file that is currently printing) | ||
|
Entry Parameters: | ||
|
Register AL: |
3 | |
|
Returned Values: | ||
|
Register AX: |
Error code if Carry flag set | |
|
Print Request Lock Spool Queue so it can be Read | ||
|
Entry Parameters: | ||
|
Register AL: |
4 | |
|
Returned Values: | ||
|
Register AX: |
Error code if Carry flag set | |
|
DX: |
Count of print device errors since last successful output (if non-zero this normally indicates that the printer is off-line or out of paper) | |
|
DS:SI: |
Spool queue - consists of a list of entries each 64 bytes long, containing a null-terminated file specification. The end of the queue is indicated by an entry with a null character in the first byte. | |
|
Print Request Unlock Spool Queue | ||
|
Entry Parameters: | ||
|
Register AL: |
5 | |
|
Returned Values: | ||
|
None | ||
Request types 1 to 4 return Carry flag clear if there was no error. If the Carry flag is set, register AX contains the error codes shown in Table 3-5.
|
AX Value |
Meaning |
|
1 |
Invalid request code |
|
2 |
File not found |
|
3 |
Path not found |
|
4 |
No file handles available(too many open files) |
|
6 |
File could not be opened |
|
8 |
Spool queue full |
|
9 |
Spool queue is locked |
|
12 |
Filename too long (maximum is |
|
15 |
Drive invalid |
[Front] [Prev Chapter] [Next Chapter]