ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/Frodo4/Src/IEC.h
(Generate patch)

Comparing Frodo4/Src/IEC.h (file contents):
Revision 1.4 by cebix, 2004-01-11T14:03:29Z vs.
Revision 1.8 by cebix, 2005-06-27T19:55:48Z

# Line 1 | Line 1
1   /*
2   *  IEC.h - IEC bus routines, 1541 emulation (DOS level)
3   *
4 < *  Frodo (C) 1994-1997,2002-2003 Christian Bauer
4 > *  Frodo (C) 1994-1997,2002-2005 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 22 | Line 22
22   #define _IEC_H
23  
24  
25 + /*
26 + *  Definitions
27 + */
28 +
29   // Maximum length of file names
30   const int NAMEBUF_LENGTH = 256;
31  
28
32   // C64 status codes
33   enum {
34          ST_OK = 0,                              // No error
# Line 35 | Line 38 | enum {
38          ST_NOTPRESENT = 0x80    // Device not present
39   };
40  
38
41   // 1541 error codes
42   enum {
43          ERR_OK,                         // 00 OK
# Line 70 | Line 72 | enum {
72          ERR_NOTREADY            // 74 DRIVE NOT READY
73   };
74  
75 + // Mountable file types
76 + enum {
77 +        FILE_IMAGE,                     // Disk image, handled by ImageDrive
78 +        FILE_ARCH                       // Archive file, handled by ArchDrive
79 + };
80  
81   // 1541 file types
82   enum {
# Line 83 | Line 90 | enum {
90  
91   static const char ftype_char[9] = "DSPUL   ";
92  
86
93   // 1541 file access modes
94   enum {
95          FMODE_READ,                     // Read
# Line 92 | Line 98 | enum {
98          FMODE_M                         // Read open file
99   };
100  
95
96 // IEC command codes
97 enum {
98        CMD_DATA = 0x60,        // Data transfer
99        CMD_CLOSE = 0xe0,       // Close channel
100        CMD_OPEN = 0xf0         // Open channel
101 };
102
103
104 // IEC ATN codes
105 enum {
106        ATN_LISTEN = 0x20,
107        ATN_UNLISTEN = 0x30,
108        ATN_TALK = 0x40,
109        ATN_UNTALK = 0x50
110 };
111
112
101   // Drive LED states
102   enum {
103          DRVLED_OFF,             // Inactive, LED off
# Line 117 | Line 105 | enum {
105          DRVLED_ERROR    // Error, blink LED
106   };
107  
108 + // Information about file in disk image/archive file
109 + struct c64_dir_entry {
110 +        c64_dir_entry(const uint8 *n, int t, bool o, bool p, size_t s, off_t ofs = 0, uint8 sal = 0, uint8 sah = 0)
111 +                : type(t), is_open(o), is_protected(p), size(s), offset(ofs), sa_lo(sal), sa_hi(sah)
112 +        {
113 +                strncpy((char *)name, (const char *)n, 17);
114 +                name[16] = 0;
115 +        }
116 +
117 +        // Basic information
118 +        uint8 name[17];         // File name (C64 charset, null-terminated)
119 +        int type;                       // File type (see defines above)
120 +        bool is_open;           // Flag: file open
121 +        bool is_protected;      // Flag: file protected
122 +        size_t size;            // File size (may be approximated)
123 +
124 +        // Special information
125 +        off_t offset;           // Offset of file in archive file
126 +        uint8 sa_lo, sa_hi;     // C64 start address
127 + };
128  
129   class Drive;
130   class C64Display;
# Line 142 | Line 150 | public:
150          void Release(void);
151  
152   private:
153 +        Drive *create_drive(const char *path);
154 +
155          uint8 listen(int device);
156          uint8 talk(int device);
157          uint8 unlisten(void);
# Line 171 | Line 181 | private:
181          uint8 sec_addr;                 // Received secondary address ($0x)
182   };
183  
174
184   // Abstract superclass for individual drives
185   class Drive {
186   public:
# Line 224 | Line 233 | private:
233   };
234  
235  
236 + /*
237 + *  Functions
238 + */
239 +
240   // Convert ASCII character to PETSCII character
241 < extern char ascii2petscii(char c);
241 > extern uint8 ascii2petscii(char c);
242  
243   // Convert ASCII string to PETSCII string
244 < extern void ascii2petscii(char *dest, const char *src, int max);
244 > extern void ascii2petscii(uint8 *dest, const char *src, int max);
245  
246   // Convert PETSCII character to ASCII character
247   extern char petscii2ascii(uint8 c);
248  
249   // Convert PETSCII string to ASCII string
250 < extern void petscii2ascii(char *dest, const char *src, int max);
250 > extern void petscii2ascii(char *dest, const uint8 *src, int max);
251 >
252 > // Check whether file is a mountable disk image or archive file, return type
253 > extern bool IsMountableFile(const char *path, int &type);
254 >
255 > // Read directory of mountable disk image or archive file into c64_dir_entry vector
256 > extern bool ReadDirectory(const char *path, int type, vector<c64_dir_entry> &vec);
257  
258   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines