ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/Frodo4/Src/1541t64.h
Revision: 1.5
Committed: 2004-01-12T15:13:20Z (20 years, 3 months ago) by cebix
Content type: text/plain
Branch: MAIN
Changes since 1.4: +1 -1 lines
Log Message:
Happy New Year!

File Contents

# Content
1 /*
2 * 1541t64.h - 1541 emulation in .t64/LYNX file
3 *
4 * Frodo (C) 1994-1997,2002-2004 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 uint8 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, const uint8 *name, int name_len);
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
52 uint8 open_file(int channel, const uint8 *name, int name_len);
53 uint8 open_directory(int channel, const uint8 *pattern, int pattern_len);
54 bool find_first_file(const uint8 *pattern, int pattern_len, int &num);
55 void close_all_channels(void);
56
57 virtual void rename_cmd(const uint8 *new_file, int new_file_len, const uint8 *old_file, int old_file_len);
58 virtual void initialize_cmd(void);
59 virtual void validate_cmd(void);
60
61 FILE *the_file; // File pointer for .t64 file
62 bool is_lynx; // Flag: .t64 file is really a LYNX archive
63
64 char orig_t64_name[256]; // Original path of .t64 file
65 char dir_title[16]; // Directory title
66 FILE *file[16]; // File pointers for each of the 16 channels (all temporary files)
67
68 int num_files; // Number of files in .t64 file and in file_info array
69 FileInfo *file_info; // Pointer to array of file information structs for each file
70
71 uint8 read_char[16]; // Buffers for one-byte read-ahead
72 };
73
74 #endif