-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path1541t64.h
executable file
·81 lines (64 loc) · 2.56 KB
/
1541t64.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
Frodo, Commodore 64 emulator for the iPhone
Copyright (C) 1994-1997,2002 Christian Bauer
See gpl.txt for license information.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* 1541t64.h - 1541 emulation in .t64/LYNX file
*
* Frodo (C) 1994-1997,2002 Christian Bauer
*/
#ifndef _1541T64_H
#define _1541T64_H
#include "IEC.h"
// Information for file inside a .t64 file
typedef struct {
char name[17]; // File name, PETSCII
uint8 type; // File type
uint8 sa_lo, sa_hi; // Start address
int offset; // Offset of first byte in .t64 file
int length; // Length of file
} FileInfo;
class T64Drive : public Drive {
public:
T64Drive(IEC *iec, char *filepath);
virtual ~T64Drive();
virtual uint8 Open(int channel, char *filename);
virtual uint8 Close(int channel);
virtual uint8 Read(int channel, uint8 *byte);
virtual uint8 Write(int channel, uint8 byte, bool eoi);
virtual void Reset(void);
private:
void open_close_t64_file(const char *t64name);
bool parse_t64_file(void);
bool parse_lynx_file(void);
uint8 open_file(int channel, char *filename);
uint8 open_directory(int channel, char *filename);
void convert_filename(char *srcname, char *destname, int *filemode, int *filetype);
bool find_first_file(char *name, int type, int *num);
void close_all_channels(void);
void execute_command(char *command);
void cht64_cmd(char *t64path);
uint8 conv_from_64(uint8 c);
FILE *the_file; // File pointer for .t64 file
bool is_lynx; // Flag: .t64 file is really a LYNX archive
char orig_t64_name[256]; // Original path of .t64 file
char dir_title[16]; // Directory title
FILE *file[16]; // File pointers for each of the 16 channels (all temporary files)
int num_files; // Number of files in .t64 file and in file_info array
FileInfo *file_info; // Pointer to array of file information structs for each file
char cmd_buffer[44]; // Buffer for incoming command strings
int cmd_len; // Length of received command
uint8 read_char[16]; // Buffers for one-byte read-ahead
};
#endif