#ifndef BYTE_DEF
typedef unsigned char byte;
typedef unsigned short word;
#define BYTE_DEF
#endif

/*------------------------------------------------------*/
/*  This is the structure of a ProDos directory entry.  */
/*  Reference: "Beneath Apple ProDOS", Worth & Lechner  */
/*------------------------------------------------------*/
struct pro_dir {
    byte typ_len;			/* Hi Nibble-> Type of entry, Lo->length of fname */
    byte fname[15];			/* File name */
    byte type;				/* File Type */
    word key_ptr;           /* File "key block", block number */
    word fsize;             /* File size in blocks (includes index blocks */
    byte file_len[3];       /* File length in bytes (data only) */
    word date;              /* Creation date */
    word time;				/* Creation time */
    byte version;			/* Version of ProDOS created under */
    byte min_vers;			/* minimum version of ProDOS supported */
    byte permiss;			/* Read/Write etc... permissions */
    word aux_type;			/* Auxillary file type (or misc use) */
    word moddate;           /* last modified date and time */
    word modtime;			
    word head_ptr;          /* Pointer to Key block of the directory */
};

/*----------------------------------------------------------------------*/
/* This is the structure of a ProDOS directory block.                   */
/*  Reference: "Beneath Apple ProDOS", Worth & Lechner                  */
/*----------------------------------------------------------------------*/
struct pro_block {
    word prev;				/* Sector of previous directory block */
    word next;				/* Sector of next directory block */
    struct pro_dir dir[13]; /* 13 directory entries           */
};

/*----------------------------------------------------------------------*/
/* This is the structure of the ProDOS Volume directory entry.          */
/* The volume entry is the first directory entry of the (dir[0])        */
/* ProDOS root directory.                                               */
/*  Reference: "Beneath Apple ProDOS", Worth & Lechner                  */
/*----------------------------------------------------------------------*/
struct vol_entry {
    byte typ_len;		/* type of entry and length of volume name */
    byte vol_name[15];	/* Volume name */
    byte reserve[8];	/* Reserved for future use. */
    word date;			/* Volume creation date */
    word time;			/* Volume creation time */
    byte version;		/* Version of ProDOS volume was created under */
    byte min_vers;		/* Mininum version of ProDOS supported */
    byte permiss;		/* Read/Write/Archive permission's etc... */
    byte entry_len;		/* Len of each entry in Volume directory (0x27) */
    byte entries_per_blk;	/* No. of entries per block. (0x0d) */
    word file_cnt;		/* Number of active directory entries. */
    word bit_map_ptr;	/* Block No. of first Volume bit map block */
    word total_blks;	/* Total number of blocks in Volume */
};

/*----------------------------------------------------------------------*/
/* This is the structure of the Volume directory block.                 */
/*----------------------------------------------------------------------*/
struct pro_volume {
    word prev;
    word next;
    struct vol_entry vol;
    struct pro_dir dir[12];
};
