-
Notifications
You must be signed in to change notification settings - Fork 2
/
t64.h
49 lines (40 loc) · 1.52 KB
/
t64.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
#pragma once
/* Structure definitions for the T64 archive format.
* NB: The structures are written here to be useable without knowing whether
* the machine's architecture is little- or big-endian (the file format
* is little-endian).
*/
#pragma pack(push,1)
/* Default number of entries */
#define STD_DIRSIZE 30
/* T64 archive header, 64 bytes */
typedef struct t64header_s {
char description[32]; /* "C64 tape image"+EOF+nulls */
unsigned char version[2]; /* $00 / $01 (=$0100) */
unsigned char maxfiles[2]; /* word */
unsigned char numfiles[2]; /* word */
unsigned char reserved[2];
char title[24]; /* Title (PETSCII), space padded */
} t64header_t;
/* Values for t64record_t.allocflag */
#define ALLOC_FREE 0
#define ALLOC_NORM 1
/* T64 file record */
typedef struct t64record_s {
unsigned char allocflag; /* 0 = free, 1 = normal, 2.. = others */
unsigned char filetype; /* Filetype (1 = program) / 2ndry address? */
unsigned char startaddress[2]; /* Start address of C64 file */
unsigned char endaddress[2]; /* Ending address of C64 file */
unsigned char reserved1[2];
unsigned char offset[4]; /* Start address in T64 */
unsigned char reserved2[4];
char filename[16]; /* Filename (PETSCII), space padded */
} t64record_t;
#pragma pack(pop)
/* T64 file layout:
* 0 t64header_t
* 64 t64record_t[t64header_t.maxfiles]
* 64+32*n start of file data
*/
int checkvalidheader(t64header_t *header_p, unsigned int *totalentries_p,
unsigned int *usedentries_p, const char *filename);