Category : Recently Uploaded Files
Archive   : INFOPACK.ZIP
Filename : DEVICE.RTF

 
Output of file : DEVICE.RTF contained in archive : INFOPACK.ZIP
{\rtf1\ansi \deff0{\fonttbl{\f0\froman Tms Rmn;}{\f1\fdecor Symbol;}{\f2\fswiss Helv;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;
\red255\green255\blue0;\red255\green255\blue255;}{\stylesheet{\s242\tqc\tx4320\tqr\tx8640 \fs20 \sbasedon0\snext242 footer;}{\s243\tqc\tx4320\tqr\tx8640 \fs20 \sbasedon0\snext243 header;}{\fs20 \snext0 Normal;}}{\info
{\title Microsoft MS-DOS CD-ROM Extensions}{\subject Hardware-Dependent Device Driver Specification}{\author Michael Edwards}{\doccomm Includes changes to audio section for v2.20.}{\operator Michael Edwards}{\creatim\yr1990\mo8\dy16\hr13\min44}
{\revtim\yr1990\mo8\dy16\hr13\min44}{\printim\yr1990\mo8\dy23\hr12\min25}{\version2}{\edmins139}{\nofpages32}{\nofwords73217}{\nofchars32770}{\vern8351}}\sectd \linex0\headery864\titlepg {\header \pard\plain \qr\sl240 \fs20 {\b\f2\fs16
MSCDEX - Microsoft MS-DOS CD-ROM Extensions Version 2.20
\par }\pard \sl240 {\plain \b\f2
\par }}{\footer \pard\plain \qr\sl240 \fs20 {\b\f2\fs16 Device Driver Specification - Copyright (C) Microsoft Corp. 1989, 1990. All rights reserved - page }{\field{\*\fldinst {\b\f2\fs16 page}}{\fldrslt {\b\f2\fs16 30}}}{\b\f2\fs16
\par }\pard \sl240 {\f2
\par }}{\headerf \pard\plain \qc\sl240 \fs20 {\b\f2\fs28 Microsoft MS-DOS CD-ROM Extensions
\par Hardware-Dependent Device Driver Specification
\par 15 August, 1990
\par
\par }}{\footerf \pard\plain \qr\sl240 \fs20 {\b\f2\fs16 Device Driver Specification - Copyright (C) Microsoft Corp. 1989, 1990. All rights reserved - page }{\field{\*\fldinst {\b\f2\fs16 page}}{\fldrslt {\b\f2\fs16 1}}}{\b\f2\fs16
\par }\pard \sl240 {\f2
\par }}\pard\plain \qj\sl240 \fs20 {\fs22
This document (Document Number: 000080010-100-O00-1186) describes the CD-ROM hardware-dependent device driver and its interface with MSCDEX.EXE, the MS-DOS CD-ROM Extensions resident program. Differences between CD-ROM drives and hard- or floppy-disk driv
es account for the differences in this device driver specification from the normal MS-DOS block and character device driver specification. The chapters on device drivers in the MS-DOS Programmer's Reference Manual (MS-PRM) provide more information.
\par
\par The MS-DOS operating system reads CONFIG.SYS and installs the device. MSCDEX.EXE performs an open system call on the device driver name in order to communicate with it and uses an IOCTL call to ask the device driver for the address of its device header. F
rom the device header address, MSCDEX.EXE locates the device driver's interrupt and strategy routines. After that, all requests the device driver receives come directly fro
m MSCDEX.EXE, not MS-DOS. To avoid reentrancy problems and allow MSCDEX to monitor all media changes, all other applications that wish to communicate directly with CD-ROM device drivers should do so through the }{\i\fs22 Send Device Driver Request}{\fs22
INT 2Fh function 10h. MSCDEX.EXE interfaces with MS-DOS so that normal requests for I/O with files on a CD-ROM drive down to the MS-DOS INT 21h service layer will work just as they would for a normal MS-DOS device.
\par
\par }{\plain \b Installation}{\b
\par }{\b\fs22
\par }\pard \sl240 {\fs22 The device driver will be installed in the same way as any other device with an entry in CONFIG.SYS. The syntax is:
\par
\par }{\f2\fs22 \tab DEVICE=<}{\i\f2\fs22 filename}{\f2\fs22 > /D:<}{\i\f2\fs22 device_name}{\f2\fs22 > /N:
\par }{\fs22
\par The following are examples:
\par
\par }{\f2\fs22 \tab DEVICE=HITACHI.SYS /D:MSCD001 /D:MSCD002
\par \tab DEVICE=SONY.SYS /D:MSCD003 /N:2
\par }{\fs22
\par }\pard \qj\sl240 {\fs22 The arguments will be the character device names that will be used on the command line when starting MSCDEX.EXE so that it can find and communicate with the device driver.
\par
\par A device driver may support one or more physical drives or logical disks. This may be done by having multiple device headers in the device driver file (in which case it will be necessary to have more than one }{\i\fs22 device_name}{\fs22
on the command line - one for each device header; see the HITACHI.SYS example above) or through the use of subunits. Each disk handled by a device driver that supports multiple disks using subunits is addressed by the subunit field of the request header
when a request is made for that disk.
A device driver that supports more than one disk can share code and data instead of requiring separate device drivers for each disk. A "jukebox" CD-ROM system would be an example of a CD-ROM device that might wish to support more than one drive or a disk
pack using a single device driver.
\par
\par \page Device drivers that use multiple subunits should use the optional switch /n: to say how many drives are present. If not present, the default number of drives is 1. If the driver can tell how many dri
ves are installed without a command line switch, then this argument is not necessary. Unless there are special considerations, it is better practice to support multiple drives using subunits than to have multiple device headers in the same device driver f
ile.
\par }\page {\plain \b Device header}{\b
\par }{\b\fs22
\par }{\fs22 The device header is an extension to what is described in the MS-PRM.
\par }\pard \sl240 {\fs22 ________________
\par
\par DevHdr\tab \tab DD\tab -1\tab \tab ; Ptr to next driver in file or -1 if last driver
\par \tab \tab DW\tab ?\tab \tab ; Device attributes
\par \tab \tab DW\tab ?\tab \tab ; Device strategy entry point
\par \tab \tab DW\tab ?\tab \tab ; Device interrupt entry point
\par \tab \tab DB\tab 8 dup (?)\tab ; Character device name field
\par \tab \tab DW\tab 0\tab \tab ; Reserved
\par \tab \tab DB\tab 0\tab \tab ; Drive letter
\par \tab \tab DB\tab ?\tab \tab ; Number of units
\par ________________
\par
\par The following are the device attributes for MSCDEX.EXE device drivers:
\par
\par \tab Bit 15\tab \tab 1 - Character device
\par \tab Bit 14\tab \tab 1 - IOCTL supported
\par \tab Bit 13\tab \tab 0 - Output 'till busy
\par \tab Bit 12\tab \tab 0 - Reserved
\par \tab Bit 11\tab \tab 1 - OPEN/CLOSE/RM supported
\par \tab Bit 10-4\tab 0 - Reserved
\par \tab Bit 3\tab \tab 0 - Dev is CLOCK
\par \tab Bit 2\tab \tab 0 - Dev is NUL
\par \tab Bit 1\tab \tab 0 - Dev is STO
\par \tab Bit 0\tab \tab 0 - Dev is STI
\par
\par }\pard \qj\sl240 {\fs22 MSCDEX.EXE device drivers will be character devices that understand IOCTL calls and handle OPEN/CLOSE/RM calls.
\par
\par The drive letter field is a read-only field for the device driver and is initialized to 0. The field is for MSCDEX.EXE to use when it assigns the device driver to a drive letter (A = 1, B = 2...Z = 26). It should never be modified by the device driver. Fo
r drivers that support more than one unit, the drive lette
r will indicate the first unit, and each successive unit is assigned the next higher drive letter. For example, if the device driver has four units defined (0-3), it requires four drive letters. The position of the driver in the list of all drivers determ
ines which units correspond to which drive letters. If driver ALPHA is the first driver in the device list, and it defines 4 units (0-3), they will be A, B, C, and D. If BETA is the second driver and defines three units (0-2), they will be E, F, and G, an
d
so on. The theoretical limit to the number of drive letters is 63, but it should be noted that the device installation code will not allow the installation of a device if it would result in a drive letter > 'Z' (5Ah). All block device drivers present in t
he standard resident BIOS will be placed ahead of installable device drivers in the list.
\par
\par NOTE: It is important that one set }{\i\fs22 lastdrive= in CONFIG.SYS to accommodate the additional drive letters that CD-ROM device drivers will require.
\par }
\par \page {\fs22 The num
ber-of-units field is set by the device driver to the number of disks that are supported. Normal character devices do not support more than one unit and MS-DOS does not expect a character device to handle more than one unit or have a nonzero subunit value
in the request header. Since these device drivers are not called by MS-DOS directly, this is not a problem. Nonetheless, the number of units returned by the device driver in the number-of-units field during the INIT call must be 0, since MS-DOS makes the
INIT call and does not expect a nonzero value for a character device. MSCDEX.EXE will never see what is returned anyway, and relies on the number-of-units field in the device header.
\par
\par The signature field is necessary for MSCDEX confirmation that the device driver is a valid cd-rom device driver and consists of the 4 bytes 'MSCD' followed by two ascii digits for the version which is '00' at present.
\par }\pard \sl240 {\fs22
\par Sample device header:
\par ________________
\par
\par HsgDrv\tab \tab DD\tab -1\tab \tab \tab ; Pointer to next device
\par \tab \tab DW\tab 0c800h\tab \tab \tab ; Device attributes
\par \tab \tab DW\tab STRATEGY\tab \tab ; Pointer to device strategy routine
\par \tab \tab DW\tab DEVINT \tab \tab ; Pointer to device interrupt routine
\par \tab \tab DB\tab 'MSCD003 '\tab \tab ; 8-byte character device name field
\par \tab \tab DW\tab 0\tab \tab \tab ; Reserved (must be zero)
\par \tab \tab DB\tab 0\tab \tab \tab ; Drive letter (must be zero)
\par \tab \tab DB\tab 1\tab \tab \tab ; Number of units supported (one or more)
\par ________________
\par
\par }\pard \qj\sl240 {\fs22
As with other MS-DOS device drivers, the code originates at offset 0, not 100H. The first device header will be at offset 0 of the code segment. The pointer to the next driver is a double word field (offset/segment) that is the address of the next device
driver in the list, or -1 if the device header is the only one or the last in the list. The strategy and interrupt entry points are word fields and must be offsets into the same segment as the device header. The device driver is expected to overwrite the
name(s) in each of its one or more device headers with the <}{\i\fs22 device_name}{\fs22 > command line arguments during its initialization.
\par
\par MSCDEX.EXE will call the device driver in the following manner:
\par
\par }\pard \qj\fi-288\li1008\sl240 {\fs22 1. MSCDEX.EXE makes a far call to the strategy entry.
\par
\par 2. MSCDEX.EXE passes device driver information in a request header to the strategy routine.
\par
\par }\pard \li720\sl240 {\fs22 3. MSCDEX.EXE makes a far call to the interrupt entry.
\par }\pard \sl240 \page {\plain \b Request header}{\b
\par }{\b\fs22
\par }\pard \qj\sl240 {\fs22 MSCDEX.EXE will call the device's strategy routine with the address of a request header in ES:BX. The format of the request header is the same as what is described in the MS-PRM.
\par }\pard \sl240 {\fs22 ________________
\par
\par ReqHdr\tab \tab DB\tab ?\tab \tab ; Length in bytes of request header
\par \tab \tab DB\tab ?\tab \tab ; Subunit code for minor devices
\par \tab \tab DB\tab ?\tab \tab ; Command code field
\par \tab \tab DW\tab ?\tab \tab ; Status
\par \tab \tab DB\tab 8 dup (?)\tab ; Reserved
\par ________________
\par
\par }{\b\fs22 Status
\par
\par }\pard \qj\sl240 {\fs22 The status word also has the same format as described in the MS-PRM. It is 0 on entry and is set by the device driver.
\par }\pard \sl240 {\fs22
\par \tab Bit 15\tab \tab - Error bit
\par \tab Bit 14-10\tab - Reserved
\par \tab Bit 9\tab \tab - Busy
\par \tab Bit 8\tab \tab - Done
\par \tab Bit 7-0\tab \tab - Error code (bit 15 on)
\par
\par }\pard \qj\sl240 {\fs22 Bit 15, the error bit, is set by the device driver if an error is detected or if an invalid request is made to the driver. The low 8 bits indicate the error code.
\par
\par Bit 9, the busy bit, should be set by the device driver when the drive is in audio play mode. Device dr
ivers should fail all requests to the physical device that require head movement when the device is playing and return the request with this bit and the error bit set and an error code. Requests that would not interrupt audio play may return without error
but will also have this bit set when the drive is in audio play mode. Play mode can be terminated prematurely with a reset or STOP AUDIO request and a new request can be made at that point. Monitoring this bit in each successive request, an Audio Q-Chann
el Info IOCTL for example, will tell when play mode is complete.
\par
\par Bit 8, the done bit, is set by the device driver when the operation is finished.
\par }\pard \sl240 \page {\fs22 Error codes are the following:
\par
\par \tab 0\tab Write-protect violation
\par \tab 1\tab Unknown unit
\par \tab 2\tab Drive not ready
\par \tab 3\tab Unknown command
\par \tab 4\tab CRC error
\par \tab 5\tab Bad drive request structure length
\par \tab 6\tab Seek error
\par \tab 7\tab Unknown media
\par \tab 8\tab Sector not found
\par \tab 9\tab Printer out of paper
\par \tab A\tab Write fault
\par \tab B\tab Read fault
\par \tab C\tab General failure
\par \tab D\tab Reserved
\par \tab E\tab Reserved
\par \tab F\tab Invalid disk change
\par }{\plain \b \page Command code field}{\b
\par }{\b\fs22
\par }{\fs22 The following values are valid command codes:
\par
\par *\tab 0\tab INIT
\par \tab 1\tab MEDIA CHECK (block devices)
\par \tab 2\tab BUILD BPB (block devices)
\par *\tab 3\tab IOCTL INPUT
\par \tab 4\tab INPUT (read)
\par \tab 5\tab NONDESTRUCTIVE INPUT NO WAIT
\par \tab 6\tab INPUT STATUS
\par *\tab 7\tab INPUT FLUSH
\par \tab 8\tab OUTPUT (write)
\par \tab 9\tab OUTPUT WITH VERIFY
\par \tab 10\tab OUTPUT STATUS
\par #\tab 11\tab OUTPUT FLUSH
\par *\tab 12\tab IOCTL OUTPUT
\par *\tab 13\tab DEVICE OPEN
\par *\tab 14\tab DEVICE CLOSE
\par \tab 15\tab REMOVABLE MEDIA (block devices)
\par \tab 16\tab OUTPUT UNTIL BUSY
\par *\tab 128\tab READ LONG\tab \tab \tab \tab (NEW)
\par \tab 129\tab Reserved
\par *\tab 130\tab READ LONG PREFETCH\tab \tab (NEW)
\par *\tab 131\tab SEEK\tab \tab \tab \tab \tab (NEW)
\par +\tab 132\tab PLAY AUDIO\tab \tab \tab \tab (NEW)
\par +\tab 133\tab STOP AUDIO\tab \tab \tab \tab (NEW)
\par #\tab 134\tab WRITE LONG\tab \tab \tab \tab (NEW)
\par #\tab 135\tab WRITE LONG VERIFY\tab \tab (NEW)
\par +\tab 136\tab RESUME AUDIO\tab \tab \tab (NEW)
\par
\par
\par * Supported by a basic CD-ROM device driver (required)
\par + Supported by an extended CD-ROM device driver
\par # Supported by erasable CD-ROM device drivers for authoring systems
\par }\pard \qj\sl240 {\fs22
\par Unsupported or illegal commands will set the error bit and return the error code for }{\i\fs22 Unknown Command}{\fs22 . This includes command codes 1, 2, 4, 5, 6, 8, 9, 10, 15, 16, and 129; and 11, 134 and 135 for systems that do not support writing.

\par
\par If, in the time since the last request to that device driver unit, the media has changed, the device driver will return the error code for invalid disk change and set the error bit. MSCDEX.EXE will then decide whether to retry the request or abort it.

\par
\par The minimal CD-ROM device driver will read cooked Mode 1 data sectors using HSG addressing mode and return appropriate values for the IOCTL calls. Most other features enhance performance or add useful capabilities.
\par }\pard \sl240 \page {\plain \b INIT}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 0
\par ES:BX = INIT
\par ________________
\par
\par INIT\tab \tab DB\tab 13 dup (0)\tab ; Request header
\par \tab \tab DB\tab 0\tab \tab ; Number of units (must be 0)
\par \tab \tab DD\tab ?\tab \tab ; End address
\par \tab \tab DD\tab ?\tab \tab ; Ptr to BPB array
\par \tab \tab DB\tab 0\tab \tab ; Block device number
\par ________________
\par
\par }\pard \qj\sl240 {\fs22
This call is made only once, when the device is installed. INIT and a single IOCTL call for the device header address are the only device driver calls that come directly from MS-DOS. Because the INIT function is called from MS-DOS, the number of units ret
urned is 0, as for normal MS-DOS character devices. MSCDEX.EXE will get the number of units supported from the device header.
\par
\par The device must return the END ADDRESS, which is a DWORD pointer to the end of the portion of the device driver to remain reside
nt. Code and data following the pointer is used for initialization and then discarded. If there are multiple device drivers in a single file, the ending address returned by the last INIT call will be the one that MS-DOS uses, but it is recommended that al
l the device drivers in the file return the same address. The code to remain resident for all the devices in a single file should be grouped together low in memory with the initialization code for all devices following it in memory.
\par
\par The pointer to BPB ar
ray points to the character after the "=" on the line in CONFIG.SYS that caused this device driver to be loaded. This data is read-only and allows the device driver to scan the invocation line for parameters. This line is terminated by a carriage return o
r a line feed.
\par During initialization, the device driver must set the device name field in the device header to the argument provided on the invocation line in CONFIG.SYS. The device driver must also check that the }{\i\fs22 device_name}{\fs22
command line argument is a legal 8-character filename and pad it out to 8 characters with spaces (20H) when copying it to the device name field.
\par
\par The block device number and number of units are both 0 for character devices.
\par }\pard \sl240 \page {\plain \b READ (IOCTL Input)}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 3
\par ES:BX = IOCTLI
\par ________________
\par
\par IOCTLI\tab DB\tab 13 dup (0)\tab ; Request header
\par \tab \tab DB\tab 0\tab \tab ; Media descriptor byte from BPB
\par \tab \tab DD\tab ?\tab \tab ; Transfer address
\par \tab \tab DW\tab ?\tab \tab ; Number of bytes to transfer
\par \tab \tab DW\tab 0\tab \tab ; Starting sector number
\par \tab \tab DD\tab 0\tab \tab ; DWORD ptr to requested vol
\par \tab \tab \tab \tab \tab ; ID if error 0FH
\par ________________
\par
\par }\pard \qj\sl240 {\fs22 The media descriptor byte, starting sector number, and volume ID fields are all 0.
\par
\par The transfer address points to a control block that is used to communicate with the device driver. The first byte of the control block determines the request that is being made. If the command code is reserved or the function not supported, then the devic
e driver will return the error code for }{\i\fs22 Unknown Command}{\fs22 . If, for some reason, the device driver is not able to process the request at that time, it will return the error code for }{\i\fs22 Drive Not Ready}{\fs22 .
\par }\pard \sl240 {\fs22
\par \tab }{\fs22\ul Code\tab Number of bytes to transfer\tab Function
\par
\par }{\fs22 \tab 0\tab 5\tab \tab \tab \tab Return Address of Device Header
\par \tab 1\tab 6\tab \tab \tab \tab Location of Head
\par \tab 2\tab ?\tab \tab \tab \tab Reserved
\par \tab 3\tab ?\tab \tab \tab \tab Error Statistics
\par \tab 4\tab 9\tab \tab \tab \tab Audio Channel Info
\par \tab 5\tab 130\tab \tab \tab \tab Read Drive Bytes
\par \tab 6\tab 5\tab \tab \tab \tab Device Status
\par \tab 7\tab 4\tab \tab \tab \tab Return Sector Size
\par \tab 8\tab 5\tab \tab \tab \tab Return Volume Size
\par \tab 9\tab 2\tab \tab \tab \tab Media Changed
\par \tab 10\tab 7\tab \tab \tab \tab Audio Disk Info
\par \tab 11\tab 7\tab \tab \tab \tab Audio Track Info
\par \tab 12\tab 11\tab \tab \tab \tab Audio Q-Channel Info
\par \tab 13\tab 13\tab \tab \tab \tab Audio Sub-Channel Info
\par \tab 14\tab 11\tab \tab \tab \tab UPC Code
\par \tab 15\tab 11\tab \tab \tab \tab Audio Status Info
\par \tab 16-255\tab ?\tab \tab \tab \tab Reserved
\par }\page {\fs22
\par }{\b\i\fs22 - Return Address of Device Header
\par }{\fs22 ________________
\par
\par Raddr\tab \tab DB\tab 0\tab \tab ; Control block code
\par \tab \tab DD\tab ?\tab \tab ; Address of device header
\par ________________
\par }{\i\fs22
\par }\pard \qj\li720\sl240 {\fs22 The device driver will fill the 4-byte field with the address of its device header. This is used by MSCDEX.EXE to locate the device driver's strategy and interrupt routines.
\par
\par }\pard \sl240 {\b\i\fs22 - Location of Head
\par }{\fs22 ________________
\par
\par LocHead\tab DB\tab 1\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; Addressing mode
\par \tab \tab DD\tab ?\tab \tab ; Location of drive head
\par ________________
\par }{\i\fs22
\par }\pard \qj\li720\sl240 {\fs22 The device driver will return a 4-byte address that indicates where the head is located. The value will be interpreted based on the addressing mode. (See function READ LONG for more information about addressing modes.)
\par
\par NOTE: the drive could provide this information by monitoring the Q-channel on the disk.
\par }\pard \sl240 {\fs22
\par }{\b\i\fs22 - Error Statistics
\par }{\fs22 ________________
\par
\par ErrStat\tab \tab DB\tab 3\tab \tab ; Control block code
\par \tab \tab DB\tab N dup (?)\tab ; Error statistics
\par ________________
\par }{\b\fs22
\par }\pard \qj\li720\sl240 {\fs22 The format of the Error Statistics is not yet defined.
\par }\pard \sl240 {\fs22
\par }{\b\i\fs22 \page - Audio Channel Info
\par }{\fs22 ________________
\par
\par AudInfo\tab DB\tab 4\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; Input channel (0, 1, 2, or 3) for output channel 0
\par \tab \tab DB\tab ?\tab \tab ; Volume control (0 - 0xff) for output channel 0
\par \tab \tab DB\tab ?\tab \tab ; Input channel (0, 1, 2, or 3) for output channel 1
\par \tab \tab DB\tab ?\tab \tab ; Volume control (0 - 0xff) for output channel 1
\par \tab \tab DB\tab ?\tab \tab ; Input channel (0, 1, 2, or 3) for output channel 2
\par \tab \tab DB\tab ?\tab \tab ; Volume control (0 - 0xff) for output channel 2
\par \tab \tab DB\tab ?\tab \tab ; Input channel (0, 1, 2, or 3) for output channel 3
\par \tab \tab DB\tab ?\tab \tab ; Volume control (0 - 0xff) for output channel 3
\par ________________
\par
\par }\pard \qj\li720\sl240 {\fs22
This function returns the present settings of the audio channel control set with the Audio Channel Control Ioctl Write function. The default settings for the audio channel control are for each input channel to be assigned to its corresponding output chann
el (0 to 0, 1 to 1, etc.) and for the volume control on each channel is set at 0xff.
\par
\par }\pard \sl240 {\b\i\fs22 - Read Drive Bytes
\par }{\fs22 ________________
\par
\par DrvBytes\tab DB\tab 5\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; Number bytes read
\par \tab \tab DB\tab 128 dup (?)\tab ; Read buffer
\par ________________
\par }{\b\i\fs22
\par }\pard \qj\li720\sl240 {\fs22
Data returned from the CD-ROM drive itself can be read using this function. The number-bytes-read field returns the length of the number of bytes read, which will not exceed 128 per call. If more than this needs to be returned, the call will be repeated u
ntil the number returned is less than 128.
\par
\par The function and content of these bytes are entirely device and device driver dependent. This function is provided to allow access to device-specific features that are not addressed under any other portion of the device driver spec.
\par }\pard \sl240 {\fs22
\par }{\b\i\fs22 \page - Device Status
\par }{\fs22 ________________
\par
\par DevStat\tab \tab DB\tab 6\tab \tab ; Control block code
\par \tab \tab DD\tab ?\tab \tab ; Device parameters
\par ________________
\par
\par }\pard \li720\sl240 {\fs22 The device driver will return a 32-bit value. Bit 0 is the least significant bit. The bits are interpreted as follows:
\par }\pard \sl240 {\fs22
\par }\pard \li720\sl240 {\fs22 Bit 0\tab \tab 0\tab Door closed
\par \tab \tab 1\tab Door open
\par Bit 1\tab \tab 0\tab Door locked
\par \tab \tab 1\tab Door unlocked
\par Bit 2\tab \tab 0\tab Supports only cooked reading
\par \tab \tab 1\tab Supports cooked and raw reading
\par Bit 3\tab \tab 0\tab Read only
\par \tab \tab 1\tab Read/write
\par Bit 4\tab \tab 0\tab Data read only
\par \tab \tab 1\tab Data read and plays audio/video tracks
\par Bit 5\tab \tab 0\tab No interleaving
\par \tab \tab 1\tab Supports ISO-9660 interleaving using interleave size
\par \tab \tab \tab and skip factor
\par Bit 6\tab \tab 0\tab Reserved
\par Bit 7\tab \tab 0\tab No prefetching
\par \tab \tab 1\tab Supports prefetching requests
\par Bit 8\tab \tab 0\tab No audio channel manipulation
\par \tab \tab 1\tab Supports audio channel manipulation
\par Bit 9\tab \tab 0\tab Supports HSG addressing mode
\par \tab \tab 1\tab Supports HSG and Red Book addressing modes
\par Bit 10\tab \tab 0\tab Reserved
\par Bit 11\tab \tab 0\tab Disc is present in drive
\par \tab \tab 1\tab No disc is present in drive
\par Bit 12\tab \tab 0\tab Doesn't support R-W sub-channels
\par \tab \tab 1\tab Supports R-W sub-channels
\par Bit 13-31\tab 0\tab Reserved (all 0)
\par
\par }\pard \sl240 {\b\i\fs22 - Return Sector Size
\par }{\fs22 ________________
\par
\par SectSize\tab DB\tab 7\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; Read mode
\par \tab \tab DW\tab ?\tab \tab ; Sector size
\par ________________
\par }{\i\fs22
\par }\pard \qj\li720\sl240 {\fs22 The device driver will return the sector size of the device given the read mode provided. In the case of CD-ROM, the value returned for cooked is 2048, and the return value for raw is 2352.
\par
\par }\pard \sl240 {\b\i\fs22 \page - Return Volume Size
\par }{\fs22 ________________
\par
\par VolSize\tab \tab DB\tab 8\tab \tab ; Control block code
\par \tab \tab DD\tab ?\tab \tab ; Volume size
\par ________________
\par }{\i\fs22
\par }\pard \qj\li720\sl240 {\fs22 The device driver will return the number of sectors on the device. The size returned is the address of the lead-out track in the TOC converted to a binary value according to FRAME + (SEC * 75) +
(MIN * 60 * 75). A disc with a lead out track starting at 31:14.63 would return a volume size of 140613. The address of the lead-out track is assumed to point to the first sector following the last addressable sector recorded on the disc.
\par
\par }\pard \sl240 {\b\i\fs22 - Media Changed
\par }{\fs22 ________________
\par
\par MedChng\tab DB\tab 9\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; Media byte
\par ________________
\par }{\i\fs22
\par }\pard \qj\li720\sl240 {\fs22 The normal media check function (command code 1) is not performed on character devices and contains additional semantics that are not needed for CD-ROM device drivers. This is why there is an IOCTL request for this function.

\par
\par When the device driver receives a call to see if the media has changed on that subunit, it will return one of the following values:
\par
\par \tab 1\tab \tab Media not changed
\par \tab 0\tab \tab Don't know if changed
\par \tab -1 (0FFh)\tab Media changed
\par
\par If the driver can assure that the media has not been changed (through

a door-lock or other interlock mechanism), performance is enhanced because MSCDEX.EXE does not need to reread the VTOC and invalidate in-memory buffers for each directory access. For drives that do not report if the media has changed, CD-ROM device drive
rs can utilize the same solution that has been applied to floppy disks. In some floppy-disk device drivers, if the MEDIA CHECK occurs within 2 seconds of a floppy-disk access, the driver reports "Media not changed." It is highly recommended though that dr
ives be able to detect and report media changes.
\par
\par \page
If the drive can enforce a door lock mechanism so that the device driver is notified when the door lock has been unlocked or the device driver is requested to do so by MSCDEX.EXE, then to improve performance, the driver could return that the media has not
changed without bothering to communicate with the physical device.
\par
\par If the media has not been changed, MSCDEX.EXE will proceed with the disk access. If the value returned is "Don't know," or "Media chang
ed," then MSCDEX.EXE will check to see if the disk has changed. It will continue if it has not, and reinitialize what it knows about the disk if it has.
\par
\par It is not necessary for the device driver to do anything for the volume ID when the media has changed.
\par
\par }\pard \sl240 {\b\i\fs22 - Audio Disk Info
\par }{\fs22 ________________
\par
\par DiskInfo\tab DB\tab 10\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; Lowest track number
\par \tab \tab DB\tab ?\tab \tab ; Highest track number
\par \tab \tab DD\tab ?\tab \tab ; Starting point of the lead-out track
\par ________________
\par }{\i\fs22
\par }\pard \qj\li720\sl240 {\fs22 This function returns TOC (Table of Conte
nts) information from the Q-Channel in the lead-in track indicating what the first and last track numbers are and the Red Book address for the lead-out track (PMIN/PSEC/PFRAME when POINT = A2). The first and last track numbers are binary values and not BC
D. It is recommended that the information for Audio Disk Info and Audio Track Info should be read by the drive when the disc is initialized and made accessible to the driver so that when these functions are called, the drive or driver do not have to inter
ru
pt audio play to read them from the TOC. If the TOC is not made available to the driver and the driver must obtain the information itself from the lead-in track, the driver should read and and attempt to cache the disk and track information during the Aud
io Disk Info command and invalidate this information only if the media changes.
\par
\par }\pard \sl240 {\b\i\fs22 \page - Audio Track Info
\par }{\fs22 ________________
\par
\par TnoInfo\tab DB\tab 11\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; Track number
\par \tab \tab DD\tab ?\tab \tab ; Starting point of the track
\par \tab \tab DB\tab ?\tab \tab ; Track control information
\par ________________
\par }{\i\fs22
\par }\pard \qj\li720\sl240 {\fs22
This function takes a binary track number, from within the range specified by the lowest and highest track number given by the Audio Disk Info command, and returns the Red Book address for the starting point of the track and the track control information
for that track. The track control information byte corresponds to the byte in the TOC in the lead-in track containing the two 4-bit fields for CONTROL and ADR in the entry for that track. The CONTROL informat
ion is in the most significant 4 bits and the ADR information is in the lower 4 bits. The track control information is encoded as follows:
\par
\par \tab 00x00000\tab - 2 audio channels without pre-emphasis
\par \tab 00x10000\tab - 2 audio channels with pre-emphasis
\par \tab 10x00000\tab - 4 audio channels without pre-emphasis
\par \tab 10x10000\tab - 4 audio channels with pre-emphasis
\par \tab 01x00000\tab - data track
\par \tab 01x10000\tab - reserved
\par \tab 11xx0000\tab - reserved
\par \tab xx0x0000\tab - digital copy prohibited
\par \tab xx1x0000\tab - digital copy permitted
\par }\page {\fs22
\par }\pard \sl240 {\b\i\fs22 - Audio Q-Channel Info
\par }{\fs22 ________________
\par
\par QInfo\tab \tab DB\tab 12\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; CONTROL and ADR byte
\par \tab \tab DB\tab ?\tab \tab ; Track number (TNO)
\par \tab \tab DB\tab ?\tab \tab ; (POINT) or Index (X)
\par \tab \tab \tab \tab \tab ; Running time within a track
\par \tab \tab DB\tab ?\tab \tab ; (MIN)
\par \tab \tab DB\tab ?\tab \tab ; (SEC)
\par \tab \tab DB\tab ?\tab \tab ; (FRAME)
\par \tab \tab DB\tab ?\tab \tab ; (ZERO)
\par \tab \tab \tab \tab \tab ; Running time on the disk
\par \tab \tab DB\tab ?\tab \tab ; (AMIN) or (PMIN)
\par \tab \tab DB\tab ?\tab \tab ; (ASEC) or (PSEC)
\par \tab \tab DB\tab ?\tab \tab ; (AFRAME) or (PFRAME)
\par ________________
\par }{\i\fs22
\par }\pard \qj\li720\sl240 {\fs22
This function reads and returns the most up to date Q-channel address presently available. It must not interrupt the present status of the drive as one of its intended purposes is to monitor the location of the read head while playing audio tracks. This f
unction should return valid information even when no audio tracks are being played and the head is stationary. The fields returned correspond to the data that is stored in the Q-channel as described in the Red Book. The values in MIN-SEC-FRAME, AMIN-ASEC-
AF
RAME and PMIN-PSEC-PFRAME are converted by the driver from BCD to binary so that minutes range from 0 to 59+, seconds from 0 to 59, and frames from 0 to 74. The Control and ADR byte, TNO, and POINT/Index bytes are always passed through as they appear on t
he disc and are not converted. If the drive returns Q-channel information when ADR is not equal to 1, then when ADR is not equal to 1 all ten bytes of information are passed through unmodified to the caller.
\par }\pard \sl240 \page {\b\i\fs22 Audio Sub-Channel Info
\par }{\fs22 ________________
\par
\par SubChanInfo\tab DB\tab 13\tab \tab ; Control block code
\par \tab \tab DD\tab ?\tab \tab ; Starting sector address
\par \tab \tab DD\tab ?\tab \tab ; Transfer address
\par \tab \tab DD\tab ?\tab \tab ; Number of sectors to read
\par ________________
\par }{\i\fs22
\par }\pard \li720\sl240 {\fs22
This function takes a Red Book address of a particular sector (also known as a block or frame) and copies the sub-channel information for each sector requested to the transfer address. If multiple sectors are requested, they are copied sequentially. Eac
h sector contains 96 bytes of sub-channel information. These bytes do not include the two sync pa
tterns (S0 and S1) that head the subcoding block. They contain only the subcoding symbols--each with one bit of information for the eight different channels (P-W) that follow them. In this byte, the 2 most significant bits that represent channels P and Q
are undefined, the next most significant bit (bit 6) represents channel R, and the least significant bit (bit 1) represents channel W.
\par
\par For the sub-channel data to be generally useful it }{\i\fs22 must}{\fs22
be provided during an AUDIO PLAY operation without interrupting it. Therefore, when the requested sectors lie within the current play request they should be provided in real-time. This requires data buffering (in the drive or by the driver) for at leas
t one sector of sub-channel information. This is because an application using sub-channel information will send an AUDIO PLAY command, follow it up with successive and contiguous sub-channel information commands, and expect to get that data starting with
the first sector of the play request. It is recommended that the buffer handle up to 32 sectors, to give an application time to process sub-channel data between requests.
\par
\par Since implementation of this command is optional, bit 12 in the device status long word should indicate whether sub-channel support is available. The driver will return an error code of }{\i\fs22 Unknown Command }{\fs22 if it is not supported.
\par
\par The method of data error detection and correction for R-W channels is specified in the Red Book standard, and if not implemented by the drive, must be provided in the driver software.
\par
\par }\pard \sl240 \page {\b\i\fs22 - UPC Code
\par }{\fs22 ________________
\par
\par UPCCode\tab DB\tab 14\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; CONTROL and ADR byte
\par \tab \tab DB\tab 7 dup (?)\tab ; UPC/EAN code
\par \tab \tab \tab \tab \tab ; (last 4 bits are zero; the low-order nibble of byte 7)
\par \tab \tab DB\tab ?\tab \tab ; Zero
\par \tab \tab DB\tab ?\tab \tab ; Aframe
\par ________________
\par }{\i\fs22
\par }\pard \qj\li720\sl240 {\fs22 This function returns the UPC/EAN (Universal Product Code - BAR coding) for the disc. This information is stored as a mode-2 (ADR=2) Q-channel entry. The UPC code is 13 successive BCD
digits (4 bits each) followed by 12 bits of zero. The last byte is the continuation of FRAME in mode-1 though in the lead-in track (TNO=0) this byte is zero. If the CONTROL/ADR byte is zero or if the 13 digits of UPC code are all zero, then either no cat
alog number was encoded on the disc or it was missed by the device driver. If the command is supported but the disc does not have a UPC Code recorded, then the driver will return an error code of }{\i\fs22 Sector not Found}{\fs22
. If the command is not supported, then the driver will return an error code of }{\i\fs22 Unknown Command}{\fs22 .
\par
\par }\pard \sl240 \page {\b\i\fs22 - Audio Status Info
\par }{\fs22 ________________
\par
\par AudStat\tab DB\tab 15\tab \tab ; Control block code
\par }\pard \li720\sl240 {\fs22 \tab DW\tab ?\tab \tab ; Audio status bits
\par \tab \tab \tab \tab ; Bit 0 is Audio Paused bit
\par \tab \tab \tab \tab ; Bits 1-15 are reserved
\par \tab DD\tab ?\tab \tab ; Starting location of last Play or for next Resume
\par \tab DD\tab ?\tab \tab ; Ending location for last Play or for next Resume
\par }\pard \sl240 {\fs22 ________________
\par }{\i\fs22
\par }\pard \li720\sl240 {\fs22
\par }\pard \qj\li720\sl240 {\fs22 The Audio Paused bit and Starting and Ending locations are those referred to in the RESUME command. These are recorded in Red Book addressing mode.
\par
\par }\pard \sl240 \page {\plain \b WRITE (IOCTL OUTPUT)}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 12
\par ES:BX = IOCTLO
\par ________________
\par
\par IOCTLO\tab DB\tab 13 dup (0)\tab ; Request header
\par \tab \tab DB\tab 0\tab \tab ; Media descriptor byte from BPB
\par \tab \tab DD\tab ?\tab \tab ; Transfer address
\par \tab \tab DW\tab ?\tab \tab ; Number of bytes to transfer
\par \tab \tab DW\tab 0\tab \tab ; Starting sector number
\par \tab \tab DD\tab 0\tab \tab ; DWORD ptr to requested vol
\par \tab \tab \tab \tab \tab ; ID if error 0FH
\par ________________
\par }\pard \qj\sl240 {\fs22
\par The media descriptor byte, starting sector number, and volume ID fields are all 0.
\par
\par }\pard \sl240 {\fs22
The transfer address points to a control block that is used to communicate with the device driver. The first byte of the control block determines the request that is being made. The Length of Block is the number of bytes to transfer. With the exception of
Reset Drive and Write Device Control String, the action of these request may be verified with the READ IOCTL Audio Channel Info or Device Status functions.
\par }\pard \fi432\sl240 {\fs22
\par }\pard \sl240 {\fs22 \tab }{\fs22\ul Code\tab Length of Block\tab \tab Function
\par }{\fs22 \tab 0\tab 1\tab \tab \tab Eject Disk
\par \tab 1\tab 2\tab \tab \tab Lock/Unlock Door
\par \tab 2\tab 1\tab \tab \tab Reset Drive
\par \tab 3\tab 9\tab \tab \tab Audio Channel Control
\par \tab 4\tab ?\tab \tab \tab Write Device Control String
\par \tab 5\tab 1\tab \tab \tab Close Tray
\par \tab 6-255\tab ?\tab \tab \tab Reserved
\par
\par }{\b\i\fs22 - Eject Disk
\par }{\fs22 ________________
\par
\par Eject\tab \tab DB\tab 0\tab \tab ; Control block code
\par ________________
\par
\par }\pard \qj\li720\sl240 {\fs22
The device driver will unlock the drive and eject the CD-ROM disk from the drive unit. The door will report as being open until the user has inserted a disk into the drive unit and closed the door. The status bit for door open can be monit
ored to determine when a disk has been reinserted.
\par }\pard \sl240 {\fs22
\par }{\b\i\fs22 \page - Lock/Unlock Door
\par }{\fs22 ________________
\par
\par LockDoor\tab DB\tab 1\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; Lock function
\par ________________
\par
\par }\pard \qj\li720\sl240 {\fs22 When this function is received, the device driver will ask the CD-ROM drive to unlock or lock the door. If lock function is 0, the device driver will unlock the door. If lock function is 1, it will lock the door.
\par }\pard \sl240 \page {\b\i\fs22 - Reset Drive
\par }{\fs22 ________________
\par
\par ResetDrv\tab DB\tab 2\tab \tab ; Control block code
\par ________________
\par
\par }\pard \qj\li720\sl240 {\fs22 This function directs the device driver to reset and reinitialize the drive.
\par }\pard \li720\sl240 {\fs22
\par }\pard \sl240 {\b\i\fs22 - Audio Channel Control
\par }{\fs22 ________________
\par
\par AudInfo\tab DB\tab 3\tab \tab ; Control block code
\par \tab \tab DB\tab ?\tab \tab ; Input channel (0, 1, 2, or 3) for output channel 0
\par \tab \tab DB\tab ?\tab \tab ; Volume control (0 - 0xff) for output channel 0
\par \tab \tab DB\tab ?\tab \tab ; Input channel (0, 1, 2, or 3) for output channel 1
\par \tab \tab DB\tab ?\tab \tab ; Volume control (0 - 0xff) for output channel 1
\par \tab \tab DB\tab ?\tab \tab ; Input channel (0, 1, 2, or 3) for output channel 2
\par \tab \tab DB\tab ?\tab \tab ; Volume control (0 - 0xff) for output channel 2
\par \tab \tab DB\tab ?\tab \tab ; Input channel (0, 1, 2, or 3) for output channel 3
\par \tab \tab DB\tab ?\tab \tab ; Volume control (0 - 0xff) for output channel 3
\par ________________
\par }{\b\i\fs22
\par }\pard \qj\li720\sl240 {\fs22 This fu

nction is intended to provide playback control of audio information on the disk. It allows input channels on the CD-ROM to be assigned to specific output speaker connections. The purpose of this function is to allow two independent channels to be recorded
- in different languages for example - and to play back only one of them at a time or to be able to manipulate an audio signal so that the source appears to move - to make a sound seem to move from left to right for example.
\par
\par Output channel 0 is the left channel, 1 is right, 2 is left prime, and 3 is right prime. The Red Book specification allows for 4 audio channels. The two "prime" channels (2 and 3) extend stereo to quadrophonic stereo.
\par
\par An audio volume setting of 0 means off. Drives that don't support 4 output audio channels may ignore output to channels 2 and 3. Assignment of input channels 2 and 3 to output channels 0 and 1 may be treated as though the volume control for that channel i
s 0.
\par
\par Drives that do not sup
port variable audio control will treat a setting of 0 as off and 1-0xff as on. Drives that support less than 256 volume settings will do their best to break up the 256 settings among the settings they can support. E.g. if there are 16 settings supported,
then the first setting will cover 0x01-0x10, the second 0x11-0x20...the sixteenth 0xf1-0xff. Drives that can't play a single channel in both must play only that one channel and try to suppress the other if possible. Drives that can't swap channels should
play the channel that was moved in its normal channel.
\par }\pard \sl240 {\fs22
\par }\page {\b\i\fs22 - Write Device Control String
\par }{\fs22 ________________
\par
\par DrvBytes\tab DB\tab 4\tab \tab ; Control block code
\par \tab \tab DB\tab N dup (?)\tab ; Write buffer
\par ________________
\par }{\b\i\fs22
\par }\pard \qj\li720\sl240 {\fs22 This function is provided to allow programs to talk directly to the CD-ROM drive. All remaining bytes are sent uninterpreted to the drive unit.
\par
\par The function and content of these bytes are entirely device and device driver dependent. This function is provided to allow access to device-specific features that are not addressed under any other portion of the device driver spec.
\par
\par }\pard \sl240 {\b\i\fs22 - Close Tray
\par }{\fs22 ________________
\par
\par CloseTray\tab DB\tab 5\tab \tab ; Control block code
\par ________________
\par
\par }\pard \qj\li720\sl240 {\fs22 This command is the logical complement to the Eject Disk command. This command will instruct drives that can do so to close the door or tray.
\par }\pard \sl240 {\fs22
\par }\page {\plain \b READ LONG}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 128
\par ES:BX = ReadL
\par ________________
\par
\par ReadL\tab \tab DB\tab 13 dup (0)\tab ; Request header
\par \tab \tab DB\tab ?\tab \tab ; Addressing mode
\par \tab \tab DD\tab ?\tab \tab ; Transfer address
\par \tab \tab DW\tab ?\tab \tab ; Number of sectors to read
\par \tab \tab DD\tab ?\tab \tab ; Starting sector number
\par \tab \tab DB\tab ?\tab \tab ; Data read mode
\par \tab \tab DB\tab ?\tab \tab ; Interleave size
\par \tab \tab DB\tab ?\tab \tab ; Interleave skip factor
\par ________________
\par }{\b\fs22
\par }\pard \qj\sl240 {\fs22 The request block is different from a normal character device READ to accommodate the larger size and different characteristics of CD-ROM devices.
\par
\par The media descriptor byte, which has no meaning for character devices, is now the addressing mode field. The following values are recognized addressing modes:
\par }\pard \qj\fi432\sl240 {\fs22
\par }\pard \sl240 {\fs22 \tab 0\tab HSG addressing mode
\par \tab 1\tab Red Book addressing mode
\par \tab 2-255\tab Reserved
\par
\par }\pard \qj\sl240 {\fs22
The default addressing mode is the HSG addressing mode. Long (DWORD) address values are treated as logical block numbers, as defined by the High Sierra proposal. When Red Book addressing mode is on, all disk addresses are interpreted as Minute/Second/Fram
e addresses, according to the Philips/Sony Red Book standard. Each of these fields is 1 byte. The frame byte is the least significant byte of the address field, the "second" byte the next most significant, the minute byte the next, and the most signif
icant byte of the 4-byte field is unused. These values are represented in binary rather than in BCD format. For example, if we are referencing the sector addressed by minute 36, second 24, frame 12, the hex long value for this would be 0x0024180C. This 4
byte value is recorded in the starting sector number field with the least significant byte first and most significant byte last.
\par
\par The relationship between High Sierra sectors and Red Book frames is described by the equation:
\par }\pard \qj\fi432\sl240 {\fs22
\par Sector = Minute * 60 * 75 + Second * 75 + Frame - 150
\par
\par }\pard \qj\sl240 {\fs22
The byte/sector count field becomes the number of sectors to read and the starting sector number expands from one word to two, which means we can address up to 4 giga-sectors (over 8 terabytes). The DWORD ptr for requested volume ID is eliminated and MSC
DEX.EXE will keep track of what volume is needed.
\par
\par MSCDEX.EXE handles buffering requests, but performance may be improved if the device driver reads ahead or uses a sector caching scheme, given the slow seek times of CD-ROM drives. The operating system will use the prefetch function when it can to give hi
nts to the driver.
\par }\page {\fs22
\par The data read mode field will be one of the following:
\par
\par }\pard \sl240 {\fs22 \tab 0\tab Cooked mode
\par \tab 1\tab Raw mode
\par }\pard \qj\sl240 {\fs22 \tab 2-255\tab Reserved
\par
\par Cooked mode is the default mode in which the hardware typically handles the EDC/ECC and the device driver returns 2048 bytes of
data per sector read. When raw mode is set, the driver will return all 2352 bytes of user data, including any EDC/ECC present independent of the actual sector mode (Mode 2 Form 1 vs. Mode 2 Form 2). User programs will have to consider this and allow enoug
h room for buffer space when reading in raw mode as each sector returned will take up 2352 bytes of space. Drives that cannot return all 2352 bytes will return what they can and leave blank what they cannot. For example, drives that can return all 2336 by
tes except the 16 byte header will leave a space in the first 16 bytes where the header would go so that the sectors align on 2352 byte boundaries. Drivers should do what they can to return as much of the user data per sector as possible.
\par
\par The two interleave parameters are for drivers that support interleaved reading. If the driver does not support interleaving, these fields are both ignored. If it does, interleave size is the number of consecutive logical blocks or sectors that are stored
sequentially, and the interleave skip factor is the number of consecutive logical blocks or sectors that separate portions of the interleaved file.
\par
\par }\pard \sl240 \page {\plain \b READ LONG PREFETCH}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 130
\par ES:BX = ReadLPre
\par ________________
\par
\par ReadLPre\tab DB\tab 13 dup (0)\tab ; Request header
\par \tab \tab DB\tab ?\tab \tab ; Addressing mode
\par \tab \tab DD\tab 0\tab \tab ; Transfer address
\par \tab \tab DW\tab ?\tab \tab ; Number of sectors to read
\par \tab \tab DD\tab ?\tab \tab ; Starting sector number
\par \tab \tab DB\tab ?\tab \tab ; Read mode
\par \tab \tab DB\tab ?\tab \tab ; Interleave size
\par \tab \tab DB\tab ?\tab \tab ; Interleave skip factor
\par ________________
\par }{\b\fs22
\par }\pard \qj\sl240 {\fs22
This function is similar in form to READ LONG, but control returns immediately to the requesting process. The device driver is not obligated to read in the requested sectors but can instead consider the request for these sectors as hints from the operatin
g system that they are likely to be needed. It is recommended that at a minimum, the driver seek to the location provided. The attribute in the device status for prefetching is used to distinguish drivers that do more than just seek to the given location.
T
he requests are low priority and preemptible by other requests for service. A READ LONG PREFETCH with 0 number of sectors to read should be treated as an advisory seek, and the driver can, if it is not busy, move the head to the starting sector. Since pre
fetching requests are advisory, there will be no functional difference between a device driver that supports prefetching from one that does not, except in terms of performance. The transfer address is not applicable for this call as the driver is not mean
t to transfer any data into the user address space.
\par
\par }\pard \sl240 {\plain \b SEEK}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 131
\par ES:BX = SeekReq
\par ________________
\par
\par SeekReq\tab DB\tab 13 dup (0)\tab ; Request header
\par \tab \tab DB\tab ?\tab \tab ; Addressing mode
\par \tab \tab DD\tab 0\tab \tab ; Transfer address
\par \tab \tab DW\tab 0\tab \tab ; Number of sectors to read
\par \tab \tab DD\tab ?\tab \tab ; Starting sector number
\par ________________
\par }{\b\fs22
\par }\pard \qj\sl240 {\fs22
Control returns immediately to the caller without blocking and waiting for the seek to be completed. The number of sectors to be read and the transfer address are ignored. SEEK is used to relocate the head in order to begin playing audio or video tracks,
or in anticipation of reading in a particular region on the disk. Further requests for disk activity will wait until the given SEEK is completed. This seek is not advisory and the head must move to the desired location.}{\b\fs22
\par }\pard \sl240 {\b\fs22
\par }{\b \page }{\plain \b PLAY AUDIO}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 132
\par ES:BX = PlayReq
\par ________________
\par
\par PlayReq\tab DB\tab 13 dup (0)\tab ; Request header
\par \tab \tab DB\tab ?\tab \tab ; Addressing mode
\par \tab \tab DD\tab ?\tab \tab ; Starting sector number
\par \tab \tab DD\tab ?\tab \tab ; Number of sectors to read
\par ________________
\par }{\b\fs22
\par }\pard \qj\sl240 {\fs22
This function will cause the driver to play the selected audio tracks until the requested sectors have been exhausted or until play is interrupted with an AUDIO STOP request. Control returns immediately to the caller. The busy bit in the status word will
indicate if the drive is presently playing audio and when the play request is completed. The busy bit in the status word of the request header, as well as the paused bit and starting and ending locations returned by the Audio Status Info IOCTL, will be
updated. If the drive does not support playing audio this request is ignored.
\par }\pard \sl240 {\fs22
\par }{\b\fs22
\par }{\plain \b STOP AUDIO}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 133
\par ES:BX = StopPlayReq
\par ________________
\par
\par StopPlayReq\tab DB\tab 13 dup (0)\tab ; Request header
\par _______________
\par
\par }\pard \qj\sl240 {\fs22
This function is included to pause the drive unit when it is currently in play mode, or to reset the starting and ending locations when in paused mode. If applicable, at the next stopping point it reaches the drive will discontinue playing, and process t
he next request. The busy bit in the status word of the request header, as well as the paused bit and starting location returned by the Audio Status Info IOCTL, will be updated. If the drive does not support playing audio this request is ignored.
\par }\pard \sl240 {\fs22
\par }{\plain \b\f2 \page }{\plain \b RESUME AUDIO}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 136
\par ES:BX = ResumeReq
\par ________________
\par
\par ResumeReq\tab DB\tab 13 dup (0)\tab ; Request header
\par _______________
\par }{\b\fs22
\par }\pard \qj\sl240 {\fs22 This function is used to resume playing audio tracks when a previous PLAY AUDIO call has been paused with a STOP AUDIO command. It will resume playing from
the starting location indicated by the Audio Status Info IOCTL. It will modify the Audio Paused bit returned by the Audio Status Info IOCTL, and the busy bit in the status word of the request header. If the drive does not support playing audio this req
uest is ignored.
\par
\par In the following example the playing flag corresponds to the state reported by the busy bit in the status word of the request header when the drive is in audio play mode. The paused flag corresponds to the Audio Paused bit and last_start
loc and last_endloc correspond to the starting and ending location reported in the Audio Status Info IOCTL.
\par }\pard \sl240 {\fs22
\par // upon RESET, NEW DISC, or PLAY/RESUME COMPLETED the state should be updated: playing = FALSE;
\par paused = FALSE;
\par last_startloc = 0;
\par last_endloc = 0;
\par
\par PLAY_AUDIO( startloc, endloc )
\par \{
\par \tab if ( play( startloc, endloc ) != SUCCESSFUL )
\par \tab \tab return error;
\par \tab else
\par \tab \{
\par \tab \tab playing = TRUE;
\par \tab \tab paused = FALSE;
\par \tab \tab last_startloc = startloc
\par \tab \tab last_endloc = endloc
\par \tab \tab return no error;
\par \tab \}
\par \}
\par
\par \page STOP_AUDIO( void )
\par \{
\par \tab if ( playing )
\par \tab \{
\par \tab \tab last_startloc = present q-channel location
\par \tab \tab playing = FALSE;
\par \tab \tab paused = TRUE;
\par \tab \tab return ( stop() != SUCCESSFUL );
\par \tab \}
\par \tab else
\par \tab \{
\par \tab \tab playing = FALSE;
\par \tab \tab paused = FALSE;
\par \tab \tab last_startloc = 0;
\par \tab \tab last_endloc = 0;
\par \tab \tab return no error;
\par \tab \}
\par \}
\par
\par RESUME_AUDIO()
\par \{
\par \tab if ( paused )
\par \tab \{
\par \tab \tab if ( play( last_startloc, last_endloc ) != SUCCESSFUL )
\par \tab \tab \tab return error;
\par \tab \tab else
\par \tab \tab \{
\par \tab \tab \tab playing = TRUE;
\par \tab \tab \tab paused = FALSE;
\par \tab \tab \tab return no error;
\par \tab \tab \}
\par \tab \}
\par \tab else
\par \tab \tab return error;
\par \}
\par }\page {\plain \b WRITE LONG}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 134
\par ES:BX = WriteL
\par ________________
\par
\par WriteL\tab \tab DB\tab (dup 13 0)\tab ; Request header
\par \tab \tab DB\tab ?\tab \tab ; Addressing mode
\par \tab \tab DD\tab ?\tab \tab ; Transfer address
\par \tab \tab DW\tab ?\tab \tab ; Number of sectors to write
\par \tab \tab DD\tab ?\tab \tab ; Starting sector number
\par \tab \tab DB\tab ?\tab \tab ; Write mode
\par \tab \tab DB\tab ?\tab \tab ; Interleave size
\par \tab \tab DB\tab ?\tab \tab ; Interleave skip factor
\par ________________
\par
\par }\pard \qj\sl240 {\fs22
The device will copy the data at the transfer address to the CD RAM device at the sector indicated. The media must be writable for this function to work. Data is written sector by sector, depending on the current write mode and the interleave parameters.
The following values are recognized as valid write modes:
\par }\pard \qj\fi432\sl240 {\fs22
\par }\pard \sl240 {\fs22 \tab 0\tab Mode 0
\par \tab 1\tab Mode 1
\par \tab 2\tab Mode 2 Form 1
\par \tab 3\tab Mode 2 Form 2
\par \tab 4-255\tab Reserved
\par
\par }\pard \qj\sl240 {\fs22 Writing in Mode 1 is the default and must be supported. If the device driver supports the other modes, then they can be
used. If Mode 0 is used, the transfer address is ignored and all sectors are written with zeroes. If the current write mode is Mode 1 or Mode 2 Form 1, each sector will consist of 2048 bytes of data located sequentially at the transfer address. If the wr
ite mode is Mode 2 Form 2, the device driver will expect 2336 bytes of data per sector at the transfer address.
\par }\pard \sl240 \page {\plain \b WRITE LONG VERIFY}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 135
\par ES:BX = WriteLV
\par ________________
\par
\par WriteLV\tab DB\tab (dup 13 0)\tab ; Request header
\par \tab \tab DB\tab ?\tab \tab ; Addressing mode
\par \tab \tab DD\tab ?\tab \tab ; Transfer address
\par \tab \tab DW\tab ?\tab \tab ; Number of sectors to write
\par \tab \tab DD\tab ?\tab \tab ; Starting sector number
\par \tab \tab DB\tab ?\tab \tab ; Write mode
\par \tab \tab DB\tab ?\tab \tab ; Interleave size
\par \tab \tab DB\tab ?\tab \tab ; Interleave skip factor
\par ________________
\par }{\b\fs22
\par }\pard \qj\sl240 {\fs22 This function is identical to WRITE LONG, with the addition that the device driver is responsible for verifying the data written to the device.}{\b\fs22
\par }\pard \sl240 \page {\plain \b INPUT FLUSH}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 7
\par ES:BX = FlushI
\par ________________
\par
\par FlushI\tab \tab DB\tab 13 dup (0)\tab ; Request header
\par ______________
\par }{\b\fs22
\par }\pard \qj\sl240 {\fs22 Requests that the device driver free all input buffers and clear any pending requests.
\par }\pard \sl240 {\fs22
\par }{\plain \b OUTPUT FLUSH}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 11
\par ES:BX = FlushO
\par ________________
\par
\par FlushO\tab \tab DB\tab (dup 13 0)\tab ; Request header
\par ______________
\par }{\b\fs22
\par }\pard \qj\sl240 {\fs22 Requests that the device driver write all unwritten buffers to the disk.
\par }\pard \sl240 {\fs22
\par }{\plain \b DEVICE OPEN
\par DEVICE CLOSE}{\b
\par }{\b\fs22
\par }{\fs22 Command code = 13,14
\par ES:BX = DevOpen, DevClose
\par ________________
\par
\par DevOpen\tab DB\tab 13 dup (0)\tab ; Request header
\par ______________
\par
\par }\pard \qj\sl240 {\fs22 Used by the device driver to monitor how many different callers are currently using the CD-ROM device driver. All new device drivers should support these calls even if nothing is done with the information.
\par }}

  3 Responses to “Category : Recently Uploaded Files
Archive   : INFOPACK.ZIP
Filename : DEVICE.RTF

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/