-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdis.h
More file actions
173 lines (132 loc) · 3.7 KB
/
dis.h
File metadata and controls
173 lines (132 loc) · 3.7 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
* dis6502 by Robert Bond, Udi Finkelstein, and Eric Smith
*
* Copyright 2000-2018 Eric Smith <spacewar@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. Note that permission is
* not granted to redistribute this program under the terms of any
* other version of the General Public License.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
*/
extern bool sevenbit; /* if true, mask character data with 0x7f
to ignore MSB */
typedef uint16_t addr_t;
#define NPREDEF 10
extern char *predef[];
extern int npredef;
extern char *file;
extern char *progname;
extern int bopt;
enum boot_mode { UNKNOWN, RAW_BINARY, ATARI_LOAD, C64_LOAD, ATARI_BOOT };
extern int base_address, vector_address;
#define MAX_ENTRY 100
extern int entry_count;
extern int entry_address[MAX_ENTRY];
extern bool prodos;
extern int asmout;
extern unsigned char f[];
extern unsigned char d[];
extern long offset[];
#define getword(x) (d[x] + (d[x+1] << 8))
#define getbyte(x) (d[x])
/* f bits */
#define LOADED 1 /* Location loaded */
#define JREF 2 /* Referenced as jump/branch dest */
#define DREF 4 /* Referenced as data */
#define SREF 8 /* Referenced as subroutine dest */
#define NAMED 0x10 /* Has a name */
#define TDONE 0x20 /* Has been traced */
#define ISOP 0x40 /* Is a valid instruction opcode */
#define OFFSET 0x80 /* should be printed as an offset */
struct info {
char *opn;
int nb;
int flag;
};
extern struct info optbl[];
/* Flags */
/* Where control goes */
#define JUMP 2
#define FORK 4
#define STOP 8
#define CTLMASK (JUMP|FORK|STOP)
/* Instruction format */
#define IMM 0x20
#define ABS 0x40
#define ACC 0x80
#define IMP 0x100
#define INX 0x200
#define INY 0x400
#define ZPX 0x800
#define ABX 0x1000
#define ABY 0x2000
#define REL 0x4000
#define IND 0x8000
#define ZPY 0x10000
#define ZPG 0x20000
#define INZ 0x40000
#define ADRMASK (IMM|ABS|ACC|IMP|INX|INY|ZPX|ABX|ABY|REL|IND|ZPY|ZPG|INZ)
struct ref_chain {
struct ref_chain *next;
int who;
};
struct ref_chain *get_ref(addr_t loc);
char *get_name(addr_t loc);
/* lex junk */
#define EQ 256
#define NUMBER 257
#define NAME 258
#define COMMENT 259
#define LI 260
#define TSTART 261
#define TSTOP 262
#define TRTSTAB 263
#define TJTAB2 264
#define TJTAB 265
#define EQS 266
#define OFS 267
extern FILE *yyin, *yyout;
int lineno;
int yywrap(), yyerror();
char *emalloc();
typedef union {
int ival;
char *sval;
} VALUE;
extern VALUE token;
/* in scanner generated from lex.l: */
int yylex (void);
/* in initopts.c: */
void initopts (int argc, char *argv[]);
/* in print.c: */
void dumpitout (void);
int pchar (int c);
void print_bytes (addr_t addr);
int print_inst(addr_t addr);
int print_data (addr_t i);
void print_refs (void);
/* in ref.c: */
void save_ref (addr_t refer, addr_t refee);
void save_name (addr_t loc, char *name);
/* in trace_queue.c: */
void init_trace_queue (void);
int trace_queue_empty (void);
void push_trace_queue (addr_t addr);
addr_t pop_trace_queue (void);
/* in main.c: */
void crash (char *p) __attribute__ ((noreturn));
void get_predef (void);
void loadboot (void);
void loadfile (void);
void c64loadfile (void);
void binaryloadfile (void);