1 /******************************************************************************
2  *
3  *		INSTTABLE.C
4  *		Instruction Table for 68000 Assembler
5  *
6  * Description: This file contains two kinds of data structure declara-
7  *		tions: "flavor lists" and the instruction table. First
8  *		in the file are "flavor lists," one for each different
9  *		instruction. Then comes the instruction table, which
10  *		contains the mnemonics of the various instructions, a
11  *		pointer to the flavor list for each instruction, and
12  *		other data. Finally, the variable tableSize is
13  *		initialized to contain the number of instructions in
14  *		the table.
15  *
16  *      Author: Paul McKee
17  *		ECE492    North Carolina State University
18  *
19  *        Date:	12/13/86
20  *
21  *   Copyright 1990-1991 North Carolina State University. All Rights Reserved.
22  *
23  *****************************************************************************/
24 
25 
26 /******************************************************************************
27 
28           HOW THE INSTRUCTION TABLE AND FLAVOR LISTS ARE USED
29 
30      The procedure which instLookup() and assemble() use to look up
31 and verify an instruction (or directive) is as follows. Once the
32 mnemonic of the instruction has been parsed and stripped of its size
33 code and trailing spaces, the instLookup() does a binary search on the
34 instruction table to determine if the mnemonic is present. If it is
35 not found, then the INV_OPCODE error results. If the mnemonic is
36 found, then assemble() examines the field parseFlag for that entry.
37 This flag is TRUE if the mnemonic represents a normal instruction that
38 can be parsed by assemble(); it is FALSE if the instruction's operands
39 have an unusual format (as is the case for MOVEM and DC).
40 
41       If the parseFlag is TRUE, then assemble will parse the
42 instruction's operands, check them for validity, and then pass the
43 data to the proper routine which will build the instruction. To do
44 this it uses the pointer in the instruction table to the instruction's
45 "flavor list" and scans through the list until it finds an particular
46 "flavor" of the instruction which matches the addressing mode(s)
47 specified.  If it finds such a flavor, it checks the instruction's
48 size code and passes the instruction mask for the appropriate size
49 (there are three masks for each flavor) to the building routine
50 through a pointer in the flavor list for that flavor.
51 
52 ******************************************************************************/
53 
54 #include <stdio.h>
55 #include "asm.h"
56 
57 /* Definitions of addressing mode masks for various classes of references */
58 #define Data	(DnDirect | AnInd | AnIndPost | AnIndPre | AnIndDisp \
59 		 | AnIndIndex | AbsShort | AbsLong | PCDisp | PCIndex \
60 		 | Immediate)
61 
62 #define Memory	(AnInd | AnIndPost | AnIndPre | AnIndDisp | AnIndIndex \
63 		 | AbsShort | AbsLong | PCDisp | PCIndex | Immediate)
64 
65 #define Control	(AnInd | AnIndDisp | AnIndIndex | AbsShort | AbsLong | PCDisp \
66 		 | PCIndex)
67 
68 #define Alter	(DnDirect | AnDirect | AnInd | AnIndPost | AnIndPre \
69 		 | AnIndDisp | AnIndIndex | AbsShort | AbsLong)
70 
71 #define All	(Data | Memory | Control | Alter)
72 #define DataAlt	(Data & Alter)
73 #define MemAlt	(Memory & Alter)
74 #define Absolute (AbsLong | AbsShort)
75 #define GenReg	(DnDirect | AnDirect)
76 
77 
78 /* Define size code masks for instructions that allow more than one size */
79 
80 #define BW	(BYTE | WORD)
81 #define WL	(WORD | LONG)
82 #define BWL	(BYTE | WORD | LONG)
83 #define BL	(BYTE | LONG)
84 
85 
86 /* Define the "flavor lists" for each different instruction */
87 
88 flavor abcdfl[] = {
89 	{DnDirect, DnDirect, BYTE, twoReg, 0xC100, 0xC100, 0},
90 	{AnIndPre, AnIndPre, BYTE, twoReg, 0xC108, 0xC108, 0}
91 };
92 
93 flavor addfl[] = {
94 	{Immediate, DataAlt, BWL, immedInst, 0x0600, 0x0640, 0x0680},
95 	{Immediate, AnDirect, WL, quickMath, 0, 0x5040, 0x5080},
96 	{All, DnDirect, BWL, arithReg, 0xD000, 0xD040, 0xD080},
97 	{DnDirect, MemAlt, BWL, arithAddr, 0xD100, 0xD140, 0xD180},
98 	{All, AnDirect, WL, arithReg, 0, 0xD0C0, 0xD1C0},
99 };
100 
101 flavor addafl[] = {
102 	{All, AnDirect, WL, arithReg, 0, 0xD0C0, 0xD1C0},
103 };
104 
105 flavor addifl[] = {
106 	{Immediate, DataAlt, BWL, immedInst, 0x0600, 0x0640, 0x0680}
107 };
108 
109 flavor addqfl[] = {
110 	{Immediate, DataAlt, BWL, quickMath, 0x5000, 0x5040, 0x5080},
111 	{Immediate, AnDirect, WL, quickMath, 0, 0x5040, 0x5080}
112 };
113 
114 flavor addxfl[] = {
115 	{DnDirect, DnDirect, BWL, twoReg, 0xD100, 0xD140, 0xD180},
116 	{AnIndPre, AnIndPre, BWL, twoReg, 0xD108, 0xD148, 0xD188}
117 };
118 
119 flavor andfl[] = {
120 	{Data, DnDirect, BWL, arithReg, 0xC000, 0xC040, 0xC080},
121 	{DnDirect, MemAlt, BWL, arithAddr, 0xC100, 0xC140, 0xC180},
122 	{Immediate, DataAlt, BWL, immedInst, 0x0200, 0x0240, 0x0280}
123 };
124 
125 flavor andifl[] = {
126 	{Immediate, DataAlt, BWL, immedInst, 0x0200, 0x0240, 0x0280},
127 	{Immediate, CCRDirect, BYTE, immedToCCR, 0x023C, 0x023C, 0},
128 	{Immediate, SRDirect, WORD, immedWord, 0, 0x027C, 0}
129 };
130 
131 flavor aslfl[] = {
132 	{MemAlt, 0, WORD, oneOp, 0, 0xE1C0, 0},
133 	{DnDirect, DnDirect, BWL, shiftReg, 0xE120, 0xE160, 0xE1A0},
134 	{Immediate, DnDirect, BWL, shiftReg, 0xE100, 0xE140, 0xE180}
135 };
136 
137 flavor asrfl[] = {
138 	{MemAlt, 0, WORD, oneOp, 0, 0xE0C0, 0},
139 	{DnDirect, DnDirect, BWL, shiftReg, 0xE020, 0xE060, 0xE0A0},
140 	{Immediate, DnDirect, BWL, shiftReg, 0xE000, 0xE040, 0xE080}
141 };
142 
143 flavor bccfl[] = {
144 	{Absolute, 0, SHORT | LONG, branch, 0x6400, 0x6400, 0x6400}
145 };
146 
147 flavor bchgfl[] = {
148 	{DnDirect, MemAlt, BYTE, arithAddr, 0x0140, 0x0140, 0},
149 	{DnDirect, DnDirect, LONG, arithAddr, 0, 0x0140, 0x0140},
150 	{Immediate, MemAlt, BYTE, staticBit, 0x0840, 0x0840, 0},
151 	{Immediate, DnDirect, LONG, staticBit, 0, 0x0840, 0x0840}
152 };
153 
154 flavor bclrfl[] = {
155 	{DnDirect, MemAlt, BYTE, arithAddr, 0x0180, 0x0180, 0},
156 	{DnDirect, DnDirect, LONG, arithAddr, 0, 0x0180, 0x0180},
157 	{Immediate, MemAlt, BYTE, staticBit, 0x0880, 0x0880, 0},
158 	{Immediate, DnDirect, LONG, staticBit, 0, 0x0880, 0x0880}
159 };
160 
161 flavor bcsfl[] = {
162 	{Absolute, 0, SHORT | LONG, branch, 0x6500, 0x6500, 0x6500}
163 };
164 
165 flavor beqfl[] = {
166 	{Absolute, 0, SHORT | LONG, branch, 0x6700, 0x6700, 0x6700}
167 };
168 
169 flavor bgefl[] = {
170 	{Absolute, 0, SHORT | LONG, branch, 0x6C00, 0x6C00, 0x6C00}
171 };
172 
173 flavor bgtfl[] = {
174 	{Absolute, 0, SHORT | LONG, branch, 0x6E00, 0x6E00, 0x6E00}
175 };
176 
177 flavor bhifl[] = {
178 	{Absolute, 0, SHORT | LONG, branch, 0x6200, 0x6200, 0x6200}
179 };
180 
181 flavor bhsfl[] = {
182 	{Absolute, 0, SHORT | LONG, branch, 0x6400, 0x6400, 0x6400}
183 };
184 
185 flavor blefl[] = {
186 	{Absolute, 0, SHORT | LONG, branch, 0x6f00, 0x6F00, 0x6F00}
187 };
188 
189 flavor blofl[] = {
190 	{Absolute, 0, SHORT | LONG, branch, 0x6500, 0x6500, 0x6500}
191 };
192 
193 flavor blsfl[] = {
194 	{Absolute, 0, SHORT | LONG, branch, 0x6300, 0x6300, 0x6300}
195 };
196 
197 flavor bltfl[] = {
198 	{Absolute, 0, SHORT | LONG, branch, 0x6d00, 0x6D00, 0x6D00}
199 };
200 
201 flavor bmifl[] = {
202 	{Absolute, 0, SHORT | LONG, branch, 0x6b00, 0x6B00, 0x6B00}
203 };
204 
205 flavor bnefl[] = {
206 	{Absolute, 0, SHORT | LONG, branch, 0x6600, 0x6600, 0x6600}
207 };
208 
209 flavor bplfl[] = {
210 	{Absolute, 0, SHORT | LONG, branch, 0x6a00, 0x6A00, 0x6A00}
211 };
212 
213 flavor brafl[] = {
214 	{Absolute, 0, SHORT | LONG, branch, 0x6000, 0x6000, 0x6000}
215 };
216 
217 flavor bsetfl[] = {
218 	{DnDirect, MemAlt, BYTE, arithAddr, 0x01C0, 0x01C0, 0},
219 	{DnDirect, DnDirect, LONG, arithAddr, 0, 0x01C0, 0x01C0},
220 	{Immediate, MemAlt, BYTE, staticBit, 0x08C0, 0x08C0, 0},
221 	{Immediate, DnDirect, LONG, staticBit, 0, 0x08C0, 0x08C0}
222 };
223 
224 flavor bsrfl[] = {
225 	{Absolute, 0, SHORT | LONG, branch, 0x6100, 0x6100, 0x6100}
226 };
227 
228 flavor btstfl[] = {
229 	{DnDirect, Memory, BYTE, arithAddr, 0x0100, 0x0100, 0},
230 	{DnDirect, DnDirect, LONG, arithAddr, 0, 0x0100, 0x0100},
231 	{Immediate, Memory, BYTE, staticBit, 0x0800, 0x0800, 0},
232 	{Immediate, DnDirect, LONG, staticBit, 0, 0x0800, 0x0800}
233 };
234 
235 flavor bvcfl[] = {
236 	{Absolute, 0, SHORT | LONG, branch, 0x6800, 0x6800, 0x6800}
237 };
238 
239 flavor bvsfl[] = {
240 	{Absolute, 0, SHORT | LONG, branch, 0x6900, 0x6900, 0x6900}
241 };
242 
243 flavor chkfl[] = {
244 	{Data, DnDirect, WORD, arithReg, 0, 0x4180, 0}
245 };
246 
247 flavor clrfl[] = {
248 	{DataAlt, 0, BWL, oneOp, 0x4200, 0x4240, 0x4280}
249 };
250 
251 flavor cmpfl[] = {
252 	{All, DnDirect, BWL, arithReg, 0xB000, 0xB040, 0xB080},
253 	{All, AnDirect, WL, arithReg, 0, 0xB0C0, 0xB1C0},
254 	{Immediate, DataAlt, BWL, immedInst, 0x0C00, 0x0C40, 0x0C80}
255 };
256 
257 flavor cmpafl[] = {
258 	{All, AnDirect, WL, arithReg, 0, 0xB0C0, 0xB1C0}
259 };
260 
261 flavor cmpifl[] = {
262 	{Immediate, DataAlt, BWL, immedInst, 0x0C00, 0x0C40, 0x0C80}
263 };
264 
265 flavor cmpmfl[] = {
266 	{AnIndPost, AnIndPost, BWL, twoReg, 0xB108, 0xB148, 0xB188}
267 };
268 
269 flavor dbccfl[] = {
270 	{DnDirect, Absolute, WORD, dbcc, 0, 0x54C8, 0}
271 };
272 
273 flavor dbcsfl[] = {
274 	{DnDirect, Absolute, WORD, dbcc, 0, 0x55C8, 0}
275 };
276 
277 flavor dbeqfl[] = {
278 	{DnDirect, Absolute, WORD, dbcc, 0, 0x57C8, 0}
279 };
280 
281 flavor dbffl[] = {
282 	{DnDirect, Absolute, WORD, dbcc, 0, 0x51C8, 0}
283 };
284 
285 flavor dbgefl[] = {
286 	{DnDirect, Absolute, WORD, dbcc, 0, 0x5CC8, 0}
287 };
288 
289 flavor dbgtfl[] = {
290 	{DnDirect, Absolute, WORD, dbcc, 0, 0x5EC8, 0}
291 };
292 
293 flavor dbhifl[] = {
294 	{DnDirect, Absolute, WORD, dbcc, 0, 0x52C8, 0}
295 };
296 
297 flavor dbhsfl[] = {
298 	{DnDirect, Absolute, WORD, dbcc, 0, 0x54C8, 0}
299 };
300 
301 flavor dblefl[] = {
302 	{DnDirect, Absolute, WORD, dbcc, 0, 0x5FC8, 0}
303 };
304 
305 flavor dblofl[] = {
306 	{DnDirect, Absolute, WORD, dbcc, 0, 0x55C8, 0}
307 };
308 
309 flavor dblsfl[] = {
310 	{DnDirect, Absolute, WORD, dbcc, 0, 0x53C8, 0}
311 };
312 
313 flavor dbltfl[] = {
314 	{DnDirect, Absolute, WORD, dbcc, 0, 0x5DC8, 0}
315 };
316 
317 flavor dbmifl[] = {
318 	{DnDirect, Absolute, WORD, dbcc, 0, 0x5BC8, 0}
319 };
320 
321 flavor dbnefl[] = {
322 	{DnDirect, Absolute, WORD, dbcc, 0, 0x56C8, 0}
323 };
324 
325 flavor dbplfl[] = {
326 	{DnDirect, Absolute, WORD, dbcc, 0, 0x5AC8, 0}
327 };
328 
329 flavor dbrafl[] = {
330 	{DnDirect, Absolute, WORD, dbcc, 0, 0x51C8, 0}
331 };
332 
333 flavor dbtfl[] = {
334 	{DnDirect, Absolute, WORD, dbcc, 0, 0x50C8, 0}
335 };
336 
337 flavor dbvcfl[] = {
338 	{DnDirect, Absolute, WORD, dbcc, 0, 0x58C8, 0}
339 };
340 
341 flavor dbvsfl[] = {
342 	{DnDirect, Absolute, WORD, dbcc, 0, 0x59C8, 0}
343 };
344 
345 flavor divsfl[] = {
346 	{Data, DnDirect, WORD, arithReg, 0, 0x81C0, 0}
347 };
348 
349 flavor divufl[] = {
350 	{Data, DnDirect, WORD, arithReg, 0, 0x80C0, 0}
351 };
352 
353 flavor eorfl[] = {
354 	{DnDirect, DataAlt, BWL, arithAddr, 0xB100, 0xB140, 0xB180},
355 	{Immediate, DataAlt, BWL, immedInst, 0x0A00, 0x0A40, 0x0A80}
356 };
357 
358 flavor eorifl[] = {
359 	{Immediate, DataAlt, BWL, immedInst, 0x0A00, 0x0A40, 0x0A80},
360 	{Immediate, CCRDirect, BYTE, immedToCCR, 0x0A3C, 0x0A3C, 0},
361 	{Immediate, SRDirect, WORD, immedWord, 0, 0x0A7C, 0}
362 };
363 
364 flavor exgfl[] = {
365 	{DnDirect, DnDirect, LONG, exg, 0, 0xC140, 0xC140},
366 	{AnDirect, AnDirect, LONG, exg, 0, 0xC148, 0xC148},
367 	{GenReg, GenReg, LONG, exg, 0, 0xC188, 0xC188}
368 };
369 
370 flavor extfl[] = {
371 	{DnDirect, 0, WL, oneReg, 0, 0x4880, 0x48C0}
372 };
373 
374 flavor illegalfl[] = {
375 	{0, 0, 0, zeroOp, 0, 0x4AFC, 0}
376 };
377 
378 flavor jmpfl[] = {
379 	{Control, 0, 0, oneOp, 0, 0x4EC0, 0}
380 };
381 
382 flavor jsrfl[] = {
383 	{Control, 0, 0, oneOp, 0, 0x4E80, 0}
384 };
385 
386 flavor leafl[] = {
387 	{Control, AnDirect, LONG, arithReg, 0, 0x41C0, 0x41C0}
388 };
389 
390 flavor linkfl[] = {
391 	{AnDirect, Immediate, 0, link, 0, 0x4E50, 0}
392 };
393 
394 flavor lslfl[] = {
395 	{MemAlt, 0, WORD, oneOp, 0, 0xE3C0, 0},
396 	{DnDirect, DnDirect, BWL, shiftReg, 0xE128, 0xE168, 0xE1A8},
397 	{Immediate, DnDirect, BWL, shiftReg, 0xE108, 0xE148, 0xE188}
398 };
399 
400 flavor lsrfl[] = {
401 	{MemAlt, 0, WORD, oneOp, 0, 0xE2C0, 0},
402 	{DnDirect, DnDirect, BWL, shiftReg, 0xE028, 0xE068, 0xE0A8},
403 	{Immediate, DnDirect, BWL, shiftReg, 0xE008, 0xE048, 0xE088}
404 };
405 
406 flavor movefl[] = {
407 	{All, DataAlt, BWL, move, 0x1000, 0x3000, 0x2000},
408 	{All, AnDirect, WL, move, 0, 0x3000, 0x2000},
409 	{Data, CCRDirect, WORD, oneOp, 0, 0x44C0, 0},
410 	{Data, SRDirect, WORD, oneOp, 0, 0x46C0, 0},
411 	{CCRDirect, DataAlt, WORD, moveReg, 0, 0x42C0, 0},
412 	{SRDirect, DataAlt, WORD, moveReg, 0, 0x40C0, 0},
413 	{AnDirect, USPDirect, LONG, moveUSP, 0, 0x4E60, 0x4E60},
414 	{USPDirect, AnDirect, LONG, moveUSP, 0, 0x4E68, 0x4E68}
415 };
416 
417 flavor moveafl[] = {
418 	{All, AnDirect, WL, move, 0, 0x3000, 0x2000}
419 };
420 
421 flavor movecfl[] = {
422 	{SFCDirect | DFCDirect | USPDirect | VBRDirect,
423 	 GenReg, LONG, movec, 0, 0x4E7A, 0x4E7A},
424 	{GenReg, SFCDirect | DFCDirect | USPDirect | VBRDirect,
425 	 LONG, movec, 0, 0x4E7B, 0x4E7B}
426 };
427 
428 flavor movepfl[] = {
429 	{DnDirect, AnIndDisp, WL, movep, 0, 0x0188, 0x01C8},
430 	{AnIndDisp, DnDirect, WL, movep, 0, 0x0108, 0x0148},
431 	{DnDirect, AnInd, WL, movep, 0, 0x0188, 0x01C8},
432 	{AnInd, DnDirect, WL, movep, 0, 0x0108, 0x0148}
433 };
434 
435 flavor moveqfl[] = {
436 	{Immediate, DnDirect, LONG, moveq, 0, 0x7000, 0x7000}
437 };
438 
439 flavor movesfl[] = {
440 	{GenReg, MemAlt, BWL, moves, 0x0E00, 0x0E40, 0x0E80},
441 	{MemAlt, GenReg, BWL, moves, 0x0E00, 0x0E40, 0x0E80}
442 };
443 
444 flavor mulsfl[] = {
445 	{Data, DnDirect, WORD, arithReg, 0, 0xC1C0, 0}
446 };
447 
448 flavor mulufl[] = {
449 	{Data, DnDirect, WORD, arithReg, 0, 0xC0C0, 0}
450 };
451 
452 flavor nbcdfl[] = {
453 	{DataAlt, 0, BYTE, oneOp, 0x4800, 0x4800, 0}
454 };
455 
456 flavor negfl[] = {
457 	{DataAlt, 0, BWL, oneOp, 0x4400, 0x4440, 0x4480}
458 };
459 
460 flavor negxfl[] = {
461 	{DataAlt, 0, BWL, oneOp, 0x4000, 0x4040, 0x4080}
462 };
463 
464 flavor nopfl[] = {
465 	{0, 0, 0, zeroOp, 0, 0x4E71, 0}
466 };
467 
468 flavor notfl[] = {
469 	{DataAlt, 0, BWL, oneOp, 0x4600, 0x4640, 0x4680}
470 };
471 
472 flavor orfl[] = {
473 	{Data, DnDirect, BWL, arithReg, 0x8000, 0x8040, 0x8080},
474 	{DnDirect, MemAlt, BWL, arithAddr, 0x8100, 0x8140, 0x8180},
475 	{Immediate, DataAlt, BWL, immedInst, 0x0000, 0x0040, 0x0080}
476 };
477 
478 flavor orifl[] = {
479 	{Immediate, DataAlt, BWL, immedInst, 0x0000, 0x0040, 0x0080},
480 	{Immediate, CCRDirect, BYTE, immedToCCR, 0x003C, 0x003C, 0},
481 	{Immediate, SRDirect, WORD, immedWord, 0, 0x007C, 0}
482 };
483 
484 flavor peafl[] = {
485 	{Control, 0, LONG, oneOp, 0, 0x4840, 0x4840}
486 };
487 
488 flavor resetfl[] = {
489 	{0, 0, 0, zeroOp, 0, 0x4E70, 0}
490 };
491 
492 flavor rolfl[] = {
493 	{MemAlt, 0, WORD, oneOp, 0, 0xE7C0, 0},
494 	{DnDirect, DnDirect, BWL, shiftReg, 0xE138, 0xE178, 0xE1B8},
495 	{Immediate, DnDirect, BWL, shiftReg, 0xE118, 0xE158, 0xE198}
496 };
497 
498 flavor rorfl[] = {
499 	{MemAlt, 0, WORD, oneOp, 0, 0xE6C0, 0},
500 	{DnDirect, DnDirect, BWL, shiftReg, 0xE038, 0xE078, 0xE0B8},
501 	{Immediate, DnDirect, BWL, shiftReg, 0xE018, 0xE058, 0xE098}
502 };
503 
504 flavor roxlfl[] = {
505 	{MemAlt, 0, WORD, oneOp, 0, 0xE5C0, 0},
506 	{DnDirect, DnDirect, BWL, shiftReg, 0xE130, 0xE170, 0xE1B0},
507 	{Immediate, DnDirect, BWL, shiftReg, 0xE110, 0xE150, 0xE190}
508 };
509 
510 flavor roxrfl[] = {
511 	{MemAlt, 0, WORD, oneOp, 0, 0xE4C0, 0},
512 	{DnDirect, DnDirect, BWL, shiftReg, 0xE030, 0xE070, 0xE0B0},
513 	{Immediate, DnDirect, BWL, shiftReg, 0xE010, 0xE050, 0xE090}
514 };
515 
516 flavor rtdfl[] = {
517 	{Immediate, 0, 0, immedWord, 0, 0x4E74, 0}
518 };
519 
520 flavor rtefl[] = {
521 	{0, 0, 0, zeroOp, 0, 0x4E73, 0}
522 };
523 
524 flavor rtrfl[] = {
525 	{0, 0, 0, zeroOp, 0, 0x4E77, 0}
526 };
527 
528 flavor rtsfl[] = {
529 	{0, 0, 0, zeroOp, 0, 0x4E75, 0}
530 };
531 
532 flavor sbcdfl[] = {
533 	{DnDirect, DnDirect, BYTE, twoReg, 0x8100, 0x8100, 0},
534 	{AnIndPre, AnIndPre, BYTE, twoReg, 0x8108, 0x8108, 0}
535 };
536 
537 flavor sccfl[] = {
538 	{DataAlt, 0, BYTE, scc, 0x54C0, 0x54C0, 0}
539 };
540 
541 flavor scsfl[] = {
542 	{DataAlt, 0, BYTE, scc, 0x55C0, 0x55C0, 0}
543 };
544 
545 flavor seqfl[] = {
546 	{DataAlt, 0, BYTE, scc, 0x57C0, 0x57C0, 0}
547 };
548 
549 flavor sffl[] = {
550 	{DataAlt, 0, BYTE, scc, 0x51C0, 0x51C0, 0}
551 };
552 
553 flavor sgefl[] = {
554 	{DataAlt, 0, BYTE, scc, 0x5CC0, 0x5CC0, 0}
555 };
556 
557 flavor sgtfl[] = {
558 	{DataAlt, 0, BYTE, scc, 0x5EC0, 0x5EC0, 0}
559 };
560 
561 flavor shifl[] = {
562 	{DataAlt, 0, BYTE, scc, 0x52C0, 0x52C0, 0}
563 };
564 
565 flavor shsfl[] = {
566 	{DataAlt, 0, BYTE, scc, 0x54C0, 0x54C0, 0}
567 };
568 
569 flavor slefl[] = {
570 	{DataAlt, 0, BYTE, scc, 0x5FC0, 0x5FC0, 0}
571 };
572 
573 flavor slofl[] = {
574 	{DataAlt, 0, BYTE, scc, 0x55C0, 0x55C0, 0}
575 };
576 
577 flavor slsfl[] = {
578 	{DataAlt, 0, BYTE, scc, 0x53C0, 0x53C0, 0}
579 };
580 
581 flavor sltfl[] = {
582 	{DataAlt, 0, BYTE, scc, 0x5DC0, 0x5DC0, 0}
583 };
584 
585 flavor smifl[] = {
586 	{DataAlt, 0, BYTE, scc, 0x5BC0, 0x5BC0, 0}
587 };
588 
589 flavor snefl[] = {
590 	{DataAlt, 0, BYTE, scc, 0x56C0, 0x56C0, 0}
591 };
592 
593 flavor splfl[] = {
594 	{DataAlt, 0, BYTE, scc, 0x5AC0, 0x5AC0, 0}
595 };
596 
597 flavor stfl[] = {
598 	{DataAlt, 0, BYTE, scc, 0x50C0, 0x50C0, 0}
599 };
600 
601 flavor stopfl[] = {
602 	{Immediate, 0, 0, immedWord, 0, 0x4E72, 0}
603 };
604 
605 flavor subfl[] = {
606 	{Immediate, DataAlt, BWL, immedInst, 0x0400, 0x0440, 0x0480},
607 	{Immediate, AnDirect, WL, quickMath, 0, 0x5140, 0x5180},
608 	{All, DnDirect, BWL, arithReg, 0x9000, 0x9040, 0x9080},
609 	{DnDirect, MemAlt, BWL, arithAddr, 0x9100, 0x9140, 0x9180},
610 	{All, AnDirect, WL, arithReg, 0, 0x90C0, 0x91C0},
611 };
612 
613 flavor subafl[] = {
614 	{All, AnDirect, WL, arithReg, 0, 0x90C0, 0x91C0}
615 };
616 
617 flavor subifl[] = {
618 	{Immediate, DataAlt, BWL, immedInst, 0x0400, 0x0440, 0x0480}
619 };
620 
621 flavor subqfl[] = {
622 	{Immediate, DataAlt, BWL, quickMath, 0x5100, 0x5140, 0x5180},
623 	{Immediate, AnDirect, WL, quickMath, 0, 0x5140, 0x5180}
624 };
625 
626 flavor subxfl[] = {
627 	{DnDirect, DnDirect, BWL, twoReg, 0x9100, 0x9140, 0x9180},
628 	{AnIndPre, AnIndPre, BWL, twoReg, 0x9108, 0x9148, 0x9188}
629 };
630 
631 flavor svcfl[] = {
632 	{DataAlt, 0, BYTE, scc, 0x58C0, 0x58C0, 0}
633 };
634 
635 flavor svsfl[] = {
636 	{DataAlt, 0, BYTE, scc, 0x59C0, 0x59C0, 0}
637 };
638 
639 flavor swapfl[] = {
640 	{DnDirect, 0, WORD, oneReg, 0, 0x4840, 0}
641 };
642 
643 flavor tasfl[] = {
644 	{DataAlt, 0, BYTE, oneOp, 0x4AC0, 0x4AC0, 0}
645 };
646 
647 flavor trapfl[] = {
648 	{Immediate, 0, 0, trap, 0, 0x4E40, 0}
649 };
650 
651 flavor trapvfl[] = {
652 	{0, 0, 0, zeroOp, 0, 0x4E76, 0}
653 };
654 
655 flavor tstfl[] = {
656 	{DataAlt, 0, BWL, oneOp, 0x4A00, 0x4A40, 0x4A80}
657 };
658 
659 flavor unlkfl[] = {
660 	{AnDirect, 0, 0, oneReg, 0, 0x4E58, 0}
661 };
662 
663 flavor breakfl[] = {
664 	{0, 0, 0, zeroOp, 0, 0x4848, 0}
665 };
666 
667 
668 /* Define a macro to compute the length of a flavor list */
669 
670 #define flavorCount(flavorArray) (sizeof(flavorArray)/sizeof(flavor))
671 
672 
673 /* The instruction table itself... */
674 
675 instruction instTable[] = {
676 	{"ABCD", abcdfl, flavorCount(abcdfl), TRUE, NULL},
677 	{"ADD", addfl, flavorCount(addfl), TRUE, NULL},
678 	{"ADDA", addafl, flavorCount(addafl), TRUE, NULL},
679 	{"ADDI", addifl, flavorCount(addifl), TRUE, NULL},
680 	{"ADDQ", addqfl, flavorCount(addqfl), TRUE, NULL},
681 	{"ADDX", addxfl, flavorCount(addxfl), TRUE, NULL},
682 	{"AND", andfl, flavorCount(andfl), TRUE, NULL},
683 	{"ANDI", andifl, flavorCount(andifl), TRUE, NULL},
684 	{"ASL", aslfl, flavorCount(aslfl), TRUE, NULL},
685 	{"ASR", asrfl, flavorCount(aslfl), TRUE, NULL},
686 	{"BCC", bccfl, flavorCount(bccfl), TRUE, NULL},
687 	{"BCHG", bchgfl, flavorCount(bchgfl), TRUE, NULL},
688 	{"BCLR", bclrfl, flavorCount(bclrfl), TRUE, NULL},
689 	{"BCS", bcsfl, flavorCount(bcsfl), TRUE, NULL},
690 	{"BEQ", beqfl, flavorCount(beqfl), TRUE, NULL},
691 	{"BGE", bgefl, flavorCount(bgefl), TRUE, NULL},
692 	{"BGT", bgtfl, flavorCount(bgtfl), TRUE, NULL},
693 	{"BHI", bhifl, flavorCount(bhifl), TRUE, NULL},
694 	{"BHS", bccfl, flavorCount(bccfl), TRUE, NULL},
695 	{"BLE", blefl, flavorCount(blefl), TRUE, NULL},
696 	{"BLO", bcsfl, flavorCount(bcsfl), TRUE, NULL},
697 	{"BLS", blsfl, flavorCount(blsfl), TRUE, NULL},
698 	{"BLT", bltfl, flavorCount(bltfl), TRUE, NULL},
699 	{"BMI", bmifl, flavorCount(bmifl), TRUE, NULL},
700 	{"BNE", bnefl, flavorCount(bnefl), TRUE, NULL},
701 	{"BPL", bplfl, flavorCount(bplfl), TRUE, NULL},
702 	{"BRA", brafl, flavorCount(brafl), TRUE, NULL},
703 	{"BREAK", breakfl, flavorCount(breakfl), TRUE, NULL},
704 	{"BSET", bsetfl, flavorCount(bsetfl), TRUE, NULL},
705 	{"BSR", bsrfl, flavorCount(bsrfl), TRUE, NULL},
706 	{"BTST", btstfl, flavorCount(btstfl), TRUE, NULL},
707 	{"BVC", bvcfl, flavorCount(bvcfl), TRUE, NULL},
708 	{"BVS", bvsfl, flavorCount(bvsfl), TRUE, NULL},
709 	{"CHK", chkfl, flavorCount(chkfl), TRUE, NULL},
710 	{"CLR", clrfl, flavorCount(clrfl), TRUE, NULL},
711 	{"CMP", cmpfl, flavorCount(cmpfl), TRUE, NULL},
712 	{"CMPA", cmpafl, flavorCount(cmpafl), TRUE, NULL},
713 	{"CMPI", cmpifl, flavorCount(cmpifl), TRUE, NULL},
714 	{"CMPM", cmpmfl, flavorCount(cmpmfl), TRUE, NULL},
715 	{"DBCC", dbccfl, flavorCount(dbccfl), TRUE, NULL},
716 	{"DBCS", dbcsfl, flavorCount(dbcsfl), TRUE, NULL},
717 	{"DBEQ", dbeqfl, flavorCount(dbeqfl), TRUE, NULL},
718 	{"DBF", dbffl, flavorCount(dbffl), TRUE, NULL},
719 	{"DBGE", dbgefl, flavorCount(dbgefl), TRUE, NULL},
720 	{"DBGT", dbgtfl, flavorCount(dbgtfl), TRUE, NULL},
721 	{"DBHI", dbhifl, flavorCount(dbhifl), TRUE, NULL},
722 	{"DBHS", dbccfl, flavorCount(dbccfl), TRUE, NULL},
723 	{"DBLE", dblefl, flavorCount(dblefl), TRUE, NULL},
724 	{"DBLO", dbcsfl, flavorCount(dbcsfl), TRUE, NULL},
725 	{"DBLS", dblsfl, flavorCount(dblsfl), TRUE, NULL},
726 	{"DBLT", dbltfl, flavorCount(dbltfl), TRUE, NULL},
727 	{"DBMI", dbmifl, flavorCount(dbmifl), TRUE, NULL},
728 	{"DBNE", dbnefl, flavorCount(dbnefl), TRUE, NULL},
729 	{"DBPL", dbplfl, flavorCount(dbplfl), TRUE, NULL},
730 	{"DBRA", dbrafl, flavorCount(dbrafl), TRUE, NULL},
731 	{"DBT", dbtfl, flavorCount(dbtfl), TRUE, NULL},
732 	{"DBVC", dbvcfl, flavorCount(dbvcfl), TRUE, NULL},
733 	{"DBVS", dbvsfl, flavorCount(dbvsfl), TRUE, NULL},
734 	{"DC", NULL, 0, FALSE, dc},
735 	{"DCB", NULL, 0, FALSE, dcb},
736 	{"DIVS", divsfl, flavorCount(divsfl), TRUE, NULL},
737 	{"DIVU", divufl, flavorCount(divufl), TRUE, NULL},
738 	{"DS", NULL, 0, FALSE, ds},
739 	{"END", NULL, 0, FALSE, End},
740 	{"EOR", eorfl, flavorCount(eorfl), TRUE, NULL},
741 	{"EORI", eorifl, flavorCount(eorifl), TRUE, NULL},
742 	{"EQU", NULL, 0, FALSE, equ},
743 	{"EXG", exgfl, flavorCount(exgfl), TRUE, NULL},
744 	{"EXT", extfl, flavorCount(extfl), TRUE, NULL},
745 	{"ILLEGAL", illegalfl, flavorCount(illegalfl), TRUE, NULL},
746 	{"JMP", jmpfl, flavorCount(jmpfl), TRUE, NULL},
747 	{"JSR", jsrfl, flavorCount(jsrfl), TRUE, NULL},
748 	{"LEA", leafl, flavorCount(leafl), TRUE, NULL},
749 	{"LINK", linkfl, flavorCount(linkfl), TRUE, NULL},
750 	{"LSL", lslfl, flavorCount(lslfl), TRUE, NULL},
751 	{"LSR", lsrfl, flavorCount(lsrfl), TRUE, NULL},
752 	{"MOVE", movefl, flavorCount(movefl), TRUE, NULL},
753 	{"MOVEA", moveafl, flavorCount(moveafl), TRUE, NULL},
754 	{"MOVEC", movecfl, flavorCount(movecfl), TRUE, NULL},
755 	{"MOVEM", NULL, 0, FALSE, movem},
756 	{"MOVEP", movepfl, flavorCount(movepfl), TRUE, NULL},
757 	{"MOVEQ", moveqfl, flavorCount(moveqfl), TRUE, NULL},
758 	{"MOVES", movesfl, flavorCount(movesfl), TRUE, NULL},
759 	{"MULS", mulsfl, flavorCount(mulsfl), TRUE, NULL},
760 	{"MULU", mulufl, flavorCount(mulufl), TRUE, NULL},
761 	{"NBCD", nbcdfl, flavorCount(nbcdfl), TRUE, NULL},
762 	{"NEG", negfl, flavorCount(negfl), TRUE, NULL},
763 	{"NEGX", negxfl, flavorCount(negxfl), TRUE, NULL},
764 	{"NOP", nopfl, flavorCount(nopfl), TRUE, NULL},
765 	{"NOT", notfl, flavorCount(notfl), TRUE, NULL},
766 	{"OR", orfl, flavorCount(orfl), TRUE, NULL},
767 	{"ORG", NULL, 0, FALSE, org},
768 	{"ORI", orifl, flavorCount(orifl), TRUE, NULL},
769 	{"PEA", peafl, flavorCount(peafl), TRUE, NULL},
770 	{"REG", NULL, 0, FALSE, reg},
771 	{"RESET", resetfl, flavorCount(resetfl), TRUE, NULL},
772 	{"ROL", rolfl, flavorCount(rolfl), TRUE, NULL},
773 	{"ROR", rorfl, flavorCount(rorfl), TRUE, NULL},
774 	{"ROXL", roxlfl, flavorCount(roxlfl), TRUE, NULL},
775 	{"ROXR", roxrfl, flavorCount(roxrfl), TRUE, NULL},
776 	{"RTD", rtdfl, flavorCount(rtdfl), TRUE, NULL},
777 	{"RTE", rtefl, flavorCount(rtefl), TRUE, NULL},
778 	{"RTR", rtrfl, flavorCount(rtrfl), TRUE, NULL},
779 	{"RTS", rtsfl, flavorCount(rtsfl), TRUE, NULL},
780 	{"SBCD", sbcdfl, flavorCount(sbcdfl), TRUE, NULL},
781 	{"SCC", sccfl, flavorCount(sccfl), TRUE, NULL},
782 	{"SCS", scsfl, flavorCount(scsfl), TRUE, NULL},
783 	{"SEQ", seqfl, flavorCount(seqfl), TRUE, NULL},
784 	{"SET", NULL, 0, FALSE, set},
785 	{"SF", sffl, flavorCount(sffl), TRUE, NULL},
786 	{"SGE", sgefl, flavorCount(sgefl), TRUE, NULL},
787 	{"SGT", sgtfl, flavorCount(sgtfl), TRUE, NULL},
788 	{"SHI", shifl, flavorCount(shifl), TRUE, NULL},
789 	{"SHS", sccfl, flavorCount(sccfl), TRUE, NULL},
790 	{"SLE", slefl, flavorCount(slefl), TRUE, NULL},
791 	{"SLO", scsfl, flavorCount(scsfl), TRUE, NULL},
792 	{"SLS", slsfl, flavorCount(slsfl), TRUE, NULL},
793 	{"SLT", sltfl, flavorCount(sltfl), TRUE, NULL},
794 	{"SMI", smifl, flavorCount(smifl), TRUE, NULL},
795 	{"SNE", snefl, flavorCount(snefl), TRUE, NULL},
796 	{"SPL", splfl, flavorCount(splfl), TRUE, NULL},
797 	{"ST", stfl, flavorCount(stfl), TRUE, NULL},
798 	{"STOP", stopfl, flavorCount(stopfl), TRUE, NULL},
799 	{"SUB", subfl, flavorCount(subfl), TRUE, NULL},
800 	{"SUBA", subafl, flavorCount(subafl), TRUE, NULL},
801 	{"SUBI", subifl, flavorCount(subifl), TRUE, NULL},
802 	{"SUBQ", subqfl, flavorCount(subqfl), TRUE, NULL},
803 	{"SUBX", subxfl, flavorCount(subxfl), TRUE, NULL},
804 	{"SVC", svcfl, flavorCount(svcfl), TRUE, NULL},
805 	{"SVS", svsfl, flavorCount(svsfl), TRUE, NULL},
806 	{"SWAP", swapfl, flavorCount(swapfl), TRUE, NULL},
807 	{"TAS", tasfl, flavorCount(tasfl), TRUE, NULL},
808 	{"TRAP", trapfl, flavorCount(trapfl), TRUE, NULL},
809 	{"TRAPV", trapvfl, flavorCount(trapvfl), TRUE, NULL},
810 	{"TST", tstfl, flavorCount(tstfl), TRUE, NULL},
811 	{"UNLK", unlkfl, flavorCount(unlkfl), TRUE, NULL}
812 };
813 
814 
815 /* Declare a global variable containing the size of the instruction table */
816 
817 /*									*/
818 /* Debugged 10/28/91 (Tan Phan):					*/
819 /* "short int" to just "int"						*/
820 /*									*/
821 int tableSize = sizeof(instTable) / sizeof(instruction);
822