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.2 by cebix, 2003-07-01T17:51:17Z vs.
Revision 1.4 by cebix, 2004-01-11T14:03:29Z

# Line 39 | Line 39 | enum {
39   // 1541 error codes
40   enum {
41          ERR_OK,                         // 00 OK
42 <        ERR_WRITEERROR,         // 25 WRITE ERROR
42 >        ERR_SCRATCHED,          // 01 FILES SCRATCHED
43 >        ERR_UNIMPLEMENTED,      // 03 UNIMPLEMENTED
44 >        ERR_READ20,                     // 20 READ ERROR (block header not found)
45 >        ERR_READ21,                     // 21 READ ERROR (no sync character)
46 >        ERR_READ22,                     // 22 READ ERROR (data block not present)
47 >        ERR_READ23,                     // 23 READ ERROR (checksum error in data block)
48 >        ERR_READ24,                     // 24 READ ERROR (byte decoding error)
49 >        ERR_WRITE25,            // 25 WRITE ERROR (write-verify error)
50          ERR_WRITEPROTECT,       // 26 WRITE PROTECT ON
51 <        ERR_SYNTAX30,           // 30 SYNTAX ERROR (unknown command)
51 >        ERR_READ27,                     // 27 READ ERROR (checksum error in header)
52 >        ERR_WRITE28,            // 28 WRITE ERROR (long data block)
53 >        ERR_DISKID,                     // 29 DISK ID MISMATCH
54 >        ERR_SYNTAX30,           // 30 SYNTAX ERROR (general syntax)
55 >        ERR_SYNTAX31,           // 31 SYNTAX ERROR (invalid command)
56 >        ERR_SYNTAX32,           // 32 SYNTAX ERROR (command too long)
57          ERR_SYNTAX33,           // 33 SYNTAX ERROR (wildcards on writing)
58 +        ERR_SYNTAX34,           // 34 SYNTAX ERROR (missing file name)
59          ERR_WRITEFILEOPEN,      // 60 WRITE FILE OPEN
60          ERR_FILENOTOPEN,        // 61 FILE NOT OPEN
61          ERR_FILENOTFOUND,       // 62 FILE NOT FOUND
62 <        ERR_ILLEGALTS,          // 67 ILLEGAL TRACK OR SECTOR
62 >        ERR_FILEEXISTS,         // 63 FILE EXISTS
63 >        ERR_FILETYPE,           // 64 FILE TYPE MISMATCH
64 >        ERR_NOBLOCK,            // 65 NO BLOCK
65 >        ERR_ILLEGALTS,          // 66 ILLEGAL TRACK OR SECTOR
66          ERR_NOCHANNEL,          // 70 NO CHANNEL
67 +        ERR_DIRERROR,           // 71 DIR ERROR
68 +        ERR_DISKFULL,           // 72 DISK FULL
69          ERR_STARTUP,            // 73 Power-up message
70          ERR_NOTREADY            // 74 DRIVE NOT READY
71   };
72  
73  
74 + // 1541 file types
75 + enum {
76 +        FTYPE_DEL,                      // Deleted
77 +        FTYPE_SEQ,                      // Sequential
78 +        FTYPE_PRG,                      // Program
79 +        FTYPE_USR,                      // User
80 +        FTYPE_REL,                      // Relative
81 +        FTYPE_UNKNOWN
82 + };
83 +
84 + static const char ftype_char[9] = "DSPUL   ";
85 +
86 +
87 + // 1541 file access modes
88 + enum {
89 +        FMODE_READ,                     // Read
90 +        FMODE_WRITE,            // Write
91 +        FMODE_APPEND,           // Append
92 +        FMODE_M                         // Read open file
93 + };
94 +
95 +
96   // IEC command codes
97   enum {
98          CMD_DATA = 0x60,        // Data transfer
# Line 95 | Line 135 | public:
135          uint8 Out(uint8 byte, bool eoi);
136          uint8 OutATN(uint8 byte);
137          uint8 OutSec(uint8 byte);
138 <        uint8 In(uint8 *byte);
138 >        uint8 In(uint8 &byte);
139          void SetATN(void);
140          void RelATN(void);
141          void Turnaround(void);
# Line 110 | Line 150 | private:
150          uint8 sec_talk(void);
151          uint8 open_out(uint8 byte, bool eoi);
152          uint8 data_out(uint8 byte, bool eoi);
153 <        uint8 data_in(uint8 *byte);
153 >        uint8 data_in(uint8 &byte);
154  
155          C64Display *the_display;        // Pointer to display object (for drive LEDs)
156  
157 <        char name_buf[NAMEBUF_LENGTH];  // Buffer for file names and command strings
158 <        char *name_ptr;                 // Pointer for reception of file name
157 >        uint8 name_buf[NAMEBUF_LENGTH]; // Buffer for file names and command strings
158 >        uint8 *name_ptr;                // Pointer for reception of file name
159          int name_len;                   // Received length of file name
160  
161          Drive *drive[4];                // 4 drives (8..11)
# Line 138 | Line 178 | public:
178          Drive(IEC *iec);
179          virtual ~Drive() {}
180  
181 <        virtual uint8 Open(int channel, char *filename)=0;
181 >        virtual uint8 Open(int channel, const uint8 *name, int name_len)=0;
182          virtual uint8 Close(int channel)=0;
183 <        virtual uint8 Read(int channel, uint8 *byte)=0;
183 >        virtual uint8 Read(int channel, uint8 &byte)=0;
184          virtual uint8 Write(int channel, uint8 byte, bool eoi)=0;
185          virtual void Reset(void)=0;
186  
# Line 148 | Line 188 | public:
188          bool Ready;                     // Drive is ready for operation
189  
190   protected:
191 <        void set_error(int error);
191 >        void set_error(int error, int track = 0, int sector = 0);
192 >
193 >        void parse_file_name(const uint8 *src, int src_len, uint8 *dest, int &dest_len, int &mode, int &type, int &rec_len, bool convert_charset = false);
194  
195 <        char *error_ptr;        // Pointer within error message
196 <        int error_len;          // Remaining length of error message
195 >        void execute_cmd(const uint8 *cmd, int cmd_len);
196 >        virtual void block_read_cmd(int channel, int track, int sector, bool user_cmd = false);
197 >        virtual void block_write_cmd(int channel, int track, int sector, bool user_cmd = false);
198 >        virtual void block_execute_cmd(int channel, int track, int sector);
199 >        virtual void block_allocate_cmd(int track, int sector);
200 >        virtual void block_free_cmd(int track, int sector);
201 >        virtual void buffer_pointer_cmd(int channel, int pos);
202 >        virtual void mem_read_cmd(uint16 adr, uint8 len);
203 >        virtual void mem_write_cmd(uint16 adr, uint8 len, uint8 *p);
204 >        virtual void mem_execute_cmd(uint16 adr);
205 >        virtual void copy_cmd(const uint8 *new_file, int new_file_len, const uint8 *old_files, int old_files_len);
206 >        virtual void rename_cmd(const uint8 *new_file, int new_file_len, const uint8 *old_file, int old_file_len);
207 >        virtual void scratch_cmd(const uint8 *files, int files_len);
208 >        virtual void position_cmd(const uint8 *cmd, int cmd_len);
209 >        virtual void initialize_cmd(void);
210 >        virtual void new_cmd(const uint8 *name, int name_len, const uint8 *comma);
211 >        virtual void validate_cmd(void);
212 >        void unsupp_cmd(void);
213 >
214 >        char error_buf[256];    // Buffer with current error message
215 >        char *error_ptr;                // Pointer within error message
216 >        int error_len;                  // Remaining length of error message
217 >        int current_error;              // Number of current error
218 >
219 >        uint8 cmd_buf[64];              // Buffer for incoming command strings
220 >        int cmd_len;                    // Length of received command
221  
222   private:
223 <        IEC *the_iec;           // Pointer to IEC object
223 >        IEC *the_iec;                   // Pointer to IEC object
224   };
225  
226 +
227 + // Convert ASCII character to PETSCII character
228 + extern char ascii2petscii(char c);
229 +
230 + // Convert ASCII string to PETSCII string
231 + extern void ascii2petscii(char *dest, const char *src, int max);
232 +
233 + // Convert PETSCII character to ASCII character
234 + extern char petscii2ascii(uint8 c);
235 +
236 + // Convert PETSCII string to ASCII string
237 + extern void petscii2ascii(char *dest, const char *src, int max);
238 +
239   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines