X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fcbm.h;h=440b969353a206a948a56834a2a7434f327219fd;hb=dbbce2e939af8fd78f659e5c66eea8b002369ba2;hp=ba831dd54a6e9b29f151ddf289218ffdfdb46b17;hpb=8dc9619d2e3e3424d84d49dc109b4779c01cdf88;p=cc65 diff --git a/include/cbm.h b/include/cbm.h index ba831dd54..440b96935 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -104,8 +104,39 @@ extern unsigned char _filetype; /* Default 'u' */ #define CH_PI 126 #define CH_DEL 20 #define CH_INS 148 -#define CH_ESC 95 #define CH_ENTER '\n' +#define CH_STOP 3 +#define CH_ESC 27 + + + +/*****************************************************************************/ +/* Definitions for directory reading functions */ +/*****************************************************************************/ + + + +/* CBM FILE TYPES */ +#define CBM_T_DEL 0 +#define CBM_T_SEQ 1 +#define CBM_T_PRG 2 +#define CBM_T_USR 3 +#define CBM_T_REL 4 +#define CBM_T_CBM 5 /* 1581 sub-partition */ +#define CBM_T_DIR 6 /* IDE64 and CMD sub-directory */ +#define CBM_T_VRP 8 /* Vorpal fast-loadable format */ +#define CBM_T_OTHER 5 /* Other file-types not yet defined */ + +/* CBM FILE ACCESS */ +#define CBM_A_RO 1 /* Read only */ +#define CBM_A_RW 3 /* Read, Write */ + +struct cbm_dirent { + char name[17]; /* File name in PETSCII, limited to 16 chars */ + unsigned int size; /* Size in 256B blocks */ + unsigned char type; + unsigned char access; +}; @@ -181,8 +212,7 @@ void __fastcall__ cbm_k_clrch (void); -unsigned int cbm_load (const char* name, unsigned char device, - const char* data); +unsigned int cbm_load (const char* name, unsigned char device, void* data); /* Loads file "name" from given device to given address or to the load * address of the file if "data" is the null pointer (like load"name",8,1 * in BASIC). @@ -191,7 +221,7 @@ unsigned int cbm_load (const char* name, unsigned char device, */ unsigned char cbm_save (const char* name, unsigned char device, - unsigned char* data, unsigned int size); + const void* data, unsigned int size); /* Saves "size" bytes starting at "data" to a file. * Returns 0 if saving was successful, otherwise an errorcode (see table * below). @@ -219,9 +249,23 @@ int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size); int __fastcall__ cbm_write (unsigned char lfn, void* buffer, unsigned int size); /* Writes up to "size" bytes from "buffer" to a file. * Returns the number of actually written bytes or -1 in case of an error. - * _oserror contains an errorcode then (see table below). + * _oserror contains an errorcode then (see above table). + */ + +unsigned char __fastcall__ cbm_opendir (unsigned char lfn, unsigned char device); +/* Opens directory listing. + * Returns 0 if opening directory was successful, + * othervise errorcode corresponding to cbm_open() + */ + +unsigned char __fastcall__ cbm_readdir (unsigned char lfn, struct cbm_dirent* l_dirent); +/* Reads one directory line into cbm_dirent structure. + * Returns 0 if reading directory line was successful. + * Returns 'true' if reading directory failed or no more files to read. */ +void __fastcall__ cbm_closedir (unsigned char lfn); +/* Closes directory by cbm_close (unsigned char lfn) */