INT 2F U - DRIVER.SYS support - EXECUTE DEVICE DRIVER REQUEST
AX = 0802h
ES:BX -> device driver request header (see below)
Return: request header updated as per requested operation
Notes:  supported by DR-DOS 5.0
DOS 3.2 executes this function on any AL value from 02h through F7h
SeeAlso: AX=0801h,AX=0803h,INT 21/AH=52h,INT 21/AH=99h,INT 21/AH=9Ah

Values for command code:
00h INIT
01h MEDIA CHECK (block devices)
02h BUILD BPB (block devices)
03h IOCTL INPUT
04h INPUT
05h NONDESTRUCTIVE INPUT, NO WAIT (character devices)
06h INPUT STATUS (character devices)
07h INPUT FLUSH (character devices)
08h OUTPUT
09h OUTPUT WITH VERIFY
0Ah OUTPUT STATUS (character devices)
0Bh OUTPUT FLUSH (character devices)
0Ch IOCTL OUTPUT
0Dh (DOS 3+) DEVICE OPEN
0Eh (DOS 3+) DEVICE CLOSE
0Fh (DOS 3+) REMOVABLE MEDIA (block devices)
10h (DOS 3+) OUTPUT UNTIL BUSY (character devices)
11h (European MSDOS 4.0) STOP OUTPUT (console screen drivers only)
12h (European MSDOS 4.0) RESTART OUTPUT (console screen drivers only)
13h (DOS 3.2+) GENERIC IOCTL
14h unused
15h (European MSDOS 4.0) RESET UNCERTAIN MEDIA FLAG
16h unused
17h (DOS 3.2+) GET LOGICAL DEVICE
18h (DOS 3.2+) SET LOGICAL DEVICE
19h (DOS 5.0+) CHECK GENERIC IOCTL SUPPORT
80h (CD-ROM) READ LONG
81h (CD-ROM) reserved
82h (CD-ROM) READ LONG PREFETCH
83h (CD-ROM) SEEK
84h (CD-ROM) PLAY AUDIO
85h (CD-ROM) STOP AUDIO
86h (CD-ROM) WRITE LONG
87h (CD-ROM) WRITE LONG VERIFY
88h (CD-ROM) RESUME AUDIO

Format of device driver request header:
Offset  Size    Description
00h    BYTE    length of request header
01h    BYTE    subunit within device driver
02h    BYTE    command code (see above)
03h    WORD    status (filled in by device driver)
bit 15: error
bits 14-11: reserved
bit 10: ??? set by DOS kernel on entry to some driver calls
bit 9: busy
bit 8: done (may be clear on return under European MSDOS 4.0)
bits 7-0: error code if bit 15 set (see below)
---DOS---
05h  4 BYTEs   reserved (unused in DOS 2.x and 3.x)
09h    DWORD   (European MSDOS 4.0 only) pointer to next request header in
device's request queue
(other versions) reserved (unused in DOS 2.x and 3.x)
---STARLITE architecture---
05h    DWORD   pointer to next request header
09h  4 BYTEs   reserved
---command code 00h---
0Dh    BYTE    (return) number of units
0Eh    DWORD   (call) pointer to DOS device helper function (see below)
(European MSDOS 4.0 only)
(call) pointer past end of memory available to driver (DOS 5.0)
(return) address of first free byte following driver
12h    DWORD   (call) pointer to commandline arguments
(return) pointer to BPB array (block drivers) or
0000h:0000h (character drivers)
16h    BYTE    (DOS 3+) drive number for first unit of block driver (0=A)
---European MSDOS 4.0---
17h    DWORD   pointer to function to save registers on stack
---DOS 5.0---
17h    WORD    (return) error-message flag
0001h MSDOS should display error msg on init failure
---command code 01h---
0Dh    BYTE    media descriptor
0Eh    BYTE    returned status
00h don't know
01h media has not changed
FFh media has been changed
0Fh    DWORD   (return, DOS 3+) pointer to previous volume ID if OPEN/CLOSE/RM
bit in device header is set and disk changed
---command code 02h---
0Dh    BYTE    media descriptor
0Eh    DWORD   transfer address
-> scratch sector if NON-IBM FORMAT bit in device header set
-> first FAT sector otherwise
12h    DWORD   pointer to BPB (set by driver) (see INT 21/AH=53h)
---command codes 03h,0Ch--- (see also INT 21/AX=4402h,INT 21/AX=4403h)
0Dh    BYTE    media descriptor (block devices only)
0Eh    DWORD   transfer address
12h    WORD    (call) number of bytes to read/write
(return) actual number of bytes read or written
---command codes 04h,08h,09h---
0Dh    BYTE    media descriptor (block devices only)
0Eh    DWORD   transfer address
12h    WORD    byte count (character devices) or sector count (block devices)
14h    WORD    starting sector number (block devices only)
16h    DWORD   (DOS 3+) pointer to volume ID if error 0Fh returned
1Ah    DWORD   (DOS 4+) 32-bit starting sector number (block devices with
device attribute word bit 1 set only) (see INT 21/AH=52h)
---command code 05h---
0Dh    BYTE    byte read from device if BUSY bit clear on return
---command codes 06h,07h,0Ah,0Bh,0Dh,0Eh,0Fh---
no further fields
---command code 10h---
0Dh    BYTE    unused
0Eh    DWORD   transfer address
12h    WORD    (call) number of bytes to write
(return) actual number of bytes written
---command codes 11h,12h---
0Dh    BYTE    reserved
---command code 15h---
no further fields
---command codes 13h,19h---
0Dh    BYTE    category code
00h unknown
01h COMn:
03h CON
05h LPTn:
07h mouse (European MSDOS 4.0)
08h disk
9Eh (STARLITE) Media Access Control driver
0Eh    BYTE    function code
00h (STARLITE) MAC Bind request
0Fh    WORD    copy of DS at time of IOCTL call (apparently unused in DOS 3.3)
SI contents (European MSDOS 4.0)
11h    WORD    offset of device driver header
DI contents (European MSDOS 4.0)
13h    DWORD   pointer to parameter block from INT 21/AX=440Ch or AX=440Dh
---command codes 80h,82h---
0Dh    BYTE    addressing mode
00h HSG (default)
01h Phillips/Sony Red Book
0Eh    DWORD   transfer address (ignored for command 82h)
12h    WORD    number of sectors to read
(if 0 for command 82h, request is an advisory seek)
14h    DWORD   starting sector number
logical sector number in HSG mode
frame/second/minute/unused in Red Book mode
(HSG sector = minute * 4500 + second * 75 + frame - 150)
18h    BYTE    data read mode
00h cooked (2048 bytes per frame)
01h raw (2352 bytes per frame, including EDC/ECC)
19h    BYTE    interleave size (number of sectors stored consecutively)
1Ah    BYTE    interleave skip factor (# sectors between consec portions)
---command code 83h---
0Dh    BYTE    addressing mode (see above)
0Eh    DWORD   transfer address (ignored)
12h    WORD    number of sectors to read (ignored)
14h    DWORD   starting sector number (see also above)
---command code 84h---
0Dh    BYTE    addressing mode (see above)
0Eh    DWORD   starting sector number (see also above)
12h    DWORD   number of sectors to play
---command codes 85h,88h---
no further fields
---command codes 86h,87h---
0Dh    BYTE    addressing mode (see above)
0Eh    DWORD   transfer address (ignored in write mode 0)
12h    WORD    number of sectors to write
14h    DWORD   starting sector number (see also above)
18h    BYTE    write mode
00h mode 0 (write all zeros)
01h mode 1 (default) (2048 bytes per sector)
02h mode 2 form 1 (2048 bytes per sector)
03h mode 2 form 2 (2336 bytes per sector)
19h    BYTE    interleave size (number of sectors stored consecutively)
1Ah    BYTE    interleave skip factor (# sectors between consec portions)

Values for error code:
00h write-protect violation
01h unknown unit
02h drive not ready
03h unknown command
04h CRC error
05h bad drive request structure length
06h seek error
07h unknown media
08h sector not found
09h printer out of paper
0Ah write fault
0Bh read fault
0Ch general failure
0Dh reserved
0Eh (CD-ROM) media unavailable
0Fh invalid disk change

Call European MSDOS 4.0 device helper function with:
DL = function
00h "SchedClock" called on each timer tick
AL = tick interval in milliseconds
01h "DevDone" device I/O complete
ES:BX -> request header
Note:   must update status word first; may be called from
an interrupt handler
02h "PullRequest" pull next request from queue
DS:SI -> DWORD pointer to start of device's request queue
Return: ZF clear if pending request
ES:BX -> request header
ZF set if no more requests
03h "PullParticular" remove specific request from queue
DS:SI -> DWORD pointer to start of device's request queue
ES:BX -> request header
Return: ZF set if request header not found
04h "PushRequest" push the request onto the queue
DS:SI -> DWORD pointer to start of device's request queue
ES:BX -> request header
interrupts disabled
05h "ConsInputFilter" keyboard input check
AX = character (high byte 00h if PC ASCII character)
Return: ZF set if character should be discarded
ZF clear if character should be handled normally
Note:   called by keyboard interrupt handler so DOS can scan
for special input characters
06h "SortRequest" push request in sorted order by starting sector
DS:SI -> DWORD pointer to start of device's request queue
ES:BX -> request header
interrupts disabled
07h "SigEvent" send signal on keyboard event
AH = event identifier
Return: AL,FLAGS destroyed
09h "ProcBlock" block on event
AX:BX = event identifier (typically a pointer)
CX = timeout in ms or 0000h for never
DH = interruptible flag (nonzero if pause may be interrupted)
interrupts disabled
Return: after corresponding ProcRun call
CF clear if event wakeup, set if unusual wakeup
ZF set if timeout wakeup, clear if interrupted
AL = wakeup code, nonzero if unusual wakeup
interrupts enabled
BX,CX,DX destroyed
Note:   block process and schedules another to run
0Ah "ProcRun" unblock process
AX:BX = event identifier (typically a pointer)
Return: AX = number of processes awakened
ZF set if no processes awakened
BX,CX,DX destroyed
0Bh "QueueInit" initialize/clear character queue
DS:BX -> character queue structure (see below)
Note:   the queue size field must be set before calling
0Dh "QueueWrite" put a character in the queue
DS:BX -> character queue (see below)
AL = character to append to end of queue
Return: ZF set if queue is full
ZF clear if character stored
0Eh "QueueRead" get a character from the queue
DS:BX -> character queue (see below)
Return: ZF set if queue is empty
ZF clear if characters in queue
AL = first character in queue
10h "GetDOSVar" return pointer to DOS variable
AL = index of variable
03h current process ID
BX = index into variable if AL specifies an array
CX = expected length of variable
Return: CF clear if successful
DX:AX -> variable
CF set on error
AX,DX destroyed
BX,CX destroyed
Note:   the variables may not be modified
14h "Yield" yield CPU if higher-priority task ready to run
Return: FLAGS destroyed
1Bh "CritEnter" begin system critical section
DS:BX -> semaphore (6 BYTEs, initialized to zero)
Return: AX,BX,CX,DX destroyed
1Ch "CritLeave" end system critical section
DS:BX -> semaphore (6 BYTEs, initialized to zero)
Return: AX,BX,CX,DX destroyed
Note:   must be called in the context of the process which
called CritEnter on the semaphore
Note:   the DWORD pointing at the request queue must be allocated by the driver
and initialized to 0000h:0000h.  It always points at the next request
to be executed

Format of character queue:
Offset  Size    Description
00h    WORD    size of queue in bytes
02h    WORD    index of next character out
04h    WORD    count of characters in the queue
06h  N BYTEs   queue buffer

See also: 2F0800

2F0802 - DRIVER.SYS support - EXECUTE DEVICE DRIVER REQUEST