1 |
cebix |
1.1 |
/* |
2 |
cebix |
1.6 |
* 1541t64.h - 1541 emulation in archive-type files (.t64/LYNX/.p00) |
3 |
cebix |
1.1 |
* |
4 |
cebix |
1.5 |
* Frodo (C) 1994-1997,2002-2004 Christian Bauer |
5 |
cebix |
1.1 |
* |
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 |
cebix |
1.6 |
/* |
28 |
|
|
* Definitions |
29 |
|
|
*/ |
30 |
cebix |
1.1 |
|
31 |
cebix |
1.6 |
// Archive types |
32 |
|
|
enum { |
33 |
|
|
TYPE_T64, // C64S tape file |
34 |
|
|
TYPE_LYNX, // C64 LYNX archive |
35 |
|
|
TYPE_P00 // .p00 file |
36 |
|
|
}; |
37 |
cebix |
1.1 |
|
38 |
cebix |
1.6 |
// Archive file drive class |
39 |
|
|
class ArchDrive : public Drive { |
40 |
cebix |
1.1 |
public: |
41 |
cebix |
1.6 |
ArchDrive(IEC *iec, const char *filepath); |
42 |
|
|
virtual ~ArchDrive(); |
43 |
|
|
|
44 |
cebix |
1.3 |
virtual uint8 Open(int channel, const uint8 *name, int name_len); |
45 |
cebix |
1.1 |
virtual uint8 Close(int channel); |
46 |
cebix |
1.4 |
virtual uint8 Read(int channel, uint8 &byte); |
47 |
cebix |
1.1 |
virtual uint8 Write(int channel, uint8 byte, bool eoi); |
48 |
|
|
virtual void Reset(void); |
49 |
|
|
|
50 |
|
|
private: |
51 |
cebix |
1.6 |
bool change_arch(const char *path); |
52 |
cebix |
1.3 |
|
53 |
|
|
uint8 open_file(int channel, const uint8 *name, int name_len); |
54 |
|
|
uint8 open_directory(int channel, const uint8 *pattern, int pattern_len); |
55 |
|
|
bool find_first_file(const uint8 *pattern, int pattern_len, int &num); |
56 |
cebix |
1.1 |
void close_all_channels(void); |
57 |
cebix |
1.3 |
|
58 |
|
|
virtual void rename_cmd(const uint8 *new_file, int new_file_len, const uint8 *old_file, int old_file_len); |
59 |
|
|
virtual void initialize_cmd(void); |
60 |
|
|
virtual void validate_cmd(void); |
61 |
cebix |
1.1 |
|
62 |
cebix |
1.6 |
FILE *the_file; // File pointer for archive file |
63 |
|
|
int archive_type; // File/archive type (see defines above) |
64 |
|
|
vector<c64_dir_entry> file_info; // Vector of file information structs for all files in the archive |
65 |
cebix |
1.1 |
|
66 |
|
|
char dir_title[16]; // Directory title |
67 |
|
|
FILE *file[16]; // File pointers for each of the 16 channels (all temporary files) |
68 |
|
|
|
69 |
|
|
uint8 read_char[16]; // Buffers for one-byte read-ahead |
70 |
|
|
}; |
71 |
cebix |
1.6 |
|
72 |
|
|
|
73 |
|
|
/* |
74 |
|
|
* Functions |
75 |
|
|
*/ |
76 |
|
|
|
77 |
|
|
// Check whether file with given header (64 bytes) and size looks like one |
78 |
|
|
// of the file types supported by this module |
79 |
|
|
extern bool IsArchFile(const char *path, const uint8 *header, long size); |
80 |
|
|
|
81 |
|
|
// Read directory of archive file into (empty) c64_dir_entry vector |
82 |
|
|
extern bool ReadArchDirectory(const char *path, vector<c64_dir_entry> &vec); |
83 |
cebix |
1.1 |
|
84 |
|
|
#endif |