Listing 3 (driver._H) MS-DOS Device Driver #defines and Definitions

#ifndef_DRIVER_H
#define_DRIVER_H

/* Format of generic request header block. Depending
 * on the command code, data specific to the command is
 * carried in data[] buffer .........  */
typedef struct request_block {
   unsigned char length;       //length of REQHDR
   unsigned char unit;         //unit # (block only)
   unsigned char cmd;          //command code
   unsigned int status;        //return status
   unsigned char reserved[8];
   unsigned char mtype;        //media type
   unsigned int xfer_ofs;      //xfer buffer offset
   unsigned int xfer_seg;      // "    "     segment
   unsigned int xfer_cnt;      //bytes to xfer
   unsigned char data[12];     //other command data
   } REQHDR;

/* bit settings for upper byte of return
 * status word in REQHDR ....  */
#define IS_ERROR        0x8000
#define IM-BUSY         0x0200
#define IM_DONE         0x0100

/* values returned in lower byte of REQHDR status
 * word if ERROR bit (bit 15) is set ..... */
#define WRITE_PROTECT   0x0000
#define INVALID_UNIT    0x0001
#define NOT_READY       0x0002
#define INV_COMMAND     0x0003
#define CRC_ERROR       0x0004
#define BAD_REQ_LENGTH  0x0005
#define SEEK_ERROR      0x0006
#define UNKNOWN_MEDIA   0x0007
#define INV_SECTOR      0x0008
#define OUT_OF_PAPER    0x0009
#define WRITE_FAULT     0x000A
#define READ_FAULT      0x000B
#define GENERAL_FAILURE 0x000C
#define INV_DISK_CHANGE 0x000F    //DOS 3+ only

/* Bit settings for attribute word ........ */
#define IS_NUL      0x0004  //current NUL device
#define IS_CLOCK    0x0008  //current CLOCK device
#define GEN_IOCTL   0x0040  //generic ioctl: DOS 3.2+
#define OCR_MEDIA   0x0800  //open-close-remove media
#define IOCTL_RW    0x4000  //ioctl r/w supported (2+)

/* Attribute bits for character devices only ...... */
#define IS_STDIN    0x0001  //std input device
#define IS_STDOUT   0x0002  //std output device
#define USE_INT29H  0x0010  //CON device uses int 29h
/define OUTPUT_BUSY 0x2000  //uses output until busy
/define IS_CHAR     0x8000  //is character device

/* Attribute bits for block devices only .... */
#define BIG_SECTOR  0x0002  //32-bit sectors (DOS 4)
#define USE_BPB     0x2000  //use BPB for media info

#endif  //__DRIVER_H

/* ------ End of File ----------------------- */