aboutsummaryrefslogtreecommitdiff
path: root/src/unalf.h
blob: 6096101d931525d29c356cb98a33991b0ec10694 (plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <sys/stat.h>
#include <f65.h>

#ifndef VERSION
#define VERSION "???"
#warning "VERSION not defined, defaulting to \"???\""
#endif

#ifndef u8
#define u8 unsigned char
#define u16 unsigned short
#endif

/* asmcode.c (converted from asm) */
void uncrunch_file(void);
void setup_io_bufs(void);
void L7A19(void);
void L79E7(void);
void L76D0(void);
void write_output(void);
void init_counters(void);
void store_outbyte(void);
void push_acc16(void);
void L7899(void);
void pop_acc16(void);
void L78C2(void);
void L7A19(void);
void L79E7(void);
void writeblock(void);
void L7A5D(void);

/* glob.c */
int globmatch(const char *pat, const char *arg);
int file_wanted(const char *filename);

/* io.c - asm rewritten in C */
int read_alf_header(void);
void readblock(void);
void writeblock(void);
void write_output(void);

/* io.c - just C */
void open_output(void);

/* listalf.c */
void list_alf(void);
unsigned int getquad(int offs);

/* extract.c */
extern int bad_checksum_count;
extern int new_file;
extern unsigned int bytes_written;
void extract_alf(void);
void dpoke(int addr, u16 value);
u16 dpeek(int addr);
void fix_filename(void);

/* opts.c */
void parse_opts(int argc, char * const *argv);

/* self.c */
extern char *self;
void set_self(char *argv0);

/* unalf.c */
extern char *self;
extern FILE *out_file;
extern FILE *in_file;
extern char *in_filename;

typedef struct {
	int txtconv;
	int testonly;
	int keepdot;
	int listonly;
	int lowercase;
	const char *outdir;
	int overwrite;
	int extract_to_stdout;
	int quiet;
	char *exclude_glob;
	int verbose_list;
} opts_t;

extern opts_t opts;
extern const char *exclude_globs[256];
extern char * const *include_globs;
extern int exclude_count;

#define MAX_EXCLUDES 256