comparison d09.c @ 22:10e33568b38a

clean up
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 09 Jul 2018 14:07:30 +0900
parents os9/os9disass.c@111e5defb8ab
children 7c5379eb406e
comparison
equal deleted inserted replaced
21:1925cfa982fe 22:10e33568b38a
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <unistd.h>
7 #include <string.h>
8
9
10 /***************************************************************************
11 Originally posted to comp.sys.m6809 by Didier Derny (didier@aida.remcomp.fr)
12
13 Minor hacks by Alan DeKok
14
15 Fixed: D_Indexed addressing used prog[2] and prog[3] when it meant
16 prog[pc+2] and prog[pc+3]: Would produce flawed disassemblies!
17
18 changed addresses in D_Indexed to be all hex.
19 added 2 instances of 'extrabyte' in D_Indexed: would not skip them..
20 Added PC offsets to D_Indexed ,PCR formats
21 added SWI2 print out as OS9
22
23 To do:
24
25 handle command-line options properly...
26
27 Fix handling of illegal opcodes so it doesn't skip a byte
28 i.e. $87 is a skip 2
29
30 Move defines to another file
31
32 Add 6309 support
33 also add 6309 native-mode support, and listing of clock cycles for opcodes.
34
35 Add OS-9 support
36
37 add proper label-disassembly. i.e. 2-pass.
38
39 ****************************************************************************/
40
41 // extern int errno;
42 // extern char *sys_errlist[];
43
44 static unsigned char prog0[65536];
45 unsigned char *prog = prog0;
46
47 FILE *fp;
48
49 typedef struct {
50 char *name;
51 int clock;
52 int bytes;
53 int (*display)();
54 int (*execute)();
55 } Opcode;
56
57 typedef struct {
58 int address;
59 int length;
60 int width;
61 } String;
62
63 int D_Illegal(Opcode *, int, int, char *);
64 int D_Direct(Opcode *, int, int, char *);
65 int D_Page10(Opcode *, int, int, char *);
66 int D_Page11(Opcode *, int, int, char *);
67 int D_Immediat(Opcode *, int, int, char *);
68 int D_ImmediatL(Opcode *, int, int, char *);
69 int D_Inherent(Opcode *, int, int, char *);
70 int D_Indexed(Opcode *, int, int, char *);
71 int D_Extended(Opcode *, int, int, char *);
72 int D_Relative(Opcode *, int, int, char *);
73 int D_RelativeL(Opcode *, int, int, char *);
74 int D_Register0(Opcode *, int, int, char *);
75 int D_Register1(Opcode *, int, int, char *);
76 int D_Register2(Opcode *, int, int, char *);
77 int D_Page10(Opcode *, int, int, char *);
78 int D_Page11(Opcode *, int, int, char *);
79 int D_OS9(Opcode *, int, int, char *);
80 char *IndexRegister(int);
81
82 String stringtable[] = {
83 { 0xc321, 16, 16 },
84 { 0xc395, 258, 16 },
85 { 0xeb15, 50, 16 },
86 { 0xee6f, 128, 16 },
87 { 0xfdf4, 492, 16 },
88 { 0xfff0, 16, 2 },
89 };
90
91 int adoffset = 0;
92 int laststring = 6;
93
94 Opcode optable[] = {
95 { "NEG ", 6, 2, D_Direct, NULL }, /* 0x00 */
96 { "?????", 0, 1, D_Illegal, NULL }, /* 0x01 */
97 { "?????", 0, 1, D_Illegal, NULL }, /* 0x02 */
98 { "COM ", 6, 2, D_Direct, NULL }, /* 0x03 */
99 { "LSR ", 6, 2, D_Direct, NULL }, /* 0x04 */
100 { "?????", 0, 1, D_Illegal, NULL }, /* 0x05 */
101 { "ROR ", 6, 2, D_Direct, NULL }, /* 0x06 */
102 { "ASR ", 6, 2, D_Direct, NULL }, /* 0x07 */
103 { "LSL ", 6, 2, D_Direct, NULL }, /* 0x08 */
104 { "ROR ", 6, 2, D_Direct, NULL }, /* 0x09 */
105 { "DEC ", 6, 2, D_Direct, NULL }, /* 0x0a */
106 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0b */
107 { "INC ", 6, 2, D_Direct, NULL }, /* 0x0c */
108 { "TST ", 6, 2, D_Direct, NULL }, /* 0x0d */
109 { "JMP ", 3, 2, D_Direct, NULL }, /* 0x0e */
110 { "CLR ", 6, 2, D_Direct, NULL }, /* 0x0f */
111
112 { "", 0, 1, D_Page10, NULL }, /* 0x10 */
113 { "", 0, 1, D_Page11, NULL }, /* 0x11 */
114 { "NOP ", 2, 1, D_Inherent, NULL }, /* 0x12 */
115 { "SYNC ", 4, 1, D_Inherent, NULL }, /* 0x13 */
116 { "?????", 0, 1, D_Illegal, NULL }, /* 0x14 */
117 { "?????", 0, 1, D_Illegal, NULL }, /* 0x15 */
118 { "LBRA ", 5, 3, D_RelativeL, NULL }, /* 0x16 */
119 { "LBSR ", 9, 3, D_RelativeL, NULL }, /* 0x17 */
120 { "?????", 0, 1, D_Illegal, NULL }, /* 0x18 */
121 { "DAA ", 2, 1, D_Inherent, NULL }, /* 0x19 */
122 { "ORCC ", 3, 2, D_Immediat, NULL }, /* 0x1a */
123 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1b */
124 { "ANDCC", 3, 2, D_Immediat, NULL }, /* 0x1c */
125 { "SEX ", 2, 1, D_Inherent, NULL }, /* 0x1d */
126 { "EXG ", 8, 2, D_Register0, NULL }, /* 0x1e */
127 { "TFR ", 6, 2, D_Register0, NULL }, /* 0x1f */
128
129 { "BRA ", 3, 2, D_Relative, NULL }, /* 0x20 */
130 { "BRN ", 3, 2, D_Relative, NULL }, /* 0x21 */
131 { "BHI ", 3, 2, D_Relative, NULL }, /* 0x22 */
132 { "BLS ", 3, 2, D_Relative, NULL }, /* 0x23 */
133 { "BCC ", 3, 2, D_Relative, NULL }, /* 0x24 */
134 { "BCS ", 3, 2, D_Relative, NULL }, /* 0x25 */
135 { "BNE ", 3, 2, D_Relative, NULL }, /* 0x26 */
136 { "BEQ ", 3, 2, D_Relative, NULL }, /* 0x27 */
137 { "BVC ", 3, 2, D_Relative, NULL }, /* 0x28 */
138 { "BVS ", 3, 2, D_Relative, NULL }, /* 0x29 */
139 { "BPL ", 3, 2, D_Relative, NULL }, /* 0x2a */
140 { "BMI ", 3, 2, D_Relative, NULL }, /* 0x2b */
141 { "BGE ", 3, 2, D_Relative, NULL }, /* 0x2c */
142 { "BLT ", 3, 2, D_Relative, NULL }, /* 0x2d */
143 { "BGT ", 3, 2, D_Relative, NULL }, /* 0x2e */
144 { "BLE ", 3, 2, D_Relative, NULL }, /* 0x2f */
145
146 { "LEAX ", 4, 2, D_Indexed, NULL }, /* 0x30 */
147 { "LEAY ", 4, 2, D_Indexed, NULL }, /* 0x31 */
148 { "LEAS ", 4, 2, D_Indexed, NULL }, /* 0x32 */
149 { "LEAU ", 4, 2, D_Indexed, NULL }, /* 0x33 */
150 { "PSHS ", 5, 2, D_Register1, NULL }, /* 0x34 */
151 { "PULS ", 5, 2, D_Register1, NULL }, /* 0x35 */
152 { "PSHU ", 5, 2, D_Register2, NULL }, /* 0x36 */
153 { "PULU ", 5, 2, D_Register2, NULL }, /* 0x37 */
154 { "?????", 0, 1, D_Illegal, NULL }, /* 0x38 */
155 { "RTS ", 5, 1, D_Inherent, NULL }, /* 0x39 */
156 { "ABX ", 3, 1, D_Inherent, NULL }, /* 0x3a */
157 { "RTI ", 6, 1, D_Inherent, NULL }, /* 0x3b */
158 { "CWAI ", 20, 2, D_Inherent, NULL }, /* 0x3c */
159 { "MUL ", 11, 1, D_Inherent, NULL }, /* 0x3d */
160 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3e */
161 { "SWI ", 19, 1, D_Inherent, NULL }, /* 0x3f */
162
163 { "NEGA ", 2, 1, D_Inherent, NULL }, /* 0x40 */
164 { "?????", 0, 1, D_Illegal, NULL }, /* 0x41 */
165 { "?????", 0, 1, D_Illegal, NULL }, /* 0x42 */
166 { "COMA ", 2, 1, D_Inherent, NULL }, /* 0x43 */
167 { "LSRA ", 2, 1, D_Inherent, NULL }, /* 0x44 */
168 { "?????", 0, 1, D_Illegal, NULL }, /* 0x45 */
169 { "RORA ", 2, 1, D_Inherent, NULL }, /* 0x46 */
170 { "ASRA ", 2, 1, D_Inherent, NULL }, /* 0x47 */
171 { "LSLA ", 2, 1, D_Inherent, NULL }, /* 0x48 */
172 { "ROLA ", 2, 1, D_Inherent, NULL }, /* 0x49 */
173 { "DECA ", 2, 1, D_Inherent, NULL }, /* 0x4a */
174 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4b */
175 { "INCA ", 2, 1, D_Inherent, NULL }, /* 0x4c */
176 { "TSTA ", 2, 1, D_Inherent, NULL }, /* 0x4d */
177 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4e */
178 { "CLRA ", 2, 1, D_Inherent, NULL }, /* 0x4f */
179
180 { "NEGB ", 2, 1, D_Inherent, NULL }, /* 0x50 */
181 { "?????", 0, 1, D_Illegal, NULL }, /* 0x51 */
182 { "?????", 0, 1, D_Illegal, NULL }, /* 0x52 */
183 { "COMB ", 2, 1, D_Inherent, NULL }, /* 0x53 */
184 { "LSRB ", 2, 1, D_Inherent, NULL }, /* 0x54 */
185 { "?????", 0, 1, D_Illegal, NULL }, /* 0x55 */
186 { "RORB ", 2, 1, D_Inherent, NULL }, /* 0x56 */
187 { "ASRB ", 2, 1, D_Inherent, NULL }, /* 0x57 */
188 { "LSLB ", 2, 1, D_Inherent, NULL }, /* 0x58 */
189 { "ROLB ", 2, 1, D_Inherent, NULL }, /* 0x59 */
190 { "DECB ", 2, 1, D_Inherent, NULL }, /* 0x5a */
191 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5b */
192 { "INCB ", 2, 1, D_Inherent, NULL }, /* 0x5c */
193 { "TSTB ", 2, 1, D_Inherent, NULL }, /* 0x5d */
194 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5e */
195 { "CLRB ", 2, 1, D_Inherent, NULL }, /* 0x5f */
196
197 { "NEG ", 6, 2, D_Indexed, NULL }, /* 0x60 */
198 { "?????", 0, 2, D_Illegal, NULL }, /* 0x61 */
199 { "?????", 0, 2, D_Illegal, NULL }, /* 0x62 */
200 { "COM ", 6, 2, D_Indexed, NULL }, /* 0x63 */
201 { "LSR ", 6, 2, D_Indexed, NULL }, /* 0x64 */
202 { "?????", 0, 2, D_Indexed, NULL }, /* 0x65 */
203 { "ROR ", 6, 2, D_Indexed, NULL }, /* 0x66 */
204 { "ASR ", 6, 2, D_Indexed, NULL }, /* 0x67 */
205 { "LSL ", 6, 2, D_Indexed, NULL }, /* 0x68 */
206 { "ROL ", 6, 2, D_Indexed, NULL }, /* 0x69 */
207 { "DEC ", 6, 2, D_Indexed, NULL }, /* 0x6a */
208 { "?????", 0, 2, D_Illegal, NULL }, /* 0x6b */
209 { "INC ", 6, 2, D_Indexed, NULL }, /* 0x6c */
210 { "TST ", 6, 2, D_Indexed, NULL }, /* 0x6d */
211 { "JMP ", 3, 2, D_Indexed, NULL }, /* 0x6e */
212 { "CLR ", 6, 2, D_Indexed, NULL }, /* 0x6f */
213
214 { "NEG ", 7, 3, D_Extended, NULL }, /* 0x70 */
215 { "?????", 0, 1, D_Illegal, NULL }, /* 0x71 */
216 { "?????", 0, 1, D_Illegal, NULL }, /* 0x72 */
217 { "COM ", 7, 3, D_Extended, NULL }, /* 0x73 */
218 { "LSR ", 7, 3, D_Extended, NULL }, /* 0x74 */
219 { "?????", 0, 1, D_Illegal, NULL }, /* 0x75 */
220 { "ROR ", 7, 3, D_Extended, NULL }, /* 0x76 */
221 { "ASR ", 7, 3, D_Extended, NULL }, /* 0x77 */
222 { "LSL ", 7, 3, D_Extended, NULL }, /* 0x78 */
223 { "ROL ", 7, 3, D_Extended, NULL }, /* 0x79 */
224 { "DEC ", 7, 3, D_Extended, NULL }, /* 0x7a */
225 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7b */
226 { "INC ", 7, 3, D_Extended, NULL }, /* 0x7c */
227 { "TST ", 7, 3, D_Extended, NULL }, /* 0x7d */
228 { "JMP ", 4, 3, D_Extended, NULL }, /* 0x7e */
229 { "CLR ", 7, 3, D_Extended, NULL }, /* 0x7f */
230
231 { "SUBA ", 2, 2, D_Immediat, NULL }, /* 0x80 */
232 { "CMPA ", 2, 2, D_Immediat, NULL }, /* 0x81 */
233 { "SBCA ", 2, 2, D_Immediat, NULL }, /* 0x82 */
234 { "SUBD ", 4, 3, D_ImmediatL, NULL }, /* 0x83 */
235 { "ANDA ", 2, 2, D_Immediat, NULL }, /* 0x84 */
236 { "BITA ", 2, 2, D_Immediat, NULL }, /* 0x85 */
237 { "LDA ", 2, 2, D_Immediat, NULL }, /* 0x86 */
238 { "?????", 0, 2, D_Illegal, NULL }, /* 0x87 */
239 { "EORA ", 2, 2, D_Immediat, NULL }, /* 0x88 */
240 { "ADCA ", 2, 2, D_Immediat, NULL }, /* 0x89 */
241 { "ORA ", 2, 2, D_Immediat, NULL }, /* 0x8a */
242 { "ADDA ", 2, 2, D_Immediat, NULL }, /* 0x8b */
243 { "CMPX ", 4, 3, D_ImmediatL, NULL }, /* 0x8c */
244 { "BSR ", 7, 2, D_Relative, NULL }, /* 0x8d */
245 { "LDX ", 3, 3, D_ImmediatL, NULL }, /* 0x8e */
246 { "?????", 0, 2, D_Illegal, NULL }, /* 0x8f */
247
248 { "SUBA ", 4, 2, D_Direct, NULL }, /* 0x90 */
249 { "CMPA ", 4, 2, D_Direct, NULL }, /* 0x91 */
250 { "SBCA ", 4, 2, D_Direct, NULL }, /* 0x92 */
251 { "SUBD ", 6, 2, D_Direct, NULL }, /* 0x93 */
252 { "ANDA ", 4, 2, D_Direct, NULL }, /* 0x94 */
253 { "BITA ", 4, 2, D_Direct, NULL }, /* 0x95 */
254 { "LDA ", 4, 2, D_Direct, NULL }, /* 0x96 */
255 { "STA ", 4, 2, D_Direct, NULL }, /* 0x97 */
256 { "EORA ", 4, 2, D_Direct, NULL }, /* 0x98 */
257 { "ADCA ", 4, 2, D_Direct, NULL }, /* 0x99 */
258 { "ORA ", 4, 2, D_Direct, NULL }, /* 0x9a */
259 { "ADDA ", 4, 2, D_Direct, NULL }, /* 0x9b */
260 { "CMPX ", 6, 2, D_Direct, NULL }, /* 0x9c */
261 { "JSR ", 7, 2, D_Direct, NULL }, /* 0x9d */
262 { "LDX ", 5, 2, D_Direct, NULL }, /* 0x9e */
263 { "STX ", 5, 2, D_Direct, NULL }, /* 0x9f */
264
265 { "SUBA ", 4, 2, D_Indexed, NULL }, /* 0xa0 */
266 { "CMPA ", 4, 2, D_Indexed, NULL }, /* 0xa1 */
267 { "SBCA ", 4, 2, D_Indexed, NULL }, /* 0xa2 */
268 { "SUBD ", 6, 2, D_Indexed, NULL }, /* 0xa3 */
269 { "ANDA ", 4, 2, D_Indexed, NULL }, /* 0xa4 */
270 { "BITA ", 4, 2, D_Indexed, NULL }, /* 0xa5 */
271 { "LDA ", 4, 2, D_Indexed, NULL }, /* 0xa6 */
272 { "STA ", 4, 2, D_Indexed, NULL }, /* 0xa7 */
273 { "EORA ", 4, 2, D_Indexed, NULL }, /* 0xa8 */
274 { "ADCA ", 4, 2, D_Indexed, NULL }, /* 0xa9 */
275 { "ORA ", 4, 2, D_Indexed, NULL }, /* 0xaa */
276 { "ADDA ", 4, 2, D_Indexed, NULL }, /* 0xab */
277 { "CMPX ", 6, 2, D_Indexed, NULL }, /* 0xac */
278 { "JSR ", 7, 2, D_Indexed, NULL }, /* 0xad */
279 { "LDX ", 5, 2, D_Indexed, NULL }, /* 0xae */
280 { "STX ", 5, 2, D_Indexed, NULL }, /* 0xaf */
281
282 { "SUBA ", 5, 3, D_Extended, NULL }, /* 0xb0 */
283 { "CMPA ", 5, 3, D_Extended, NULL }, /* 0xb1 */
284 { "SBCA ", 5, 3, D_Extended, NULL }, /* 0xb2 */
285 { "SUBD ", 7, 3, D_Extended, NULL }, /* 0xb3 */
286 { "ANDA ", 5, 3, D_Extended, NULL }, /* 0xb4 */
287 { "BITA ", 5, 3, D_Extended, NULL }, /* 0xb5 */
288 { "LDA ", 5, 3, D_Extended, NULL }, /* 0xb6 */
289 { "STA ", 5, 3, D_Extended, NULL }, /* 0xb7 */
290 { "EORA ", 5, 3, D_Extended, NULL }, /* 0xb8 */
291 { "ADCA ", 5, 3, D_Extended, NULL }, /* 0xb9 */
292 { "ORA ", 5, 3, D_Extended, NULL }, /* 0xba */
293 { "ADDA ", 5, 3, D_Extended, NULL }, /* 0xbb */
294 { "CMPX ", 7, 3, D_Extended, NULL }, /* 0xbc */
295 { "JSR ", 8, 3, D_Extended, NULL }, /* 0xbd */
296 { "LDX ", 6, 3, D_Extended, NULL }, /* 0xbe */
297 { "STX ", 6, 3, D_Extended, NULL }, /* 0xbf */
298
299 { "SUBB ", 2, 2, D_Immediat, NULL }, /* 0xc0 */
300 { "CMPB ", 2, 2, D_Immediat, NULL }, /* 0xc1 */
301 { "SBCB ", 2, 2, D_Immediat, NULL }, /* 0xc2 */
302 { "ADDD ", 4, 3, D_ImmediatL, NULL }, /* 0xc3 */
303 { "ANDB ", 2, 2, D_Immediat, NULL }, /* 0xc4 */
304 { "BITB ", 2, 2, D_Immediat, NULL }, /* 0xc5 */
305 { "LDB ", 2, 2, D_Immediat, NULL }, /* 0xc6 */
306 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc7 */
307 { "EORB ", 2, 2, D_Immediat, NULL }, /* 0xc8 */
308 { "ADCB ", 2, 2, D_Immediat, NULL }, /* 0xc9 */
309 { "ORB ", 2, 2, D_Immediat, NULL }, /* 0xca */
310 { "ADDB ", 2, 2, D_Immediat, NULL }, /* 0xcb */
311 { "LDD ", 3, 3, D_ImmediatL, NULL }, /* 0xcc */
312 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcd */
313 { "LDU ", 3, 3, D_ImmediatL, NULL }, /* 0xce */
314 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcf */
315
316 { "SUBB ", 4, 2, D_Direct, NULL }, /* 0xd0 */
317 { "CMPB ", 4, 2, D_Direct, NULL }, /* 0xd1 */
318 { "SBCB ", 4, 2, D_Direct, NULL }, /* 0xd2 */
319 { "ADDD ", 6, 2, D_Direct, NULL }, /* 0xd3 */
320 { "ANDB ", 4, 2, D_Direct, NULL }, /* 0xd4 */
321 { "BITB ", 4, 2, D_Direct, NULL }, /* 0xd5 */
322 { "LDB ", 4, 2, D_Direct, NULL }, /* 0xd6 */
323 { "STB ", 4, 2, D_Direct, NULL }, /* 0xd7 */
324 { "EORB ", 4, 2, D_Direct, NULL }, /* 0xd8 */
325 { "ADCB ", 4, 2, D_Direct, NULL }, /* 0xd9 */
326 { "ORB ", 4, 2, D_Direct, NULL }, /* 0xda */
327 { "ADDB ", 4, 2, D_Direct, NULL }, /* 0xdb */
328 { "LDD ", 5, 2, D_Direct, NULL }, /* 0xdc */
329 { "STD ", 5, 2, D_Direct, NULL }, /* 0xdd */
330 { "LDU ", 5, 2, D_Direct, NULL }, /* 0xde */
331 { "STU ", 5, 2, D_Direct, NULL }, /* 0xdf */
332
333 { "SUBB ", 4, 2, D_Indexed, NULL }, /* 0xe0 */
334 { "CMPB ", 4, 2, D_Indexed, NULL }, /* 0xe1 */
335 { "SBCB ", 4, 2, D_Indexed, NULL }, /* 0xe2 */
336 { "ADDD ", 6, 2, D_Indexed, NULL }, /* 0xe3 */
337 { "ANDB ", 4, 2, D_Indexed, NULL }, /* 0xe4 */
338 { "BITB ", 4, 2, D_Indexed, NULL }, /* 0xe5 */
339 { "LDB ", 4, 2, D_Indexed, NULL }, /* 0xe6 */
340 { "STB ", 4, 2, D_Indexed, NULL }, /* 0xe7 */
341 { "EORB ", 4, 2, D_Indexed, NULL }, /* 0xe8 */
342 { "ADCB ", 4, 2, D_Indexed, NULL }, /* 0xe9 */
343 { "ORB ", 4, 2, D_Indexed, NULL }, /* 0xea */
344 { "ADDB ", 4, 2, D_Indexed, NULL }, /* 0xeb */
345 { "LDD ", 5, 2, D_Indexed, NULL }, /* 0xec */
346 { "STD ", 5, 2, D_Indexed, NULL }, /* 0xed */
347 { "LDU ", 5, 2, D_Indexed, NULL }, /* 0xee */
348 { "STU ", 5, 2, D_Indexed, NULL }, /* 0xef */
349
350 { "SUBB ", 5, 3, D_Extended, NULL }, /* 0xf0 */
351 { "CMPB ", 5, 3, D_Extended, NULL }, /* 0xf1 */
352 { "SBCB ", 5, 3, D_Extended, NULL }, /* 0xf2 */
353 { "ADDD ", 7, 3, D_Extended, NULL }, /* 0xf3 */
354 { "ANDB ", 5, 3, D_Extended, NULL }, /* 0xf4 */
355 { "BITB ", 5, 3, D_Extended, NULL }, /* 0xf5 */
356 { "LDB ", 5, 3, D_Extended, NULL }, /* 0xf6 */
357 { "STB ", 5, 3, D_Extended, NULL }, /* 0xf7 */
358 { "EORB ", 5, 3, D_Extended, NULL }, /* 0xf8 */
359 { "ADCB ", 5, 3, D_Extended, NULL }, /* 0xf9 */
360 { "ORB ", 5, 3, D_Extended, NULL }, /* 0xfa */
361 { "ADDB ", 5, 3, D_Extended, NULL }, /* 0xfb */
362 { "LDD ", 6, 3, D_Extended, NULL }, /* 0xfc */
363 { "STD ", 6, 3, D_Extended, NULL }, /* 0xfd */
364 { "LDU ", 6, 3, D_Extended, NULL }, /* 0xfe */
365 { "STU ", 6, 3, D_Extended, NULL }, /* 0xff */
366 };
367
368 Opcode optable10[] = {
369 { "?????", 0, 1, D_Illegal, NULL }, /* 0x00 */
370 { "?????", 0, 1, D_Illegal, NULL }, /* 0x01 */
371 { "?????", 0, 1, D_Illegal, NULL }, /* 0x02 */
372 { "?????", 0, 1, D_Illegal, NULL }, /* 0x03 */
373 { "?????", 0, 1, D_Illegal, NULL }, /* 0x04 */
374 { "?????", 0, 1, D_Illegal, NULL }, /* 0x05 */
375 { "?????", 0, 1, D_Illegal, NULL }, /* 0x06 */
376 { "?????", 0, 1, D_Illegal, NULL }, /* 0x07 */
377 { "?????", 0, 1, D_Illegal, NULL }, /* 0x08 */
378 { "?????", 0, 1, D_Illegal, NULL }, /* 0x09 */
379 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0a */
380 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0b */
381 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0c */
382 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0d */
383 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0e */
384 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0f */
385
386 { "?????", 0, 1, D_Illegal, NULL }, /* 0x10 */
387 { "?????", 0, 1, D_Illegal, NULL }, /* 0x11 */
388 { "?????", 0, 1, D_Illegal, NULL }, /* 0x12 */
389 { "?????", 0, 1, D_Illegal, NULL }, /* 0x13 */
390 { "?????", 0, 1, D_Illegal, NULL }, /* 0x14 */
391 { "?????", 0, 1, D_Illegal, NULL }, /* 0x15 */
392 { "?????", 0, 1, D_Illegal, NULL }, /* 0x16 */
393 { "?????", 0, 1, D_Illegal, NULL }, /* 0x17 */
394 { "?????", 0, 1, D_Illegal, NULL }, /* 0x18 */
395 { "?????", 0, 1, D_Illegal, NULL }, /* 0x19 */
396 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1a */
397 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1b */
398 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1c */
399 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1d */
400 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1e */
401 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1f */
402
403 { "?????", 0, 1, D_Illegal, NULL }, /* 0x20 */
404 { "LBRN ", 5, 4, D_RelativeL, NULL }, /* 0x21 */
405 { "LBHI ", 5, 4, D_RelativeL, NULL }, /* 0x22 */
406 { "LBLS ", 5, 4, D_RelativeL, NULL }, /* 0x23 */
407 { "LBCC ", 5, 4, D_RelativeL, NULL }, /* 0x24 */
408 { "LBCS ", 5, 4, D_RelativeL, NULL }, /* 0x25 */
409 { "LBNE ", 5, 4, D_RelativeL, NULL }, /* 0x26 */
410 { "LBEQ ", 5, 4, D_RelativeL, NULL }, /* 0x27 */
411 { "LBVC ", 5, 4, D_RelativeL, NULL }, /* 0x28 */
412 { "LBVS ", 5, 4, D_RelativeL, NULL }, /* 0x29 */
413 { "LBPL ", 5, 4, D_RelativeL, NULL }, /* 0x2a */
414 { "LBMI ", 5, 4, D_RelativeL, NULL }, /* 0x2b */
415 { "LBGE ", 5, 4, D_RelativeL, NULL }, /* 0x2c */
416 { "LBLT ", 5, 4, D_RelativeL, NULL }, /* 0x2d */
417 { "LBGT ", 5, 4, D_RelativeL, NULL }, /* 0x2e */
418 { "LBLE ", 5, 4, D_RelativeL, NULL }, /* 0x2f */
419
420 { "?????", 0, 1, D_Illegal, NULL }, /* 0x30 */
421 { "?????", 0, 1, D_Illegal, NULL }, /* 0x31 */
422 { "?????", 0, 1, D_Illegal, NULL }, /* 0x32 */
423 { "?????", 0, 1, D_Illegal, NULL }, /* 0x33 */
424 { "?????", 0, 1, D_Illegal, NULL }, /* 0x34 */
425 { "?????", 0, 1, D_Illegal, NULL }, /* 0x35 */
426 { "?????", 0, 1, D_Illegal, NULL }, /* 0x36 */
427 { "?????", 0, 1, D_Illegal, NULL }, /* 0x37 */
428 { "?????", 0, 1, D_Illegal, NULL }, /* 0x38 */
429 { "?????", 0, 1, D_Illegal, NULL }, /* 0x39 */
430 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3a */
431 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3b */
432 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3c */
433 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3d */
434 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3e */
435 /* Fake SWI2 as an OS9 F$xxx system call */
436 { "OS9 ", 20, 3, D_OS9, NULL }, /* 0x3f */
437
438 { "?????", 0, 1, D_Illegal, NULL }, /* 0x40 */
439 { "?????", 0, 1, D_Illegal, NULL }, /* 0x41 */
440 { "?????", 0, 1, D_Illegal, NULL }, /* 0x42 */
441 { "?????", 0, 1, D_Illegal, NULL }, /* 0x43 */
442 { "?????", 0, 1, D_Illegal, NULL }, /* 0x44 */
443 { "?????", 0, 1, D_Illegal, NULL }, /* 0x45 */
444 { "?????", 0, 1, D_Illegal, NULL }, /* 0x46 */
445 { "?????", 0, 1, D_Illegal, NULL }, /* 0x47 */
446 { "?????", 0, 1, D_Illegal, NULL }, /* 0x48 */
447 { "?????", 0, 1, D_Illegal, NULL }, /* 0x49 */
448 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4a */
449 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4b */
450 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4c */
451 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4d */
452 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4e */
453 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4f */
454
455 { "?????", 0, 1, D_Illegal, NULL }, /* 0x50 */
456 { "?????", 0, 1, D_Illegal, NULL }, /* 0x51 */
457 { "?????", 0, 1, D_Illegal, NULL }, /* 0x52 */
458 { "?????", 0, 1, D_Illegal, NULL }, /* 0x53 */
459 { "?????", 0, 1, D_Illegal, NULL }, /* 0x54 */
460 { "?????", 0, 1, D_Illegal, NULL }, /* 0x55 */
461 { "?????", 0, 1, D_Illegal, NULL }, /* 0x56 */
462 { "?????", 0, 1, D_Illegal, NULL }, /* 0x57 */
463 { "?????", 0, 1, D_Illegal, NULL }, /* 0x58 */
464 { "?????", 0, 1, D_Illegal, NULL }, /* 0x59 */
465 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5a */
466 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5b */
467 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5c */
468 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5d */
469 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5e */
470 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5f */
471
472 { "?????", 0, 1, D_Illegal, NULL }, /* 0x60 */
473 { "?????", 0, 1, D_Illegal, NULL }, /* 0x61 */
474 { "?????", 0, 1, D_Illegal, NULL }, /* 0x62 */
475 { "?????", 0, 1, D_Illegal, NULL }, /* 0x63 */
476 { "?????", 0, 1, D_Illegal, NULL }, /* 0x64 */
477 { "?????", 0, 1, D_Illegal, NULL }, /* 0x65 */
478 { "?????", 0, 1, D_Illegal, NULL }, /* 0x66 */
479 { "?????", 0, 1, D_Illegal, NULL }, /* 0x67 */
480 { "?????", 0, 1, D_Illegal, NULL }, /* 0x68 */
481 { "?????", 0, 1, D_Illegal, NULL }, /* 0x69 */
482 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6a */
483 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6b */
484 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6c */
485 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6d */
486 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6e */
487 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6f */
488
489 { "?????", 0, 1, D_Illegal, NULL }, /* 0x70 */
490 { "?????", 0, 1, D_Illegal, NULL }, /* 0x71 */
491 { "?????", 0, 1, D_Illegal, NULL }, /* 0x72 */
492 { "?????", 0, 1, D_Illegal, NULL }, /* 0x73 */
493 { "?????", 0, 1, D_Illegal, NULL }, /* 0x74 */
494 { "?????", 0, 1, D_Illegal, NULL }, /* 0x75 */
495 { "?????", 0, 1, D_Illegal, NULL }, /* 0x76 */
496 { "?????", 0, 1, D_Illegal, NULL }, /* 0x77 */
497 { "?????", 0, 1, D_Illegal, NULL }, /* 0x78 */
498 { "?????", 0, 1, D_Illegal, NULL }, /* 0x79 */
499 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7a */
500 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7b */
501 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7c */
502 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7d */
503 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7e */
504 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7f */
505
506 { "?????", 0, 1, D_Illegal, NULL }, /* 0x80 */
507 { "?????", 0, 1, D_Illegal, NULL }, /* 0x81 */
508 { "?????", 0, 1, D_Illegal, NULL }, /* 0x82 */
509 { "CMPD ", 5, 4, D_ImmediatL, NULL }, /* 0x83 */
510 { "?????", 0, 1, D_Illegal, NULL }, /* 0x84 */
511 { "?????", 0, 1, D_Illegal, NULL }, /* 0x85 */
512 { "?????", 0, 1, D_Illegal, NULL }, /* 0x86 */
513 { "?????", 0, 1, D_Illegal, NULL }, /* 0x87 */
514 { "?????", 0, 1, D_Illegal, NULL }, /* 0x88 */
515 { "?????", 0, 1, D_Illegal, NULL }, /* 0x89 */
516 { "?????", 0, 1, D_Illegal, NULL }, /* 0x8a */
517 { "?????", 0, 1, D_Illegal, NULL }, /* 0x8b */
518 { "CMPY ", 5, 4, D_ImmediatL, NULL }, /* 0x8c */
519 { "?????", 0, 1, D_Illegal, NULL }, /* 0x8d */
520 { "LDY ", 4, 4, D_ImmediatL, NULL }, /* 0x8e */
521 { "?????", 0, 1, D_Illegal, NULL }, /* 0x8f */
522
523 { "?????", 0, 1, D_Illegal, NULL }, /* 0x90 */
524 { "?????", 0, 1, D_Illegal, NULL }, /* 0x91 */
525 { "?????", 0, 1, D_Illegal, NULL }, /* 0x92 */
526 { "CMPD ", 7, 3, D_Direct, NULL }, /* 0x93 */
527 { "?????", 0, 1, D_Illegal, NULL }, /* 0x94 */
528 { "?????", 0, 1, D_Illegal, NULL }, /* 0x95 */
529 { "?????", 0, 1, D_Illegal, NULL }, /* 0x96 */
530 { "?????", 0, 1, D_Illegal, NULL }, /* 0x97 */
531 { "?????", 0, 1, D_Illegal, NULL }, /* 0x98 */
532 { "?????", 0, 1, D_Illegal, NULL }, /* 0x99 */
533 { "?????", 0, 1, D_Illegal, NULL }, /* 0x9a */
534 { "?????", 0, 1, D_Illegal, NULL }, /* 0x9b */
535 { "CMPY ", 7, 3, D_Direct, NULL }, /* 0x9c */
536 { "?????", 0, 1, D_Illegal, NULL }, /* 0x9d */
537 { "LDY ", 6, 3, D_Direct, NULL }, /* 0x9e */
538 { "STY ", 6, 3, D_Direct, NULL }, /* 0x9f */
539
540 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa0 */
541 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa1 */
542 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa2 */
543 { "CMPD ", 7, 3, D_Indexed, NULL }, /* 0xa3 */
544 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa4 */
545 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa5 */
546 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa6 */
547 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa7 */
548 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa8 */
549 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa9 */
550 { "?????", 0, 1, D_Illegal, NULL }, /* 0xaa */
551 { "?????", 0, 1, D_Illegal, NULL }, /* 0xab */
552 { "CMPY ", 7, 3, D_Indexed, NULL }, /* 0xac */
553 { "?????", 0, 1, D_Illegal, NULL }, /* 0xad */
554 { "LDY ", 6, 3, D_Indexed, NULL }, /* 0xae */
555 { "STY ", 6, 3, D_Indexed, NULL }, /* 0xaf */
556
557 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb0 */
558 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb1 */
559 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb2 */
560 { "CMPD ", 8, 4, D_Extended, NULL }, /* 0xb3 */
561 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb4 */
562 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb5 */
563 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb6 */
564 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb7 */
565 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb8 */
566 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb9 */
567 { "?????", 0, 1, D_Illegal, NULL }, /* 0xba */
568 { "?????", 0, 1, D_Illegal, NULL }, /* 0xbb */
569 { "CMPY ", 8, 4, D_Extended, NULL }, /* 0xbc */
570 { "?????", 0, 1, D_Illegal, NULL }, /* 0xbd */
571 { "LDY ", 7, 4, D_Extended, NULL }, /* 0xbe */
572 { "STY ", 7, 4, D_Extended, NULL }, /* 0xbf */
573
574 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc0 */
575 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc1 */
576 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc2 */
577 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc3 */
578 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc4 */
579 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc5 */
580 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc6 */
581 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc7 */
582 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc8 */
583 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc9 */
584 { "?????", 0, 1, D_Illegal, NULL }, /* 0xca */
585 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcb */
586 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcc */
587 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcd */
588 { "LDS ", 4, 4, D_ImmediatL, NULL }, /* 0xce */
589 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcf */
590
591 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd0 */
592 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd1 */
593 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd2 */
594 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd3 */
595 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd4 */
596 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd5 */
597 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd6 */
598 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd7 */
599 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd8 */
600 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd9 */
601 { "?????", 0, 1, D_Illegal, NULL }, /* 0xda */
602 { "?????", 0, 1, D_Illegal, NULL }, /* 0xdb */
603 { "?????", 0, 1, D_Illegal, NULL }, /* 0xdc */
604 { "?????", 0, 1, D_Illegal, NULL }, /* 0xdd */
605 { "LDS ", 6, 3, D_Direct, NULL }, /* 0xde */
606 { "STS ", 6, 3, D_Direct, NULL }, /* 0xdf */
607
608 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe0 */
609 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe1 */
610 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe2 */
611 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe3 */
612 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe4 */
613 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe5 */
614 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe6 */
615 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe7 */
616 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe8 */
617 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe9 */
618 { "?????", 0, 1, D_Illegal, NULL }, /* 0xea */
619 { "?????", 0, 1, D_Illegal, NULL }, /* 0xeb */
620 { "?????", 0, 1, D_Illegal, NULL }, /* 0xec */
621 { "?????", 0, 1, D_Illegal, NULL }, /* 0xed */
622 { "LDS ", 6, 3, D_Indexed, NULL }, /* 0xee */
623 { "STS ", 6, 3, D_Indexed, NULL }, /* 0xef */
624
625 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf0 */
626 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf1 */
627 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf2 */
628 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf3 */
629 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf4 */
630 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf5 */
631 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf6 */
632 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf7 */
633 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf8 */
634 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf9 */
635 { "?????", 0, 1, D_Illegal, NULL }, /* 0xfa */
636 { "?????", 0, 1, D_Illegal, NULL }, /* 0xfb */
637 { "?????", 0, 1, D_Illegal, NULL }, /* 0xfc */
638 { "?????", 0, 1, D_Illegal, NULL }, /* 0xfd */
639 { "LDS ", 7, 4, D_Extended, NULL }, /* 0xfe */
640 { "STS ", 7, 4, D_Extended, NULL }, /* 0xff */
641
642 };
643
644
645 Opcode optable11[] = {
646 { "?????", 0, 1, D_Illegal, NULL }, /* 0x00 */
647 { "?????", 0, 1, D_Illegal, NULL }, /* 0x01 */
648 { "?????", 0, 1, D_Illegal, NULL }, /* 0x02 */
649 { "?????", 0, 1, D_Illegal, NULL }, /* 0x03 */
650 { "?????", 0, 1, D_Illegal, NULL }, /* 0x04 */
651 { "?????", 0, 1, D_Illegal, NULL }, /* 0x05 */
652 { "?????", 0, 1, D_Illegal, NULL }, /* 0x06 */
653 { "?????", 0, 1, D_Illegal, NULL }, /* 0x07 */
654 { "?????", 0, 1, D_Illegal, NULL }, /* 0x08 */
655 { "?????", 0, 1, D_Illegal, NULL }, /* 0x09 */
656 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0a */
657 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0b */
658 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0c */
659 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0d */
660 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0e */
661 { "?????", 0, 1, D_Illegal, NULL }, /* 0x0f */
662
663 { "?????", 0, 1, D_Illegal, NULL }, /* 0x10 */
664 { "?????", 0, 1, D_Illegal, NULL }, /* 0x11 */
665 { "?????", 0, 1, D_Illegal, NULL }, /* 0x12 */
666 { "?????", 0, 1, D_Illegal, NULL }, /* 0x13 */
667 { "?????", 0, 1, D_Illegal, NULL }, /* 0x14 */
668 { "?????", 0, 1, D_Illegal, NULL }, /* 0x15 */
669 { "?????", 0, 1, D_Illegal, NULL }, /* 0x16 */
670 { "?????", 0, 1, D_Illegal, NULL }, /* 0x17 */
671 { "?????", 0, 1, D_Illegal, NULL }, /* 0x18 */
672 { "?????", 0, 1, D_Illegal, NULL }, /* 0x19 */
673 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1a */
674 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1b */
675 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1c */
676 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1d */
677 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1e */
678 { "?????", 0, 1, D_Illegal, NULL }, /* 0x1f */
679
680 { "?????", 0, 1, D_Illegal, NULL }, /* 0x20 */
681 { "?????", 0, 1, D_Illegal, NULL }, /* 0x21 */
682 { "?????", 0, 1, D_Illegal, NULL }, /* 0x22 */
683 { "?????", 0, 1, D_Illegal, NULL }, /* 0x23 */
684 { "?????", 0, 1, D_Illegal, NULL }, /* 0x24 */
685 { "?????", 0, 1, D_Illegal, NULL }, /* 0x25 */
686 { "?????", 0, 1, D_Illegal, NULL }, /* 0x26 */
687 { "?????", 0, 1, D_Illegal, NULL }, /* 0x27 */
688 { "?????", 0, 1, D_Illegal, NULL }, /* 0x28 */
689 { "?????", 0, 1, D_Illegal, NULL }, /* 0x29 */
690 { "?????", 0, 1, D_Illegal, NULL }, /* 0x2a */
691 { "?????", 0, 1, D_Illegal, NULL }, /* 0x2b */
692 { "?????", 0, 1, D_Illegal, NULL }, /* 0x2c */
693 { "?????", 0, 1, D_Illegal, NULL }, /* 0x2d */
694 { "?????", 0, 1, D_Illegal, NULL }, /* 0x2e */
695 { "?????", 0, 1, D_Illegal, NULL }, /* 0x2f */
696
697 { "?????", 0, 1, D_Illegal, NULL }, /* 0x30 */
698 { "?????", 0, 1, D_Illegal, NULL }, /* 0x31 */
699 { "?????", 0, 1, D_Illegal, NULL }, /* 0x32 */
700 { "?????", 0, 1, D_Illegal, NULL }, /* 0x33 */
701 { "?????", 0, 1, D_Illegal, NULL }, /* 0x34 */
702 { "?????", 0, 1, D_Illegal, NULL }, /* 0x35 */
703 { "?????", 0, 1, D_Illegal, NULL }, /* 0x36 */
704 { "?????", 0, 1, D_Illegal, NULL }, /* 0x37 */
705 { "?????", 0, 1, D_Illegal, NULL }, /* 0x38 */
706 { "?????", 0, 1, D_Illegal, NULL }, /* 0x39 */
707 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3a */
708 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3b */
709 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3c */
710 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3d */
711 { "?????", 0, 1, D_Illegal, NULL }, /* 0x3e */
712 { "SWI3 ", 20, 2, D_Inherent, NULL }, /* 0x3f */
713
714 { "?????", 0, 1, D_Illegal, NULL }, /* 0x40 */
715 { "?????", 0, 1, D_Illegal, NULL }, /* 0x41 */
716 { "?????", 0, 1, D_Illegal, NULL }, /* 0x42 */
717 { "?????", 0, 1, D_Illegal, NULL }, /* 0x43 */
718 { "?????", 0, 1, D_Illegal, NULL }, /* 0x44 */
719 { "?????", 0, 1, D_Illegal, NULL }, /* 0x45 */
720 { "?????", 0, 1, D_Illegal, NULL }, /* 0x46 */
721 { "?????", 0, 1, D_Illegal, NULL }, /* 0x47 */
722 { "?????", 0, 1, D_Illegal, NULL }, /* 0x48 */
723 { "?????", 0, 1, D_Illegal, NULL }, /* 0x49 */
724 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4a */
725 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4b */
726 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4c */
727 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4d */
728 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4e */
729 { "?????", 0, 1, D_Illegal, NULL }, /* 0x4f */
730
731 { "?????", 0, 1, D_Illegal, NULL }, /* 0x50 */
732 { "?????", 0, 1, D_Illegal, NULL }, /* 0x51 */
733 { "?????", 0, 1, D_Illegal, NULL }, /* 0x52 */
734 { "?????", 0, 1, D_Illegal, NULL }, /* 0x53 */
735 { "?????", 0, 1, D_Illegal, NULL }, /* 0x54 */
736 { "?????", 0, 1, D_Illegal, NULL }, /* 0x55 */
737 { "?????", 0, 1, D_Illegal, NULL }, /* 0x56 */
738 { "?????", 0, 1, D_Illegal, NULL }, /* 0x57 */
739 { "?????", 0, 1, D_Illegal, NULL }, /* 0x58 */
740 { "?????", 0, 1, D_Illegal, NULL }, /* 0x59 */
741 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5a */
742 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5b */
743 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5c */
744 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5d */
745 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5e */
746 { "?????", 0, 1, D_Illegal, NULL }, /* 0x5f */
747
748 { "?????", 0, 1, D_Illegal, NULL }, /* 0x60 */
749 { "?????", 0, 1, D_Illegal, NULL }, /* 0x61 */
750 { "?????", 0, 1, D_Illegal, NULL }, /* 0x62 */
751 { "?????", 0, 1, D_Illegal, NULL }, /* 0x63 */
752 { "?????", 0, 1, D_Illegal, NULL }, /* 0x64 */
753 { "?????", 0, 1, D_Illegal, NULL }, /* 0x65 */
754 { "?????", 0, 1, D_Illegal, NULL }, /* 0x66 */
755 { "?????", 0, 1, D_Illegal, NULL }, /* 0x67 */
756 { "?????", 0, 1, D_Illegal, NULL }, /* 0x68 */
757 { "?????", 0, 1, D_Illegal, NULL }, /* 0x69 */
758 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6a */
759 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6b */
760 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6c */
761 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6d */
762 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6e */
763 { "?????", 0, 1, D_Illegal, NULL }, /* 0x6f */
764
765 { "?????", 0, 1, D_Illegal, NULL }, /* 0x70 */
766 { "?????", 0, 1, D_Illegal, NULL }, /* 0x71 */
767 { "?????", 0, 1, D_Illegal, NULL }, /* 0x72 */
768 { "?????", 0, 1, D_Illegal, NULL }, /* 0x73 */
769 { "?????", 0, 1, D_Illegal, NULL }, /* 0x74 */
770 { "?????", 0, 1, D_Illegal, NULL }, /* 0x75 */
771 { "?????", 0, 1, D_Illegal, NULL }, /* 0x76 */
772 { "?????", 0, 1, D_Illegal, NULL }, /* 0x77 */
773 { "?????", 0, 1, D_Illegal, NULL }, /* 0x78 */
774 { "?????", 0, 1, D_Illegal, NULL }, /* 0x79 */
775 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7a */
776 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7b */
777 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7c */
778 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7d */
779 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7e */
780 { "?????", 0, 1, D_Illegal, NULL }, /* 0x7f */
781
782 { "?????", 0, 1, D_Illegal, NULL }, /* 0x80 */
783 { "?????", 0, 1, D_Illegal, NULL }, /* 0x81 */
784 { "?????", 0, 1, D_Illegal, NULL }, /* 0x82 */
785 { "CMPU ", 5, 4, D_ImmediatL, NULL }, /* 0x83 */
786 { "?????", 0, 1, D_Illegal, NULL }, /* 0x84 */
787 { "?????", 0, 1, D_Illegal, NULL }, /* 0x85 */
788 { "?????", 0, 1, D_Illegal, NULL }, /* 0x86 */
789 { "?????", 0, 1, D_Illegal, NULL }, /* 0x87 */
790 { "?????", 0, 1, D_Illegal, NULL }, /* 0x88 */
791 { "?????", 0, 1, D_Illegal, NULL }, /* 0x89 */
792 { "?????", 0, 1, D_Illegal, NULL }, /* 0x8a */
793 { "?????", 0, 1, D_Illegal, NULL }, /* 0x8b */
794 { "CMPS ", 5, 4, D_ImmediatL, NULL }, /* 0x8c */
795 { "?????", 0, 1, D_Illegal, NULL }, /* 0x8d */
796 { "?????", 0, 1, D_Illegal, NULL }, /* 0x8e */
797 { "?????", 0, 1, D_Illegal, NULL }, /* 0x8f */
798
799 { "?????", 0, 1, D_Illegal, NULL }, /* 0x90 */
800 { "?????", 0, 1, D_Illegal, NULL }, /* 0x91 */
801 { "?????", 0, 1, D_Illegal, NULL }, /* 0x92 */
802 { "CMPU ", 7, 3, D_Direct, NULL }, /* 0x93 */
803 { "?????", 0, 1, D_Illegal, NULL }, /* 0x94 */
804 { "?????", 0, 1, D_Illegal, NULL }, /* 0x95 */
805 { "?????", 0, 1, D_Illegal, NULL }, /* 0x96 */
806 { "?????", 0, 1, D_Illegal, NULL }, /* 0x97 */
807 { "?????", 0, 1, D_Illegal, NULL }, /* 0x98 */
808 { "?????", 0, 1, D_Illegal, NULL }, /* 0x99 */
809 { "?????", 0, 1, D_Illegal, NULL }, /* 0x9a */
810 { "?????", 0, 1, D_Illegal, NULL }, /* 0x9b */
811 { "CMPS ", 7, 3, D_Direct, NULL }, /* 0x9c */
812 { "?????", 0, 1, D_Illegal, NULL }, /* 0x9d */
813 { "?????", 0, 1, D_Illegal, NULL }, /* 0x9e */
814 { "?????", 0, 1, D_Illegal, NULL }, /* 0x9f */
815
816 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa0 */
817 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa1 */
818 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa2 */
819 { "CMPU ", 7, 3, D_Indexed, NULL }, /* 0xa3 */
820 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa4 */
821 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa5 */
822 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa6 */
823 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa7 */
824 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa8 */
825 { "?????", 0, 1, D_Illegal, NULL }, /* 0xa9 */
826 { "?????", 0, 1, D_Illegal, NULL }, /* 0xaa */
827 { "?????", 0, 1, D_Illegal, NULL }, /* 0xab */
828 { "CMPS ", 7, 3, D_Indexed, NULL }, /* 0xac */
829 { "?????", 0, 1, D_Illegal, NULL }, /* 0xad */
830 { "?????", 0, 1, D_Illegal, NULL }, /* 0xae */
831 { "?????", 0, 1, D_Illegal, NULL }, /* 0xaf */
832
833 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb0 */
834 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb1 */
835 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb2 */
836 { "CMPU ", 8, 4, D_Extended, NULL }, /* 0xb3 */
837 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb4 */
838 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb5 */
839 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb6 */
840 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb7 */
841 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb8 */
842 { "?????", 0, 1, D_Illegal, NULL }, /* 0xb9 */
843 { "?????", 0, 1, D_Illegal, NULL }, /* 0xba */
844 { "?????", 0, 1, D_Illegal, NULL }, /* 0xbb */
845 { "CMPS ", 8, 4, D_Extended, NULL }, /* 0xbc */
846 { "?????", 0, 1, D_Illegal, NULL }, /* 0xbd */
847 { "?????", 0, 1, D_Illegal, NULL }, /* 0xbe */
848 { "?????", 0, 1, D_Illegal, NULL }, /* 0xbf */
849
850 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc0 */
851 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc1 */
852 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc2 */
853 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc3 */
854 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc4 */
855 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc5 */
856 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc6 */
857 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc7 */
858 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc8 */
859 { "?????", 0, 1, D_Illegal, NULL }, /* 0xc9 */
860 { "?????", 0, 1, D_Illegal, NULL }, /* 0xca */
861 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcb */
862 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcc */
863 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcd */
864 { "?????", 0, 1, D_Illegal, NULL }, /* 0xce */
865 { "?????", 0, 1, D_Illegal, NULL }, /* 0xcf */
866
867 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd0 */
868 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd1 */
869 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd2 */
870 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd3 */
871 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd4 */
872 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd5 */
873 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd6 */
874 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd7 */
875 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd8 */
876 { "?????", 0, 1, D_Illegal, NULL }, /* 0xd9 */
877 { "?????", 0, 1, D_Illegal, NULL }, /* 0xda */
878 { "?????", 0, 1, D_Illegal, NULL }, /* 0xdb */
879 { "?????", 0, 1, D_Illegal, NULL }, /* 0xdc */
880 { "?????", 0, 1, D_Illegal, NULL }, /* 0xdd */
881 { "?????", 0, 1, D_Illegal, NULL }, /* 0xde */
882 { "?????", 0, 1, D_Illegal, NULL }, /* 0xdf */
883
884 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe0 */
885 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe1 */
886 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe2 */
887 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe3 */
888 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe4 */
889 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe5 */
890 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe6 */
891 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe7 */
892 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe8 */
893 { "?????", 0, 1, D_Illegal, NULL }, /* 0xe9 */
894 { "?????", 0, 1, D_Illegal, NULL }, /* 0xea */
895 { "?????", 0, 1, D_Illegal, NULL }, /* 0xeb */
896 { "?????", 0, 1, D_Illegal, NULL }, /* 0xec */
897 { "?????", 0, 1, D_Illegal, NULL }, /* 0xed */
898 { "?????", 0, 1, D_Illegal, NULL }, /* 0xee */
899 { "?????", 0, 1, D_Illegal, NULL }, /* 0xef */
900
901 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf0 */
902 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf1 */
903 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf2 */
904 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf3 */
905 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf4 */
906 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf5 */
907 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf6 */
908 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf7 */
909 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf8 */
910 { "?????", 0, 1, D_Illegal, NULL }, /* 0xf9 */
911 { "?????", 0, 1, D_Illegal, NULL }, /* 0xfa */
912 { "?????", 0, 1, D_Illegal, NULL }, /* 0xfb */
913 { "?????", 0, 1, D_Illegal, NULL }, /* 0xfc */
914 { "?????", 0, 1, D_Illegal, NULL }, /* 0xfd */
915 { "?????", 0, 1, D_Illegal, NULL }, /* 0xfe */
916 { "?????", 0, 1, D_Illegal, NULL }, /* 0xff */
917 };
918
919
920 struct os9syscall { int code; char *name; } os9sys[] = {
921 {0x0000,"F$LINK"},
922 {0x0001,"F$LOAD"},
923 {0x0002,"F$UNLINK"},
924 {0x0003,"F$FORK"},
925 {0x0004,"F$WAIT"},
926 {0x0005,"F$CHAIN"},
927 {0x0006,"F$EXIT"},
928 {0x0007,"F$MEM"},
929 {0x0008,"F$SEND"},
930 {0x0009,"F$ICPT"},
931 {0x000a,"F$SLEEP"},
932 {0x000b,"F$SSPD"},
933 {0x000c,"F$ID"},
934 {0x000d,"F$SPRIOR"},
935 {0x000e,"F$SSWI"},
936 {0x000f,"F$PERR"},
937 {0x0010,"F$PRSNAM"},
938 {0x0011,"F$CMPNAM"},
939 {0x0012,"F$SCHBIT"},
940 {0x0013,"F$ALLBIT"},
941 {0x0014,"F$DELBIT"},
942 {0x0015,"F$TIME"},
943 {0x0016,"F$STIME"},
944 {0x0017,"F$CRC"},
945 {0x0018,"F$GPRDSC"},
946 {0x0019,"F$GBLKMP"},
947 {0x001a,"F$GMODDR"},
948 {0x001b,"F$CPYMEM"},
949 {0x001c,"F$SUSER"},
950 {0x001d,"F$UNLOAD"},
951 {0x0027,"F$VIRQ"},
952 {0x0028,"F$SRQMEM"},
953 {0x0029,"F$SRTMEM"},
954 {0x002a,"F$IRQ"},
955 {0x002b,"F$IOQU"},
956 {0x002c,"F$APROC"},
957 {0x002d,"F$NPROC"},
958 {0x002e,"F$VMODUL"},
959 {0x002f,"F$FIND64"},
960 {0x0030,"F$ALL64"},
961 {0x0031,"F$RET64"},
962 {0x0032,"F$SSVC"},
963 {0x0033,"F$IODEL"},
964 {0x0034,"F$SLINK"},
965 {0x0035,"F$BOOT"},
966 {0x0036,"F$BTMEM"},
967 {0x0037,"F$GPROCP"},
968 {0x0038,"F$MOVE"},
969 {0x0039,"F$ALLRAM"},
970 {0x003a,"F$ALLIMG"},
971 {0x003b,"F$DELIMG"},
972 {0x003c,"F$SETIMG"},
973 {0x003d,"F$FREELB"},
974 {0x003e,"F$FREEHB"},
975 {0x003f,"F$ALLTSK"},
976 {0x0040,"F$DELTSK"},
977 {0x0041,"F$SETTSK"},
978 {0x0042,"F$RESTSK"},
979 {0x0043,"F$RELTSK"},
980 {0x0044,"F$DATLOG"},
981 {0x0045,"F$DATTMP"},
982 {0x0046,"F$LDAXY"},
983 {0x0047,"F$LDAXYP"},
984 {0x0048,"F$LDDDXY"},
985 {0x0049,"F$LDABX"},
986 {0x004a,"F$STABX"},
987 {0x004b,"F$ALLPRC"},
988 {0x004c,"F$DELPRC"},
989 {0x004d,"F$ELINK"},
990 {0x004e,"F$FMODUL"},
991 {0x004f,"F$MAPBLK"},
992 {0x0050,"F$CLRBLK"},
993 {0x0051,"F$DELRAM"},
994 {0x0052,"F$GCMDIR"},
995 {0x0053,"F$ALHRAM"},
996 {0x0080 , "I$ATTACH"},
997 {0x0081, "I$DETACH"},
998 {0x0082 , "I$DUP"},
999 {0x0083 , "I$CREATE"},
1000 {0x0084, "I$OPEN"},
1001 {0x0085 , "I$MAKDIR"},
1002 {0x0086 , "I$CHGDIR"},
1003 {0x0087 , "I$DELETE"},
1004 {0x0088, "I$SEEK"},
1005 {0x0089 , "I$READ"},
1006 {0x008a, "I$WRITE"},
1007 {0x008b , "I$READLN"},
1008 {0x008c , "I$WRITLN"},
1009 {0x008d, "I$GETSTT"},
1010 {0x008e , "I$SSTT"},
1011 {0x008f , "I$CLOSE"},
1012 {0x0090 , "I$DELETX"},
1013 } ;
1014
1015
1016 int iotable[32] = {
1017 0x0000,
1018 0x0001,
1019 0x0002,
1020 0x0003,
1021 0x0008,
1022 0x0009,
1023 0x000a,
1024 0x000b,
1025 0x000c,
1026 0x000d,
1027 0x000e,
1028 0x0010,
1029 0x0011,
1030 0x0012,
1031 0x0013,
1032 0x0014,
1033 0x8000,
1034 0x8001,
1035 0x8002,
1036 0x8003,
1037 0x8004,
1038 0x8005,
1039 0x8006,
1040 0x8007,
1041 0x8008,
1042 0x8009,
1043 0x800a,
1044 0x800b,
1045 0x800c,
1046 0x800d,
1047 0x800e,
1048 0x800f,
1049 };
1050
1051 char *iocomment[32] = {
1052 "Data direction register port 1",
1053 "Data direction register port 2",
1054 "I/O register port 1",
1055 "I/O register port 2",
1056 "Timer control and status",
1057 "Counter high byte",
1058 "Counter low byte",
1059 "Output compare high byte",
1060 "Output compare low byte",
1061 "Input capture high byte",
1062 "Input capture low byte",
1063 "Serial rate and mode register",
1064 "Serial control and status register",
1065 "Serial receiver data register",
1066 "Serial transmit data register",
1067 "Ram control register",
1068 "Modem port 0",
1069 "Modem port 1",
1070 "Modem port 2",
1071 "Modem port 3",
1072 "Modem port 4",
1073 "Modem port 5",
1074 "Modem port 6",
1075 "Modem port 7",
1076 "Modem port 8",
1077 "Modem port 9",
1078 "Modem port 10",
1079 "Modem port 11",
1080 "Modem port 12",
1081 "Modem port 13",
1082 "Modem port 14",
1083 "Modem port 15",
1084 };
1085
1086 char *Inter_Register[16]={"D","X","Y","U","S","PC","??","??","A","B","CC","DP","??","??","??","??"};
1087
1088 char *Indexed_Register[4]={"X","Y","U","S"};
1089
1090 int lastio = 32;
1091
1092 #pragma argsused
1093 int D_Illegal(op, code, pc, suffix)
1094 Opcode *op;
1095 int code;
1096 int pc;
1097 char *suffix;
1098 {
1099 fprintf(fp,"%0.2X %s%s", code, suffix, op->name);
1100 return op->bytes;
1101 }
1102
1103 #pragma argsused
1104 int D_Direct(op, code, pc, suffix)
1105 Opcode *op;
1106 int code;
1107 int pc;
1108 char *suffix;
1109 {
1110 int offset;
1111
1112 offset = prog[pc+1];
1113 fprintf(fp,"%0.2X %0.2X %s%s <$%0.2X",
1114 code, offset, suffix, op->name, offset);
1115 return op->bytes;
1116 }
1117
1118 #pragma argsused
1119 int D_Page10(op, code, pc, suffix)
1120 Opcode *op;
1121 int code;
1122 int pc;
1123 char *suffix;
1124 {
1125 fprintf(fp,"10 ");
1126 code = prog[pc+1];
1127 return (*optable10[code].display)(&optable10[code], code, pc+1, "");
1128 }
1129
1130 #pragma argsused
1131 int D_Page11(op, code, pc, suffix)
1132 Opcode *op;
1133 int code;
1134 int pc;
1135 char *suffix;
1136 {
1137 fprintf(fp,"11 ");
1138 code = prog[pc+1];
1139 return (*optable11[code].display)(&optable11[code], code, pc+1, "");
1140 }
1141
1142 #pragma argsused
1143 int D_Immediat(op, code, pc, suffix)
1144 Opcode *op;
1145 int code;
1146 int pc;
1147 char *suffix;
1148 {
1149 int offset;
1150
1151 offset = prog[pc+1];
1152 fprintf(fp,"%0.2X %0.2X %s%s #$%0.2X",
1153 code, offset, suffix, op->name, offset);
1154 return op->bytes;
1155 }
1156
1157 #pragma argsused
1158 int D_ImmediatL(op, code, pc, suffix)
1159 Opcode *op;
1160 int code;
1161 int pc;
1162 char *suffix;
1163 {
1164 int offset;
1165
1166 offset = prog[pc+1] * 256 + prog[pc+2];
1167 fprintf(fp,"%0.2X %0.2X %0.2X %s%s #$%0.4X",
1168 code, prog[pc+1], prog[pc+2], suffix, op->name, offset);
1169 return op->bytes;
1170 }
1171
1172 #pragma argsused
1173 int D_Inherent(op, code, pc, suffix)
1174 Opcode *op;
1175 int code;
1176 int pc;
1177 char *suffix;
1178 {
1179 fprintf(fp,"%0.2X %s%s", code, suffix, op->name);
1180 return op->bytes;
1181 }
1182
1183 #pragma argsused
1184 int D_OS9(op, code, pc, suffix)
1185 Opcode *op;
1186 int code;
1187 int pc;
1188 char *suffix;
1189 {
1190 int offset;
1191
1192 offset = prog[pc+1];
1193 for(int i =0, j = sizeof(os9sys)/sizeof(struct os9syscall), m = (i+j)/2 ;i<=j; m=(i+j)/2 ) {
1194 if (os9sys[m].code > offset) {
1195 j=m-1;
1196 } else if (os9sys[m].code < offset) {
1197 i=m+1;
1198 } else if (os9sys[m].code == offset) {
1199 fprintf(fp,"%0.2X %0.2X %s%s %s",
1200 code, offset, suffix, op->name, os9sys[m].name);
1201 return op->bytes;
1202 }
1203 }
1204 fprintf(fp,"%0.2X %0.2X %s%s $%0.2X",
1205 code, offset, suffix, op->name, prog[pc+1]);
1206 return op->bytes;
1207 }
1208
1209 #pragma argsused
1210 char *IndexRegister(postbyte)
1211 int postbyte;
1212 {
1213 return Indexed_Register[ (postbyte>>5) & 0x03];
1214 }
1215
1216 #pragma argsused
1217 int D_Indexed(op, code, pc, suffix)
1218 Opcode *op;
1219 int code;
1220 int pc;
1221 char *suffix;
1222 {
1223 int postbyte;
1224 char *s;
1225 int extrabytes;
1226 int disp;
1227 int address;
1228 int offset;
1229
1230 extrabytes = 0;
1231 postbyte = prog[pc+1];
1232 if ((postbyte & 0x80) == 0x00) {
1233 disp = postbyte & 0x1f;
1234 if ((postbyte & 0x10) == 0x10) {
1235 s = "-";
1236 disp=0x20-disp;
1237 }
1238 else
1239 s = "+";
1240 fprintf(fp,"%0.2X %0.2X %s%s %s$%0.2X,%s",
1241 code, postbyte, suffix, op->name, s,disp,IndexRegister(postbyte));
1242 } else {
1243 switch(postbyte & 0x1f) {
1244 case 0x00 :
1245 fprintf(fp,"%0.2X %0.2X %s%s ,%s+",
1246 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1247 break;
1248 case 0x01 :
1249 fprintf(fp,"%0.2X %0.2X %s%s ,%s++",
1250 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1251 break;
1252 case 0x02 :
1253 fprintf(fp,"%0.2X %0.2X %s%s ,-%s",
1254 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1255 break;
1256 case 0x03 :
1257 fprintf(fp,"%0.2X %0.2X %s%s ,--%s",
1258 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1259 break;
1260 case 0x04 :
1261 fprintf(fp,"%0.2X %0.2X %s%s ,%s",
1262 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1263 break;
1264 case 0x05 :
1265 fprintf(fp,"%0.2X %0.2X %s%s B,%s",
1266 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1267 break;
1268 case 0x06 :
1269 fprintf(fp,"%0.2X %0.2X %s%s A,%s",
1270 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1271 break;
1272 case 0x07 :
1273 break;
1274 case 0x08 :
1275 offset = prog[pc+2];
1276 if (offset < 128)
1277 s = "+";
1278 else {
1279 s = "-";
1280 offset=0x0100-offset;
1281 }
1282 fprintf(fp,"%0.2X %0.2X %0.2X %s%s %s$%0.2X,%s",
1283 code, postbyte, prog[pc+2], suffix, op->name, s, offset,
1284 IndexRegister(postbyte));
1285 extrabytes=1;
1286 break;
1287 case 0x09 :
1288 offset = prog[pc+2] * 256 + prog[pc+3];
1289 if (offset < 32768)
1290 s = "+";
1291 else {
1292 s = "-";
1293 offset=0xffff-offset+1;
1294 }
1295 fprintf(fp,"%0.2X %0.2X %0.2X %0.2X %s%s %s$%0.4X,%s",
1296 code, postbyte, prog[pc+2], prog[pc+3], suffix, op->name, s, offset,
1297 IndexRegister(postbyte));
1298 extrabytes=2;
1299 break;
1300 case 0x0a :
1301 break;
1302 case 0x0b :
1303 fprintf(fp,"%0.2X %0.2X %s%s D,%s",
1304 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1305 break;
1306 case 0x0c :
1307 offset = (prog[pc+2]+pc+3) & 0xFFFF;
1308 s = "<";
1309 fprintf(fp,"%0.2X %0.2X %0.2X %s%s %s$%0.2X,PCR",
1310 code, postbyte, prog[pc+2], suffix, op->name, s, offset+adoffset);
1311 extrabytes = 1;
1312 break;
1313 case 0x0d :
1314 offset = (prog[pc+2] * 256 + prog[pc+3]+pc+4) & 0xFFFF;
1315 s = ">";
1316 fprintf(fp,"%0.2X %0.2X %0.2X %0.2X %s%s %s$%0.4X,PCR",
1317 code, postbyte, prog[pc+2], prog[pc+3], suffix, op->name, s, offset+adoffset);
1318 extrabytes = 2;
1319 break;
1320 case 0x0e :
1321 break;
1322 case 0x0f :
1323 fprintf(fp,"%0.2X %0.2X %s?????",
1324 code, postbyte, suffix);
1325 break;
1326 case 0x10 :
1327 fprintf(fp,"%0.2X %0.2X %s?????",
1328 code, postbyte, suffix);
1329 break;
1330 case 0x11 :
1331 fprintf(fp,"%0.2X %0.2X %s%s [,%s++]",
1332 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1333 break;
1334 case 0x12 :
1335 fprintf(fp,"%0.2X %0.2X %s?????",
1336 code, postbyte, suffix);
1337 break;
1338 case 0x13 :
1339 fprintf(fp,"%0.2X %0.2X %s%s [,--%s]",
1340 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1341 break;
1342 case 0x14 :
1343 fprintf(fp,"%0.2X %0.2X %s%s [,%s]",
1344 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1345 break;
1346 case 0x15 :
1347 fprintf(fp,"%0.2X %0.2X %s%s [B,%s]",
1348 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1349 break;
1350 case 0x16 :
1351 fprintf(fp,"%0.2X %0.2X %s%s [A,%s]",
1352 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1353 break;
1354 case 0x17 :
1355 break;
1356 case 0x18 :
1357 offset = prog[pc+2];
1358 if (offset < 128)
1359 s = "+";
1360 else {
1361 s = "-";
1362 offset=0x0100-offset;
1363 }
1364 fprintf(fp,"%0.2X %0.2X %0.2X %s%s [%s$%0.2X,%s]",
1365 code, postbyte, prog[pc+2], suffix, op->name, s, offset,
1366 IndexRegister(postbyte));
1367 break;
1368 case 0x19 :
1369 offset = prog[pc+2] * 256 + prog[pc+3];
1370 if (offset < 32768)
1371 s = "+";
1372 else {
1373 s = "-";
1374 offset=0xffff-offset+1;
1375 }
1376 fprintf(fp,"%0.2X %0.2X %0.2X %0.2X %s%s %s$%0.4X,%s",
1377 code, postbyte, prog[pc+2], prog[pc+3], suffix, op->name, s, offset,
1378 IndexRegister(postbyte));
1379 break;
1380 case 0x1a :
1381 break;
1382 case 0x1b :
1383 fprintf(fp,"%0.2X %0.2X %s%s [D,%s]",
1384 code, postbyte, suffix, op->name, IndexRegister(postbyte));
1385 break;
1386 case 0x1c :
1387 offset = (prog[pc+2]+pc+3) & 0xFFFF;
1388 s = "<";
1389 fprintf(fp,"%0.2X %0.2X %0.2X %s%s [%s$%0.2X,PCR]",
1390 code, postbyte, prog[pc+2], suffix, op->name, s, offset+adoffset);
1391 extrabytes = 1;
1392 break;
1393 case 0x1d :
1394 offset = (prog[pc+2] * 256 + prog[pc+3]+pc+4) & 0xFFFF;
1395 s = ">";
1396 fprintf(fp,"%0.2X %0.2X %0.2X %0.2X %s%s [%s$%0.4X,PCR]",
1397 code, postbyte, prog[pc+2], prog[pc+3], suffix, op->name, s, offset+adoffset);
1398 extrabytes = 2;
1399 break;
1400 case 0x1e :
1401 break;
1402 case 0x1f :
1403 address = prog[pc+2] * 256 + prog[pc+3];
1404 extrabytes = 2;
1405 fprintf(fp,"%0.2X %0.2X %0.2X %0.2X %s%s [$%4X]",
1406 code, postbyte, prog[pc+2], prog[pc+3], suffix, op->name, address);
1407 break;
1408 }
1409 }
1410 return op->bytes + extrabytes;
1411 }
1412
1413 #pragma argsused
1414 int D_Extended(op, code, pc, suffix)
1415 Opcode *op;
1416 int code;
1417 int pc;
1418 char *suffix;
1419 {
1420 int offset;
1421
1422 offset = prog[pc+1] * 256 + prog[pc+2];
1423 fprintf(fp,"%0.2X %0.2X %0.2X %s%s $%0.4X",
1424 code, prog[pc+1], prog[pc+2], suffix, op->name, offset);
1425 return op->bytes;
1426 }
1427
1428 #pragma argsused
1429 int D_Relative(op, code, pc, suffix)
1430 Opcode *op;
1431 int code;
1432 int pc;
1433 char *suffix;
1434 {
1435 int offset;
1436 int disp;
1437
1438 offset = prog[pc+1];
1439 if (offset < 127 )
1440 disp = pc + 2 + offset;
1441 else
1442 disp = pc + 2 - (256 - offset);
1443 fprintf(fp,"%0.2X %0.2X %s%s $%0.4X",
1444 code, offset, suffix, op->name, disp);
1445 return op->bytes;
1446 }
1447
1448 #pragma argsused
1449 int D_RelativeL(op, code, pc, suffix)
1450 Opcode *op;
1451 int code;
1452 int pc;
1453 char *suffix;
1454 {
1455 int offset;
1456 int disp;
1457
1458 offset = prog[pc+1] * 256 + prog[pc+2];
1459 if (offset < 32767 )
1460 disp = pc + 3 + offset + adoffset;
1461 else
1462 disp = pc + 3 - (65536 - offset) + adoffset;
1463 fprintf(fp,"%0.2X %0.2X %0.2X %s%s $%0.4X",
1464 code, prog[pc+1], prog[pc+2], suffix, op->name, disp);
1465 return op->bytes;
1466 }
1467
1468 #pragma argsused
1469 int D_Register0(op, code, pc, suffix)
1470 Opcode *op;
1471 int code;
1472 int pc;
1473 char *suffix;
1474 {
1475 int postbyte;
1476
1477 postbyte = prog[pc+1];
1478
1479 fprintf(fp,"%0.2X %0.2X %s%s %s,%s",
1480 code, postbyte, suffix, op->name, Inter_Register[postbyte>>4], Inter_Register[postbyte & 0x0F]);
1481
1482
1483 return op->bytes;
1484 }
1485
1486 #pragma argsused
1487 int D_Register1(op, code, pc, suffix)
1488 Opcode *op;
1489 int code;
1490 int pc;
1491 char *suffix;
1492 {
1493 int postbyte;
1494 int i;
1495 int flag=0;
1496 static char *s_stack[8]={"PC","U","Y","X","DP","B","A","CC"};
1497 static int bits[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
1498
1499 postbyte = prog[pc+1];
1500
1501 fprintf(fp,"%0.2X %0.2X %s%s ",
1502 code, postbyte, suffix, op->name);
1503
1504 for(i=0;i<8;i++) {
1505 if ((postbyte & bits[i]) !=0) {
1506 if (flag !=0) {
1507 fprintf(fp,",");
1508 } else {
1509 flag=1;
1510 }
1511 fprintf(fp,s_stack[i]);
1512 }
1513 }
1514 return op->bytes;
1515 }
1516
1517 #pragma argsused
1518 int D_Register2(op, code, pc, suffix)
1519 Opcode *op;
1520 int code;
1521 int pc;
1522 char *suffix;
1523 {
1524 int postbyte;
1525 int i;
1526 int flag=0;
1527 static char *u_stack[8]={"PC","S","Y","X","DP","B","A","CC"};
1528 static int bits[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
1529
1530 postbyte = prog[pc+1];
1531 fprintf(fp,"%0.2X %0.2X %s%s ",
1532 code, postbyte, suffix, op->name);
1533
1534 for(i=0;i<8;i++) {
1535 if ((postbyte & bits[i]) !=0) {
1536 if (flag !=0) {
1537 fprintf(fp,",");
1538 } else {
1539 flag=1;
1540 }
1541 fprintf(fp,u_stack[i]);
1542 }
1543 }
1544 return op->bytes;
1545 }
1546
1547
1548 void hexadump(b, l, loc, w)
1549 unsigned char *b;
1550 int l;
1551 int loc;
1552 int w;
1553 {
1554 int i;
1555 int j;
1556 int end;
1557 // char b[4096];
1558
1559 // memset(b, '\0', 4096);
1560 // memcpy(b, s, l);
1561 //fprintf(fp,"\n");
1562 end = ((l%w)>0)?(l/w)+1:(l/w);
1563 for (j=0;j<end;j++) {
1564 fprintf(fp,"%04X: ", loc+j*w+adoffset);
1565 for (i=0;i<w;i++) {
1566 fprintf(fp,"%02X ", b[j*w+i]);
1567 }
1568 fprintf(fp,"|");
1569 for (i=0;i<w;i++) {
1570 if ((b[j*w+i] >= 0x20) && (b[j*w+i] < 0x7f)) {
1571 fprintf(fp,"%c", b[j*w+i]);
1572 } else {
1573 fprintf(fp,".");
1574 }
1575 }
1576 fprintf(fp,"|\n");
1577 }
1578 //fprintf(fp,"\n");
1579 }
1580
1581 char *comment(arg)
1582 int arg;
1583 {
1584 int i;
1585
1586 for (i=0;i<lastio;i++) {
1587 if (arg == iotable[i]) {
1588 return iocomment[i];
1589 }
1590 }
1591 return "";
1592 }
1593
1594 int disasm(start, end)
1595 int start;
1596 int end;
1597 {
1598 int pc;
1599 int code;
1600 int currstring;
1601
1602 currstring = 0;
1603 for (pc=start; pc <= end;) {
1604 code = prog[pc];
1605 fprintf(fp,"%0.4X: ", pc + adoffset);
1606 if (currstring < laststring) {
1607 if (pc == stringtable[currstring].address) {
1608 hexadump(&prog[pc], stringtable[currstring].length, pc,
1609 stringtable[currstring].width);
1610 pc += stringtable[currstring].length;
1611 currstring++;
1612 continue;
1613 }
1614 }
1615 pc += (*optable[code].display)(&optable[code], code, pc, " ");
1616 fprintf(fp,"\n");
1617 }
1618 return pc;
1619 }
1620
1621 #ifndef NO_MAIN
1622
1623 int main(int argc, char **argv )
1624 {
1625 int fd;
1626 int start,end;
1627 int size;
1628
1629 if ( argc > 2 && *argv[1] == '-') {
1630 if (argv[1][1]=='o') {
1631 adoffset=strtol(argv[2],(char**)0,0);
1632 argc-=2;
1633 argv += 2;
1634 }
1635 }
1636 if ( argc != 4 ) {
1637 fprintf(stderr, "usage: disasm [-o offset] <file> <start> <end>\n");
1638 fprintf(stderr, " where start and end are in hex.\n");
1639 exit(1);
1640 }
1641
1642 sscanf(argv[2],"%x",&start); start -= adoffset;
1643 sscanf(argv[3],"%x",&end); end -= adoffset;
1644 printf("disass %x - %x\n",start,end);
1645
1646 fp = stdout;
1647
1648 fd = open(argv[1], O_RDONLY, S_IREAD|S_IWRITE);
1649 size = read(fd, &prog[0x0000], 0xffff);
1650
1651 if (end > size) end=size;
1652
1653 disasm(start, end);
1654 close(fd);
1655 return 0;
1656 }
1657
1658 #endif // NO_MAIN