X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fcbm.h;h=6ba1ef47e12a02fa8708efb3a217d9fada5a2ce1;hb=4e18dad55a21955e811ecca92aa4e39323f64a6b;hp=1bfaa7600c1dc8ecb9359f447468778bb827a5a2;hpb=f47648ecfb4ae432622580d1b9022647de2f8ec7;p=cc65 diff --git a/include/cbm.h b/include/cbm.h index 1bfaa7600..6ba1ef47e 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998-2002 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1998-2004 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -111,20 +111,49 @@ extern unsigned char _filetype; /* Default 'u' */ /*****************************************************************************/ -/* Machine info */ +/* Definitions for directory reading functions */ /*****************************************************************************/ -#if defined(__C16__) || defined(__C64__) || defined(__C128__) || defined(__PLUS4__) +/* 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_RESERVED 7 /* Not used, but kept free for compatibility */ +#define CBM_T_VRP 8 /* Vorpal fast-loadable format */ +#define CBM_T_OTHER 9 /* Other file-types not yet defined */ +#define CBM_T_HEADER 10 /* Disk header / title */ -#define TV_NTSC 0 -#define TV_PAL 1 +/* CBM FILE ACCESS */ +#define CBM_A_RO 1 /* Read only */ +#define CBM_A_RW 3 /* Read, Write */ -unsigned char __fastcall__ get_tv (void); -/* Return the video mode the machine is using */ +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; +}; + + + +/*****************************************************************************/ +/* Machine info */ +/*****************************************************************************/ -#endif + + +#define TV_NTSC 0 +#define TV_PAL 1 +#define TV_OTHER 2 + +unsigned char __fastcall__ get_tv (void); +/* Return the video mode the machine is using. */ @@ -219,9 +248,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) */