ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/Frodo4/Src/1541t64.h
Revision: 1.1
Committed: 2003-07-01T17:09:43Z (21 years, 4 months ago) by cebix
Content type: text/plain
Branch: MAIN
Log Message:
imported files

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * 1541t64.h - 1541 emulation in .t64/LYNX file
3     *
4     * Frodo (C) 1994-1997,2002 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
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19     */
20    
21     #ifndef _1541T64_H
22     #define _1541T64_H
23    
24     #include "IEC.h"
25    
26    
27     // Information for file inside a .t64 file
28     typedef struct {
29     char name[17]; // File name, PETSCII
30     uint8 type; // File type
31     uint8 sa_lo, sa_hi; // Start address
32     int offset; // Offset of first byte in .t64 file
33     int length; // Length of file
34     } FileInfo;
35    
36    
37     class T64Drive : public Drive {
38     public:
39     T64Drive(IEC *iec, char *filepath);
40     virtual ~T64Drive();
41     virtual uint8 Open(int channel, char *filename);
42     virtual uint8 Close(int channel);
43     virtual uint8 Read(int channel, uint8 *byte);
44     virtual uint8 Write(int channel, uint8 byte, bool eoi);
45     virtual void Reset(void);
46    
47     private:
48     void open_close_t64_file(char *t64name);
49     bool parse_t64_file(void);
50     bool parse_lynx_file(void);
51     uint8 open_file(int channel, char *filename);
52     uint8 open_directory(int channel, char *filename);
53     void convert_filename(char *srcname, char *destname, int *filemode, int *filetype);
54     bool find_first_file(char *name, int type, int *num);
55     void close_all_channels(void);
56     void execute_command(char *command);
57     void cht64_cmd(char *t64path);
58     uint8 conv_from_64(uint8 c, bool map_slash);
59    
60     FILE *the_file; // File pointer for .t64 file
61     bool is_lynx; // Flag: .t64 file is really a LYNX archive
62    
63     char orig_t64_name[256]; // Original path of .t64 file
64     char dir_title[16]; // Directory title
65     FILE *file[16]; // File pointers for each of the 16 channels (all temporary files)
66    
67     int num_files; // Number of files in .t64 file and in file_info array
68     FileInfo *file_info; // Pointer to array of file information structs for each file
69    
70     char cmd_buffer[44]; // Buffer for incoming command strings
71     int cmd_len; // Length of received command
72    
73     uint8 read_char[16]; // Buffers for one-byte read-ahead
74     };
75    
76     #endif