/**********************************************************
 * dirent - Directory Entries Module for run6502 emulator *
 **********************************************************/

/* File Attributes */
struct attrs {char arch, hidden, rdonly, subdir, system;};
const char attrd[]; //Single Character Descriptions

/* Timestamp - Matches module time.h02 structure tm */
struct ts {char year, month, day, hour, minute, second;};


/* Directory Entry */
struct dirent {
  struct attrs attr;  //File Attributes
  struct ts time;     //Timestamp
  int size;           //Size in Bytes
  char name[128];     //Entry Filename
};

/* Directory Header    */
struct dirhdr {
  char name[128]; //Header Name
};

/* Open Directory for Reading      *
 * Args: char d - Drive | Disk     *
 *       int &n - Directory Name   *
 * Returns: char f - Channel       *
 *               0 = Not Opened    *
 *          char e - Error, 0=None */
char opndir();

/* Read Disk/Directory Header         *
 * Args: char f - Directory Channel   *
 *       int &s - dirhdr Struct       *
 * Returns: char n - Length of Header *
 *               0 = N/A or Error     *
 *          char e - Error, 0=None    */
char rdhdr();

/* Read Directory Entry              *
 * Args: char f - Directory Channel  *
 *       int &s - dirent Struct      *
 * Returns: char n - Length of Entry *
 *               0 = EOF or Error    *
 *          char e - Error, 0=None   */
char rddir();

/* Close Directory Channel          *
 * Args: char f - Directory Channel *
 * Returns: char e - Error, 0=None  */
char clsdir();
