The purpose of the example CD-ROM device driver is to demonstrate an implementation of a MSCDEX CD-ROM device driver conforming to the specification in the document "Microsoft MS-DOS CD-ROM Extensions Hardware-Dependent Device Driver Specification".  Using this example as a starting point, together with an understanding of the device driver specification, greatly simplifies the task of creating a MSCDEX CD-ROM device driver.

Installation

This example driver is for use on an AT style bus with most of Hitachi's drives and controllers except their SCSI devices (CDR-3650).  The device driver is installed in the same way as any other device, with an entry in CONFIG.SYS.  The syntax of this entry is:

DEVICE=<filename> /D:<device_names> /N:<drives> /P:<port address> C:<minutes>

where the arguments are:

<filename>		the MS-DOS path to, and name of, the device driver file.

/D:<device_names>	the character device names that will be used by MSCDEX.EXE to find and communicate with the device driver.  Although more than one device name on the command line provides names for multiple device headers to control more than one physical device, this example supports multiple devices as sub-units of a single device header (the recommended approach).  Choose unique device names that you do not expect to use as file names.  DOS's file open code looks at the device list before opening files, so a device named 'CDROM' would prevent opening a file or directory named 'CDROM'.

/N:<drives>	the number of sub-units (physical drives) attached to the interface card (defaults to one sub-unit).  This example supports a maximum of 8 drives, however when more than 4 drives are controlled by one device driver, you need to use an interface card and drives that support 8-drive-daisy-chaining (for example, CDR-IFI8-A, CDR-3600, etc.)

/P:<port address>	the port address to be used to communicate with the card (defaults to 300H).

/C:<minutes>	the number of minutes of driver inactivity before the power save feature (which will increase the life span of the drive unit) should turn off the drive motor.  This is a value from 0 to 14H, where 0 disables the spin down feature.

Building the Driver

The source files and the makefile you need to build the driver are in the HITACHIA directory on the SUP: disk. The tools (MASM 5.1, etc.) are in BIN directory of the TOOLS: disk.  The files needed to build the driver include:

MAKEFILE	The makefile to build the driver.

MSCDEX.ASM	This file is device independent and can be used by a device driver with no changes.  It contains all the entry points for the commands that a MSCDEX CD-ROM device driver is expected to handle.  Some commands, and certain device independent data, are handled without actually calling the device dependent code in CD.ASM.

CD.ASM	This file contains device dependent code for all the entry points defined in MSCDEX.ASM.  These routines start with the letters "cdrom_", and have explicitly defined entry and exit conditions.  A device driver should use this file as a starting point by replacing the Hitachi implementation with the necessary device dependent code to perform the equivalent functions, and carefully adhering to the indicated entry and exit conditions.

MSCDEX.INC	This is an include file for MSCDEX.ASM and CD.ASM with useful definitions for command structures, error codes, and the status word.

MACROS.MAC	This is an include file for MSCDEX.ASM and CD.ASM with useful macro definitions to make the code easier to read.

CD.INC	This is an include file for CD.ASM defining names for the low-level driver commands provided in CDREAD.ASM.

CDREAD.ASM	This file contains the function CDREAD() which has about 26 sub-functions to perform various low level driver commands.

CDREAD.AT	This is an include file for CDREAD.ASM defining various port addresses, control codes, and other defines.

CDREAD.DOC	This file documents the entry and exit conditions for the sub-functions provided by CDREAD().

ECC.ASM	This file contains the routine to do the last level of error correction in the event the Cross Interleave Reed-Solomon Code implemented in the drive is not able to correct a read error.  For performance considerations it is recommended that this level of error correction also be done on the drive.

TRACER.ASM	This file is linked if the DEBUG label is defined in the MAKEFILE.  It defines WriteAux which directs messages to the serial port.

CMACROS.INC	This is an include file used by TRACER.ASM, and defines various constructs to improve readability and ease writing of assembly code.