1 
2 #include "debugger.h"
3 #include "v60.h"
4 
5 static const UINT8 *rombase;
6 static offs_t pcbase;
7 
8 #define readop(a)	rombase[(a) - pcbase]
9 
read8(unsigned pc)10 static signed char read8(unsigned pc)
11 {
12 	return readop(pc);
13 }
14 
read16(unsigned pc)15 static signed short read16(unsigned pc)
16 {
17 	return readop(pc) | (readop(pc+1) << 8);
18 }
19 
read32(unsigned pc)20 static signed int read32(unsigned pc)
21 {
22 	return readop(pc) | (readop(pc+1) << 8)| (readop(pc+2) << 16)| (readop(pc+3) << 24);
23 }
24 
out_AM_Register(int reg,char * out)25 static void out_AM_Register(int reg, char *out)
26 {
27 	strcat(out, v60_reg_names[reg]);
28 }
29 
out_AM_RegisterIndirect(int reg,int opsize,char * out)30 static void out_AM_RegisterIndirect(int reg, int opsize, char *out)
31 {
32 	if(opsize & 0x80)
33 		*out++ = '@';
34 	sprintf(out, "[%s]", v60_reg_names[reg]);
35 }
36 
out_AM_RegisterIndirectIndexed(int rn,int rx,int opsize,char * out)37 static void out_AM_RegisterIndirectIndexed(int rn, int rx, int opsize, char *out)
38 {
39 	if(opsize & 0x80)
40 		sprintf(out, "%s@[%s]", v60_reg_names[rx], v60_reg_names[rn]);
41 	else
42 		sprintf(out, "[%s](%s)", v60_reg_names[rn], v60_reg_names[rx]);
43 
44 }
45 
out_AM_Autoincrement(int reg,int opsize,char * out)46 static void out_AM_Autoincrement(int reg, int opsize, char *out)
47 {
48 	if(opsize & 0x80)
49 		*out++ = '@';
50 	sprintf(out, "[%s+]", v60_reg_names[reg]);
51 }
52 
out_AM_Autodecrement(int reg,int opsize,char * out)53 static void out_AM_Autodecrement(int reg, int opsize, char *out)
54 {
55 	if(opsize & 0x80)
56 		*out++ = '@';
57 	sprintf(out, "[-%s]", v60_reg_names[reg]);
58 }
59 
out_AM_Displacement(int reg,int disp,int opsize,char * out)60 static void out_AM_Displacement(int reg, int disp, int opsize, char *out)
61 {
62 	sprintf(out, "%s%X%s[%s]",
63 			disp >= 0 ? "" : "-", disp >= 0 ? disp : -disp,
64 			opsize & 0x80 ? "@" : "",
65 			v60_reg_names[reg]);
66 }
67 
out_AM_DisplacementIndexed(int rn,int rx,int disp,int opsize,char * out)68 static void out_AM_DisplacementIndexed(int rn, int rx, int disp, int opsize, char *out)
69 {
70 	if(opsize & 0x80)
71 		sprintf(out, "%s@%s%X[%s]", v60_reg_names[rx], disp >= 0 ? "" : "-", disp >= 0 ? disp : -disp,v60_reg_names[rn]);
72 	else
73 		sprintf(out, "%s%X[%s](%s)", disp >= 0 ? "" : "-", disp >= 0 ? disp : -disp,v60_reg_names[rn], v60_reg_names[rx]);
74 }
75 
out_AM_PCDisplacement(unsigned pc,int disp,int opsize,char * out)76 static void out_AM_PCDisplacement(unsigned pc, int disp, int opsize, char *out)
77 {
78 	sprintf(out, "%X%s[PC]", pc+disp, opsize & 0x80 ? "@" : "");
79 }
80 
out_AM_PCDisplacementIndexed(unsigned pc,int disp,int rx,int opsize,char * out)81 static void out_AM_PCDisplacementIndexed(unsigned pc, int disp, int rx, int opsize, char *out)
82 {
83 	if(opsize & 0x80)
84 		sprintf(out, "%s@%X[PC]", v60_reg_names[rx], pc+disp);
85 	else
86 		sprintf(out, "%X[PC](%s)", pc+disp, v60_reg_names[rx]);
87 }
88 
out_AM_DisplacementIndirect(int reg,int disp,int opsize,char * out)89 static void out_AM_DisplacementIndirect(int reg, int disp, int opsize, char *out)
90 {
91 	sprintf(out, "%s[%s%X[%s]]",
92 			opsize & 0x80 ? "@" : "",
93 			disp >= 0 ? "" : "-", disp >= 0 ? disp : -disp,
94 			v60_reg_names[reg]);
95 }
96 
out_AM_DisplacementIndirectIndexed(int rn,int rx,int disp,int opsize,char * out)97 static void out_AM_DisplacementIndirectIndexed(int rn, int rx, int disp, int opsize, char *out)
98 {
99 	if(opsize & 0x80)
100 		sprintf(out, "%s@[%s%X[%s]]", v60_reg_names[rx], disp >= 0 ? "" : "-", disp >= 0 ? disp : -disp,v60_reg_names[rn]);
101 	else
102 		sprintf(out, "[%s%X[%s]](%s)", disp >= 0 ? "" : "-", disp >= 0 ? disp : -disp,v60_reg_names[rn], v60_reg_names[rx]);
103 }
104 
out_AM_PCDisplacementIndirect(unsigned pc,int disp,int opsize,char * out)105 static void out_AM_PCDisplacementIndirect(unsigned pc, int disp, int opsize, char *out)
106 {
107 	sprintf(out, "%s[%X[PC]]", opsize & 0x80 ? "@" : "", pc+disp);
108 }
109 
out_AM_PCDisplacementIndirectIndexed(unsigned pc,int disp,int rx,int opsize,char * out)110 static void out_AM_PCDisplacementIndirectIndexed(unsigned pc, int disp, int rx, int opsize, char *out)
111 {
112 	if(opsize & 0x80)
113 		sprintf(out, "%s@[%X[PC]]", v60_reg_names[rx], pc+disp);
114 	else
115 		sprintf(out, "[%X[PC]](%s)", pc+disp, v60_reg_names[rx]);
116 }
117 
out_AM_DoubleDisplacement(int reg,int disp2,int disp1,int opsize,char * out)118 static void out_AM_DoubleDisplacement(int reg, int disp2, int disp1, int opsize, char *out)
119 {
120 	sprintf(out, "%s%X%s[%s%X[%s]]",
121 			disp1 >= 0 ? "" : "-", disp1 >= 0 ? disp1 : -disp1,
122 			opsize & 0x80 ? "@" : "",
123 			disp2 >= 0 ? "" : "-", disp2 >= 0 ? disp2 : -disp2,
124 			v60_reg_names[reg]);
125 }
126 
out_AM_PCDoubleDisplacement(unsigned pc,int disp2,int disp1,int opsize,char * out)127 static void out_AM_PCDoubleDisplacement(unsigned pc, int disp2, int disp1, int opsize, char *out)
128 {
129 	sprintf(out, "%s%X%s[%X[PC]]",
130 			disp1 >= 0 ? "" : "-", disp1 >= 0 ? disp1 : -disp1,
131 			opsize & 0x80 ? "@" : "",
132 			disp2 + pc);
133 }
134 
out_AM_DirectAddress(unsigned addr,int opsize,char * out)135 static void out_AM_DirectAddress(unsigned addr, int opsize, char *out)
136 {
137 	if(opsize & 0x80)
138 		*out++ = '@';
139 	sprintf(out, "%X", addr);
140 }
141 
out_AM_DirectAddressIndexed(unsigned addr,int rx,int opsize,char * out)142 static void out_AM_DirectAddressIndexed(unsigned addr, int rx, int opsize, char *out)
143 {
144 	if(opsize & 0x80)
145 		sprintf(out, "%s@%X", v60_reg_names[rx], addr);
146 	else
147 		sprintf(out, "%X(%s)", addr, v60_reg_names[rx]);
148 }
149 
out_AM_DirectAddressDeferred(unsigned addr,int opsize,char * out)150 static void out_AM_DirectAddressDeferred(unsigned addr, int opsize, char *out)
151 {
152 	if(opsize & 0x80)
153 		*out++ = '@';
154 	sprintf(out, "[%X]", addr);
155 }
156 
out_AM_DirectAddressDeferredIndexed(unsigned addr,int rx,int opsize,char * out)157 static void out_AM_DirectAddressDeferredIndexed(unsigned addr, int rx, int opsize, char *out)
158 {
159 	if(opsize & 0x80)
160 		sprintf(out, "%s@[%X]", v60_reg_names[rx], addr);
161 	else
162 		sprintf(out, "[%X](%s)", addr, v60_reg_names[rx]);
163 }
164 
out_AM_Immediate(unsigned value,int opsize,char * out)165 static void out_AM_Immediate(unsigned value, int opsize, char *out)
166 {
167 	if(opsize == 0)
168 		value &= 0xff;
169 	else if(opsize == 1)
170 		value &= 0xffff;
171 
172 	sprintf(out, "#%X", value);
173 }
174 
decode_AM(unsigned ipc,unsigned pc,int m,int opsize,char * out)175 static int decode_AM(unsigned ipc, unsigned pc, int m, int opsize, char *out)
176 {
177 	unsigned char mod = readop(pc);
178 	if(m) {
179 		switch(mod>>5) {
180 		case 0: // Double displacement (8 bit)
181 			out_AM_DoubleDisplacement(mod&0x1F, read8(pc+1), read8(pc+2), opsize, out);
182 			return 3;
183 
184 		case 1: // Double displacement (16 bit)
185 			out_AM_DoubleDisplacement(mod&0x1F, read16(pc+1), read16(pc+3), opsize, out);
186 			return 5;
187 
188 		case 2: // Double displacement (32 bit)
189 			out_AM_DoubleDisplacement(mod&0x1F, read32(pc+1), read32(pc+5), opsize, out);
190 			return 9;
191 
192 		case 3: // Register
193 			out_AM_Register(mod&0x1F, out);
194 			return 1;
195 
196 		case 4: // Autoincrement
197 			out_AM_Autoincrement(mod&0x1F, opsize, out);
198 			return 1;
199 
200 		case 5: // Autodecrement
201 			out_AM_Autodecrement(mod&0x1F, opsize, out);
202 			return 1;
203 
204 		case 6:
205 			switch (readop(pc+1)>>5)
206 				{
207 				case 0: // Displacement indexed (8 bit)
208 					out_AM_DisplacementIndexed(readop(pc+1)&0x1F, mod&0x1F, read8(pc+2), opsize, out);
209 					return 3;
210 
211 				case 1: // Displacement indexed (16 bit)
212 					out_AM_DisplacementIndexed(readop(pc+1)&0x1F, mod&0x1F, read16(pc+2), opsize, out);
213 					return 4;
214 
215 				case 2: // Displacement indexed (32 bit)
216 					out_AM_DisplacementIndexed(readop(pc+1)&0x1F, mod&0x1F, read32(pc+2), opsize, out);
217 					return 6;
218 
219 				case 3:	// Register indirect indexed
220 					out_AM_RegisterIndirectIndexed(readop(pc+1)&0x1F, mod&0x1F, opsize, out);
221 					return 2;
222 
223 				case 4: // Displacement indirect indexed (8 bit)
224 					out_AM_DisplacementIndirectIndexed(readop(pc+1)&0x1F, mod&0x1F, read8(pc+2), opsize, out);
225 					return 3;
226 
227 				case 5: // Displacement indirect indexed (16 bit)
228 					out_AM_DisplacementIndirectIndexed(readop(pc+1)&0x1F, mod&0x1F, read16(pc+2), opsize, out);
229 					return 4;
230 
231 				case 6: // Displacement indirect indexed (32 bit)
232 					out_AM_DisplacementIndirectIndexed(readop(pc+1)&0x1F, mod&0x1F, read32(pc+2), opsize, out);
233 					return 6;
234 
235 				case 7:
236 					switch (readop(pc+1)&0x1F)
237 						{
238 						case 16: // PC Displacement Indexed (8 bit)
239 							out_AM_PCDisplacementIndexed(ipc, read8(pc+2), mod&0x1F, opsize, out);
240 							return 3;
241 
242 						case 17: // PC Displacement Indexed (16 bit)
243 							out_AM_PCDisplacementIndexed(ipc, read16(pc+2), mod&0x1F, opsize, out);
244 							return 4;
245 
246 						case 18: // PC Displacement Indexed (32 bit)
247 							out_AM_PCDisplacementIndexed(ipc, read32(pc+2), mod&0x1F, opsize, out);
248 							return 6;
249 
250 						case 19: // Direct Address Indexed
251 							out_AM_DirectAddressIndexed(read32(pc+2), mod&0x1F, opsize, out);
252 							return 6;
253 
254 						case 24: // PC Displacement Indirect Indexed(8 bit)
255 							out_AM_PCDisplacementIndirectIndexed(ipc, read8(pc+2), mod&0x1F, opsize, out);
256 							return 3;
257 
258 						case 25: // PC Displacement Indirect Indexed (16 bit)
259 							out_AM_PCDisplacementIndirectIndexed(ipc, read16(pc+2), mod&0x1F, opsize, out);
260 							return 4;
261 
262 						case 26: // PC Displacement Indirect Indexed (32 bit)
263 							out_AM_PCDisplacementIndirectIndexed(ipc, read32(pc+2), mod&0x1F, opsize, out);
264 							return 6;
265 
266 						case 27: // Direct Address Deferred Indexed
267 							out_AM_DirectAddressDeferredIndexed(read32(pc+2), mod&0x1F, opsize, out);
268 							return 6;
269 
270 						default:
271 							strcat(out, "!ERRAM3");
272 							return 1;
273 						}
274 
275 				default:
276 					strcat(out, "!ERRAM2");
277 					return 1;
278 				}
279 
280 		default:
281 			strcat(out, "!ERRAM1");
282 			return 1;
283 		}
284 	} else {
285 		switch(mod>>5) {
286 		case 0: // Displacement (8 bit)
287 			out_AM_Displacement(mod&0x1F, read8(pc+1), opsize, out);
288 			return 2;
289 
290 		case 1: // Displacement (16 bit)
291 			out_AM_Displacement(mod&0x1F, read16(pc+1), opsize, out);
292 			return 3;
293 
294 		case 2: // Displacement (32 bit)
295 			out_AM_Displacement(mod&0x1F, read32(pc+1), opsize, out);
296 			return 5;
297 
298 		case 3: // Register indirect
299 			out_AM_RegisterIndirect(mod&0x1F, opsize, out);
300 			return 1;
301 
302 		case 4: // Displacement indirect (8 bit)
303 			out_AM_DisplacementIndirect(mod&0x1F, read8(pc+1), opsize, out);
304 			return 2;
305 
306 		case 5: // Displacement indirect (16 bit)
307 			out_AM_DisplacementIndirect(mod&0x1F, read16(pc+1), opsize, out);
308 			return 3;
309 
310 		case 6: // Displacement indirect (32 bit)
311 			out_AM_DisplacementIndirect(mod&0x1F, read32(pc+1), opsize, out);
312 			return 5;
313 
314 		case 7:
315 			switch(mod&0x1F) {
316 			case 0:
317 			case 1:
318 			case 2:
319 			case 3:
320 			case 4:
321 			case 5:
322 			case 6:
323 			case 7:
324 			case 8:
325 			case 9:
326 			case 10:
327 			case 11:
328 			case 12:
329 			case 13:
330 			case 14:
331 			case 15:
332 				out_AM_Immediate(mod&0x1F, opsize, out);
333 				return 1;
334 
335 			case 16: // PC Displacement (8 bit)
336 				out_AM_PCDisplacement(ipc, read8(pc+1), opsize, out);
337 				return 2;
338 
339 			case 17: // PC Displacement (16 bit)
340 				out_AM_PCDisplacement(ipc, read16(pc+1), opsize, out);
341 				return 3;
342 
343 			case 18: // PC Displacement (32 bit)
344 				out_AM_PCDisplacement(ipc, read32(pc+1), opsize, out);
345 				return 5;
346 
347 			case 19: // Direct Address
348 				out_AM_DirectAddress(read32(pc+1), opsize, out);
349 				return 5;
350 
351 
352 			case 20:
353 				switch(opsize&0x7F) {
354 				case 0: // Immediate (8 bit)
355 					out_AM_Immediate(read8(pc+1), opsize, out);
356 					return 2;
357 
358 				case 1: // Immediate (16 bit)
359 					out_AM_Immediate(read16(pc+1), opsize, out);
360 					return 3;
361 
362 				case 2: // Immediate (32 bit)
363 					out_AM_Immediate(read32(pc+1), opsize, out);
364 					return 5;
365 
366 				default:
367 					strcat(out, "!ERRAM6");
368 					return 1;
369 				}
370 
371 			case 24: // PC Displacement Indirect (8 bit)
372 				out_AM_PCDisplacementIndirect(ipc, read8(pc+1), opsize, out);
373 				return 2;
374 
375 			case 25: // PC Displacement Indirect (16 bit)
376 				out_AM_PCDisplacementIndirect(ipc, read16(pc+1), opsize, out);
377 				return 3;
378 
379 			case 26: // PC Displacement Indirect (32 bit)
380 				out_AM_PCDisplacementIndirect(ipc, read32(pc+1), opsize, out);
381 				return 5;
382 
383 			case 27: // Direct Address Deferred
384 				out_AM_DirectAddressDeferred(read32(pc+1), opsize, out);
385 				return 5;
386 
387 			case 28: // PC Double Displacement (8 bit)
388 				out_AM_PCDoubleDisplacement(ipc, read8(pc+1), read8(pc+2), opsize, out);
389 				return 3;
390 
391 			case 29: // PC Double Displacement (16 bit)
392 				out_AM_PCDoubleDisplacement(ipc, read16(pc+1), read16(pc+3), opsize, out);
393 				return 5;
394 
395 			case 30: // PC Double Displacement (32 bit)
396 				out_AM_PCDoubleDisplacement(ipc, read32(pc+1), read32(pc+5), opsize, out);
397 				return 9;
398 
399 			default:
400 				strcat(out, "!ERRAM5");
401 				return 1;
402 			}
403 
404 		default:
405 			strcat(out, "!ERRAM4");
406 			return 1;
407 		}
408 	}
409 }
410 
411 
decode_F1(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)412 static int decode_F1(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
413 {
414 	unsigned char code = readop(pc);
415 	sprintf(out, "%-8s", opnm);
416 	if(code & 0x20) {
417 		int ret = decode_AM(ipc, pc+1, code & 0x40, opsize1, out + strlen(out)) + 2;
418 		strcat(out, ", ");
419 		out_AM_Register(code & 0x1f, out + strlen(out));
420 		return ret;
421 	} else {
422 		out_AM_Register(code & 0x1f, out + strlen(out));
423 		strcat(out, ", ");
424 		return decode_AM(ipc, pc+1, code & 0x40, opsize1, out + strlen(out)) + 2;
425 	}
426 }
427 
decode_F2(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)428 static int decode_F2(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
429 {
430 	int ret;
431 	unsigned char code = readop(pc);
432 	sprintf(out, "%-8s", opnm);
433 	ret = decode_AM(ipc, pc+1, code & 0x40, opsize1, out + strlen(out));
434 	strcat(out, ", ");
435 	ret += decode_AM(ipc, pc+1+ret, code & 0x20, opsize2, out + strlen(out));
436 	return ret+2;
437 }
438 
decode_F1F2(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)439 static int decode_F1F2(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
440 {
441 	if(readop(pc) & 0x80)
442 		return decode_F2(opnm, opsize1, opsize2, ipc, pc, out);
443 	else
444 		return decode_F1(opnm, opsize1, opsize2, ipc, pc, out);
445 }
446 
decode_F3(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)447 static int decode_F3(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
448 {
449 	sprintf(out, "%-8s", opnm);
450 	return decode_AM(ipc, pc, readop(pc-1) & 1, opsize1, out + strlen(out)) + 1;
451 }
452 
decode_F4a(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)453 static int decode_F4a(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
454 {
455 	sprintf(out, "%-8s%X", opnm, ipc+read8(pc));
456 	return 2;
457 }
458 
decode_F4b(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)459 static int decode_F4b(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
460 {
461 	sprintf(out, "%-8s%X", opnm, ipc+read16(pc));
462 	return 3;
463 }
464 
decode_F5(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)465 static int decode_F5(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
466 {
467 	strcpy(out, opnm);
468 	return 1;
469 }
470 
decode_F6(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)471 static int decode_F6(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
472 {
473 	sprintf(out, "%-8s%s, %X[PC]", opnm, v60_reg_names[readop(pc) & 0x1f], ipc+read16(pc+1));
474 	return 4;
475 }
476 
decode_F7a(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)477 static int decode_F7a(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
478 {
479 	int ret;
480 	unsigned char code = readop(pc);
481 	unsigned char code2;
482 
483 	sprintf(out, "%-8s", opnm);
484 	ret = decode_AM(ipc, pc+1, code & 0x40, opsize1, out + strlen(out));
485 	strcat(out, ", ");
486 
487 	code2 = readop(pc+1+ret);
488 	if(code2 & 0x80)
489 		out_AM_Register(code2 & 0x1f, out + strlen(out));
490 	else
491 		out_AM_Immediate(code2, 1, out + strlen(out));
492 	strcat(out, ", ");
493 
494 	ret += decode_AM(ipc, pc+2+ret, code & 0x20, opsize2, out + strlen(out));
495 	strcat(out, ", ");
496 
497 	code2 = readop(pc+2+ret);
498 	if(code2 & 0x80)
499 		out_AM_Register(code2 & 0x1f, out + strlen(out));
500 	else
501 		out_AM_Immediate(code2, 1, out + strlen(out));
502 
503 	return ret+4;
504 }
505 
decode_F7b(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)506 static int decode_F7b(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
507 {
508 	int ret;
509 	unsigned char code = readop(pc);
510 	unsigned char code2;
511 
512 	sprintf(out, "%-8s", opnm);
513 	ret = decode_AM(ipc, pc+1, code & 0x40, opsize1, out + strlen(out));
514 	strcat(out, ", ");
515 
516 	code2 = readop(pc+1+ret);
517 	if(code2 & 0x80)
518 		out_AM_Register(code2 & 0x1f, out + strlen(out));
519 	else
520 		out_AM_Immediate(code2, 1, out + strlen(out));
521 	strcat(out, ", ");
522 
523 	ret += decode_AM(ipc, pc+2+ret, code & 0x20, opsize2, out + strlen(out));
524 
525 	return ret+3;
526 }
527 
decode_F7c(const char * opnm,int opsize1,int opsize2,unsigned ipc,unsigned pc,char * out)528 static int decode_F7c(const char *opnm, int opsize1, int opsize2, unsigned ipc, unsigned pc, char *out)
529 {
530 	int ret;
531 	unsigned char code = readop(pc);
532 	unsigned char code2;
533 
534 	sprintf(out, "%-8s", opnm);
535 	ret = decode_AM(ipc, pc+1, code & 0x40, opsize1, out + strlen(out));
536 	strcat(out, ", ");
537 
538 	ret += decode_AM(ipc, pc+1+ret, code & 0x20, opsize2, out + strlen(out));
539 	strcat(out, ", ");
540 
541 	code2 = readop(pc+1+ret);
542 	if(code2 & 0x80)
543 		out_AM_Register(code2 & 0x1f, out + strlen(out));
544 	else
545 		out_AM_Immediate(code2, 1, out + strlen(out));
546 
547 	return ret+3;
548 }
549 
dopUNHANDLED(unsigned ipc,unsigned pc,char * out)550 static int dopUNHANDLED(unsigned ipc, unsigned pc, char *out)
551 {
552 	sprintf(out, "$%02X", readop(pc));
553 	return 1;
554 }
555 
dop58UNHANDLED(unsigned ipc,unsigned pc,char * out)556 static int dop58UNHANDLED(unsigned ipc, unsigned pc, char *out)
557 {
558 	sprintf(out, "$58");
559 	return 1;
560 }
561 
dop59UNHANDLED(unsigned ipc,unsigned pc,char * out)562 static int dop59UNHANDLED(unsigned ipc, unsigned pc, char *out)
563 {
564 	sprintf(out, "$59");
565 	return 1;
566 }
567 
dop5AUNHANDLED(unsigned ipc,unsigned pc,char * out)568 static int dop5AUNHANDLED(unsigned ipc, unsigned pc, char *out)
569 {
570 	sprintf(out, "$5A");
571 	return 1;
572 }
573 
dop5BUNHANDLED(unsigned ipc,unsigned pc,char * out)574 static int dop5BUNHANDLED(unsigned ipc, unsigned pc, char *out)
575 {
576 	sprintf(out, "$5B");
577 	return 1;
578 }
579 
dop5CUNHANDLED(unsigned ipc,unsigned pc,char * out)580 static int dop5CUNHANDLED(unsigned ipc, unsigned pc, char *out)
581 {
582 	sprintf(out, "$5C");
583 	return 1;
584 }
585 
dop5DUNHANDLED(unsigned ipc,unsigned pc,char * out)586 static int dop5DUNHANDLED(unsigned ipc, unsigned pc, char *out)
587 {
588 	sprintf(out, "$5D");
589 	return 1;
590 }
591 
dop5EUNHANDLED(unsigned ipc,unsigned pc,char * out)592 static int dop5EUNHANDLED(unsigned ipc, unsigned pc, char *out)
593 {
594 	sprintf(out, "$5E");
595 	return 1;
596 }
597 
dop5FUNHANDLED(unsigned ipc,unsigned pc,char * out)598 static int dop5FUNHANDLED(unsigned ipc, unsigned pc, char *out)
599 {
600 	sprintf(out, "$5F");
601 	return 1;
602 }
603 
604 #define DEFINE_EASY_OPCODE(name, opnm, ftype, opsize1, opsize2) \
605 	static int dop ## name(unsigned ipc, unsigned pc, char *out) \
606 	{ \
607 		return decode_ ## ftype(opnm, opsize1, opsize2, ipc, pc, out); \
608 	}
609 
610 #define DEFINE_EASY_OPCODE_EX(name, opnm, ftype, opsize1, opsize2, flags) \
611 	static int dop ## name(unsigned ipc, unsigned pc, char *out) \
612 	{ \
613 		return decode_ ## ftype(opnm, opsize1, opsize2, ipc, pc, out) | (flags); \
614 	}
615 
616 #define DEFINE_TRIPLE_OPCODE(name, string, ftype) \
617 	DEFINE_EASY_OPCODE(name##B,string ".b", ftype, 0, 0) \
618 	DEFINE_EASY_OPCODE(name##H,string ".h", ftype, 1, 1) \
619 	DEFINE_EASY_OPCODE(name##W,string ".w", ftype, 2, 2)
620 
621 #define DEFINE_DOUBLE_OPCODE(name, string, ftype) \
622 	DEFINE_EASY_OPCODE(name##B,string ".b", ftype, 0, 0) \
623 	DEFINE_EASY_OPCODE(name##H,string ".h", ftype, 1, 1)
624 
625 #define DEFINE_FPU_OPCODE(name,string,ftype) \
626 	DEFINE_EASY_OPCODE(name##S,string ".s", ftype, 2, 2) \
627 	DEFINE_EASY_OPCODE(name##L,string ".l", ftype, 2, 2)
628 
629 
630 DEFINE_FPU_OPCODE(ABSF, "absf", F2)
631 DEFINE_TRIPLE_OPCODE(ADD, "add", F1F2)
632 DEFINE_TRIPLE_OPCODE(ADDC, "addc", F1F2)
633 DEFINE_EASY_OPCODE(ADDDC, "adddc", F7c, 0, 0)
634 DEFINE_FPU_OPCODE(ADDF, "addf", F2)
635 DEFINE_TRIPLE_OPCODE(AND, "and", F1F2)
636 DEFINE_EASY_OPCODE(ANDBSU, "andbsu", F7b, 0x80, 0x80)
637 DEFINE_EASY_OPCODE(ANDBSD, "andbsd", F7b, 0x80, 0x80)
638 DEFINE_EASY_OPCODE(ANDNBSU, "andnbsu", F7b, 0x80, 0x80)
639 DEFINE_EASY_OPCODE(ANDNBSD, "andnbsd", F7b, 0x80, 0x80)
640 DEFINE_EASY_OPCODE(BGT8, "bgt", F4a, 0, 0)
641 DEFINE_EASY_OPCODE(BGT16, "bgt", F4b, 0, 0)
642 DEFINE_EASY_OPCODE(BGE8, "bge", F4a, 0, 0)
643 DEFINE_EASY_OPCODE(BGE16, "bge", F4b, 0, 0)
644 DEFINE_EASY_OPCODE(BLT8, "blt", F4a, 0, 0)
645 DEFINE_EASY_OPCODE(BLT16, "blt", F4b, 0, 0)
646 DEFINE_EASY_OPCODE(BLE8, "ble", F4a, 0, 0)
647 DEFINE_EASY_OPCODE(BLE16, "ble", F4b, 0, 0)
648 DEFINE_EASY_OPCODE(BH8, "bh", F4a, 0, 0)
649 DEFINE_EASY_OPCODE(BH16, "bh", F4b, 0, 0)
650 DEFINE_EASY_OPCODE(BNL8, "bnl", F4a, 0, 0)
651 DEFINE_EASY_OPCODE(BNL16, "bnl", F4b, 0, 0)
652 DEFINE_EASY_OPCODE(BL8, "bl", F4a, 0, 0)
653 DEFINE_EASY_OPCODE(BL16, "bl", F4b, 0, 0)
654 DEFINE_EASY_OPCODE(BNH8, "bnh", F4a, 0, 0)
655 DEFINE_EASY_OPCODE(BNH16, "bnh", F4b, 0, 0)
656 DEFINE_EASY_OPCODE(BE8, "be", F4a, 0, 0)
657 DEFINE_EASY_OPCODE(BE16, "be", F4b, 0, 0)
658 DEFINE_EASY_OPCODE(BNE8, "bne", F4a, 0, 0)
659 DEFINE_EASY_OPCODE(BNE16, "bne", F4b, 0, 0)
660 DEFINE_EASY_OPCODE(BV8, "bv", F4a, 0, 0)
661 DEFINE_EASY_OPCODE(BV16, "bv", F4b, 0, 0)
662 DEFINE_EASY_OPCODE(BNV8, "bnv", F4a, 0, 0)
663 DEFINE_EASY_OPCODE(BNV16, "bnv", F4b, 0, 0)
664 DEFINE_EASY_OPCODE(BN8, "bn", F4a, 0, 0)
665 DEFINE_EASY_OPCODE(BN16, "bn", F4b, 0, 0)
666 DEFINE_EASY_OPCODE(BP8, "bp", F4a, 0, 0)
667 DEFINE_EASY_OPCODE(BP16, "bp", F4b, 0, 0)
668 DEFINE_EASY_OPCODE(BR8, "br", F4a, 0, 0)
669 DEFINE_EASY_OPCODE(BR16, "br", F4b, 0, 0)
670 DEFINE_EASY_OPCODE(BRK, "brk", F5, 0, 0)
671 DEFINE_EASY_OPCODE(BRKV, "brkv", F5, 0, 0)
672 DEFINE_EASY_OPCODE_EX(BSR, "bsr", F4b, 0, 0, DASMFLAG_STEP_OVER)
673 DEFINE_EASY_OPCODE_EX(CALL, "call", F1F2, 0, 2, DASMFLAG_STEP_OVER)
674 DEFINE_EASY_OPCODE(CAXI, "caxi", F1, 2, 2)
675 DEFINE_EASY_OPCODE(CHKAR, "chkar", F1F2, 0, 0) // ?
676 DEFINE_EASY_OPCODE(CHKAW, "chkaw", F1F2, 0, 0) // ?
677 DEFINE_EASY_OPCODE(CHKAE, "chkae", F1F2, 0, 0)
678 DEFINE_EASY_OPCODE(CHLVL, "chlvl", F1F2, 0, 0)
679 DEFINE_EASY_OPCODE(CLR1, "clr1", F1F2, 2, 2)
680 DEFINE_EASY_OPCODE(CLRTLB, "clrtlb", F3, 0, 0) // ?
681 DEFINE_EASY_OPCODE(CLRTLBA, "clrtlba", F5, 0, 0)
682 DEFINE_TRIPLE_OPCODE(CMP, "cmp", F1F2)
683 DEFINE_EASY_OPCODE(CMPBFS, "cmpbfs", F7b, 0x82, 2)
684 DEFINE_EASY_OPCODE(CMPBFZ, "cmpbfz", F7b, 0x82, 2)
685 DEFINE_EASY_OPCODE(CMPBFL, "cmpbfl", F7b, 0x82, 2)
686 DEFINE_DOUBLE_OPCODE(CMPC, "cmpc", F7a)
687 DEFINE_DOUBLE_OPCODE(CMPCF, "cmpcf", F7a)
688 DEFINE_DOUBLE_OPCODE(CMPCS, "cmpcs", F7a)
689 DEFINE_FPU_OPCODE(CMPF, "cmpf", F2)
690 DEFINE_EASY_OPCODE(CVTSL, "cvt.sl", F2, 0, 1)
691 DEFINE_EASY_OPCODE(CVTLS, "cvt.ls", F2, 1, 0)
692 DEFINE_EASY_OPCODE(CVTWS, "cvt.ws", F2, 2, 0)
693 DEFINE_EASY_OPCODE(CVTWL, "cvt.wl", F2, 2, 1)
694 DEFINE_EASY_OPCODE(CVTSW, "cvt.sw", F2, 0, 2)
695 DEFINE_EASY_OPCODE(CVTLW, "cvt.lw", F2, 1, 2)
696 DEFINE_EASY_OPCODE(CVTDPZ, "cvtd.pz", F7c, 0, 1)
697 DEFINE_EASY_OPCODE(CVTDZP, "cvtd.zp", F7c, 1, 0)
698 DEFINE_EASY_OPCODE_EX(DBGT, "dbgt", F6, 0, 0, DASMFLAG_STEP_OVER)
699 DEFINE_EASY_OPCODE_EX(DBGE, "dbge", F6, 0, 0, DASMFLAG_STEP_OVER)
700 DEFINE_EASY_OPCODE_EX(DBLT, "dbgt", F6, 0, 0, DASMFLAG_STEP_OVER)
701 DEFINE_EASY_OPCODE_EX(DBLE, "dbge", F6, 0, 0, DASMFLAG_STEP_OVER)
702 DEFINE_EASY_OPCODE_EX(DBH, "dbh", F6, 0, 0, DASMFLAG_STEP_OVER)
703 DEFINE_EASY_OPCODE_EX(DBNL, "dbnl", F6, 0, 0, DASMFLAG_STEP_OVER)
704 DEFINE_EASY_OPCODE_EX(DBL, "dbl", F6, 0, 0, DASMFLAG_STEP_OVER)
705 DEFINE_EASY_OPCODE_EX(DBNH, "dbnh", F6, 0, 0, DASMFLAG_STEP_OVER)
706 DEFINE_EASY_OPCODE_EX(DBE, "dbe", F6, 0, 0, DASMFLAG_STEP_OVER)
707 DEFINE_EASY_OPCODE_EX(DBNE, "dbne", F6, 0, 0, DASMFLAG_STEP_OVER)
708 DEFINE_EASY_OPCODE_EX(DBV, "dbe", F6, 0, 0, DASMFLAG_STEP_OVER)
709 DEFINE_EASY_OPCODE_EX(DBNV, "dbne", F6, 0, 0, DASMFLAG_STEP_OVER)
710 DEFINE_EASY_OPCODE_EX(DBN, "dbn", F6, 0, 0, DASMFLAG_STEP_OVER)
711 DEFINE_EASY_OPCODE_EX(DBP, "dbp", F6, 0, 0, DASMFLAG_STEP_OVER)
712 DEFINE_EASY_OPCODE_EX(DBR, "dbr", F6, 0, 0, DASMFLAG_STEP_OVER)
713 DEFINE_TRIPLE_OPCODE(DEC, "dec", F3)
714 DEFINE_EASY_OPCODE(DISPOSE, "dispose", F5, 0, 0)
715 DEFINE_TRIPLE_OPCODE(DIV, "div", F1F2)
716 DEFINE_FPU_OPCODE(DIVF, "divf", F2)
717 DEFINE_TRIPLE_OPCODE(DIVU, "divu", F1F2)
718 DEFINE_EASY_OPCODE(DIVX, "divx", F1F2, 2, 3)
719 DEFINE_EASY_OPCODE(DIVUX, "divux", F1F2, 2, 3)
720 DEFINE_EASY_OPCODE(EXTBFS, "extbfs", F7b, 0x82, 2)
721 DEFINE_EASY_OPCODE(EXTBFZ, "extbfz", F7b, 0x82, 2)
722 DEFINE_EASY_OPCODE(EXTBFL, "extbfl", F7b, 0x82, 2)
723 DEFINE_EASY_OPCODE(GETATE, "getate", F1F2, 0, 3) // ?
724 DEFINE_EASY_OPCODE(GETPSW, "getpsw", F3, 2, 0)
725 DEFINE_EASY_OPCODE(GETPTE, "getpte", F1F2, 0, 2) // ?
726 DEFINE_EASY_OPCODE(GETRA, "getra", F1F2, 0, 2) // ?
727 DEFINE_EASY_OPCODE(HALT, "halt", F5, 0, 0)
728 DEFINE_TRIPLE_OPCODE(IN, "in", F1F2)
729 DEFINE_TRIPLE_OPCODE(INC, "inc", F3)
730 DEFINE_EASY_OPCODE(INSBFL, "insbfl", F7c, 2, 0x82)
731 DEFINE_EASY_OPCODE(INSBFR, "insbfr", F7c, 2, 0x82)
732 DEFINE_EASY_OPCODE(JMP, "jmp", F3, 0, 0)
733 DEFINE_EASY_OPCODE_EX(JSR, "jsr", F3, 0, 0, DASMFLAG_STEP_OVER)
734 DEFINE_EASY_OPCODE(LDPR, "ldpr", F1F2, 2, 2)
735 DEFINE_EASY_OPCODE(LDTASK, "ldtask", F1F2, 2, 2)
736 DEFINE_TRIPLE_OPCODE(MOV, "mov", F1F2)
737 DEFINE_EASY_OPCODE(MOVBSU, "movbsu", F7b, 0x80, 0x80)
738 DEFINE_EASY_OPCODE(MOVBSD, "movbsd", F7b, 0x80, 0x80)
739 DEFINE_DOUBLE_OPCODE(MOVCU, "movcu", F7a)
740 DEFINE_DOUBLE_OPCODE(MOVCD, "movcd", F7a)
741 DEFINE_DOUBLE_OPCODE(MOVCFU, "movcfu", F7a)
742 DEFINE_DOUBLE_OPCODE(MOVCFD, "movcfd", F7a)
743 DEFINE_DOUBLE_OPCODE(MOVCS, "movcs", F7a)
744 DEFINE_EASY_OPCODE(MOVD, "mov.d", F1F2, 3, 3)
745 DEFINE_EASY_OPCODE(MOVEAB, "movea.b", F1F2, 0, 2)
746 DEFINE_EASY_OPCODE(MOVEAH, "movea.h", F1F2, 1, 2)
747 DEFINE_EASY_OPCODE(MOVEAW, "movea.w", F1F2, 2, 2)
748 DEFINE_FPU_OPCODE(MOVF, "movf", F2)
749 DEFINE_EASY_OPCODE(MOVSBH, "movs.bh", F1F2, 0, 1)
750 DEFINE_EASY_OPCODE(MOVSBW, "movs.bw", F1F2, 0, 2)
751 DEFINE_EASY_OPCODE(MOVSHW, "movs.hw", F1F2, 1, 2)
752 DEFINE_EASY_OPCODE(MOVTHB, "movt.hb", F1F2, 1, 0)
753 DEFINE_EASY_OPCODE(MOVTWB, "movt.wb", F1F2, 2, 0)
754 DEFINE_EASY_OPCODE(MOVTWH, "movt.wh", F1F2, 2, 1)
755 DEFINE_EASY_OPCODE(MOVZBH, "movz.bh", F1F2, 0, 1)
756 DEFINE_EASY_OPCODE(MOVZBW, "movz.bw", F1F2, 0, 2)
757 DEFINE_EASY_OPCODE(MOVZHW, "movz.hw", F1F2, 1, 2)
758 DEFINE_TRIPLE_OPCODE(MUL, "mul", F1F2)
759 DEFINE_FPU_OPCODE(MULF, "mulf", F2)
760 DEFINE_TRIPLE_OPCODE(MULU, "mulu", F1F2)
761 DEFINE_EASY_OPCODE(MULX, "mulx", F1F2, 2, 3)
762 DEFINE_EASY_OPCODE(MULUX, "mulux", F1F2, 2, 3)
763 DEFINE_TRIPLE_OPCODE(NEG, "neg", F1F2)
764 DEFINE_FPU_OPCODE(NEGF, "negf", F2)
765 DEFINE_EASY_OPCODE(NOP, "nop", F5, 0, 0)
766 DEFINE_TRIPLE_OPCODE(NOT, "not", F1F2)
767 DEFINE_EASY_OPCODE(NOT1, "not1", F1F2, 2, 2)
768 DEFINE_EASY_OPCODE(NOTBSU, "notbsu", F7b, 0x80, 0x80)
769 DEFINE_EASY_OPCODE(NOTBSD, "notbsd", F7b, 0x80, 0x80)
770 DEFINE_TRIPLE_OPCODE(OR, "or", F1F2)
771 DEFINE_EASY_OPCODE(ORBSU, "orbsu", F7b, 0x80, 0x80)
772 DEFINE_EASY_OPCODE(ORBSD, "orbsd", F7b, 0x80, 0x80)
773 DEFINE_EASY_OPCODE(ORNBSU, "ornbsu", F7b, 0x80, 0x80)
774 DEFINE_EASY_OPCODE(ORNBSD, "ornbsd", F7b, 0x80, 0x80)
775 DEFINE_TRIPLE_OPCODE(OUT, "out", F1F2)
776 DEFINE_EASY_OPCODE(POP, "pop", F3, 2, 0)
777 DEFINE_EASY_OPCODE(POPM, "popm", F3, 2, 0)
778 DEFINE_EASY_OPCODE(PREPARE, "prepare", F3, 2, 0)
779 DEFINE_EASY_OPCODE(PUSH, "push", F3, 2, 0)
780 DEFINE_EASY_OPCODE(PUSHM, "pushm", F3, 2, 0)
781 DEFINE_TRIPLE_OPCODE(REM, "rem", F1F2)
782 DEFINE_TRIPLE_OPCODE(REMU, "remu", F1F2)
783 DEFINE_EASY_OPCODE_EX(RET, "ret", F3, 2, 0, DASMFLAG_STEP_OUT)
784 DEFINE_EASY_OPCODE_EX(RETIU, "retiu", F3, 1, 0, DASMFLAG_STEP_OUT)
785 DEFINE_EASY_OPCODE_EX(RETIS, "retis", F3, 1, 0, DASMFLAG_STEP_OUT)
786 DEFINE_EASY_OPCODE(ROTB, "rot.b", F1F2, 0, 0)
787 DEFINE_EASY_OPCODE(ROTH, "rot.h", F1F2, 0, 1)
788 DEFINE_EASY_OPCODE(ROTW, "rot.w", F1F2, 0, 2)
789 DEFINE_EASY_OPCODE(ROTCB, "rotc.b", F1F2, 0, 0)
790 DEFINE_EASY_OPCODE(ROTCH, "rotc.h", F1F2, 0, 1)
791 DEFINE_EASY_OPCODE(ROTCW, "rotc.w", F1F2, 0, 2)
792 DEFINE_EASY_OPCODE_EX(RSR, "rsr", F5, 0, 0, DASMFLAG_STEP_OUT)
793 DEFINE_EASY_OPCODE(RVBIT, "rvbit", F1F2, 0, 0)
794 DEFINE_EASY_OPCODE(RVBYT, "rvbyt", F1F2, 2, 2)
795 DEFINE_EASY_OPCODE(SCH0BSU, "sch0bsu", F7b, 0x80, 2)
796 DEFINE_EASY_OPCODE(SCH0BSD, "sch0bsd", F7b, 0x80, 2)
797 DEFINE_EASY_OPCODE(SCH1BSU, "sch1bsu", F7b, 0x80, 2)
798 DEFINE_EASY_OPCODE(SCH1BSD, "sch1bsd", F7b, 0x80, 2)
799 DEFINE_EASY_OPCODE(SCHCUB, "schcu.b", F7b, 0, 0)
800 DEFINE_EASY_OPCODE(SCHCDB, "schcd.b", F7b, 0, 0)
801 DEFINE_EASY_OPCODE(SCHCUH, "schcu.h", F7b, 1, 1)
802 DEFINE_EASY_OPCODE(SCHCDH, "schcd.h", F7b, 1, 1)
803 DEFINE_EASY_OPCODE(SCLFS, "sclf.s", F2, 1, 2)
804 DEFINE_EASY_OPCODE(SCLFL, "sclf.l", F2, 1, 2)
805 DEFINE_EASY_OPCODE(SET1, "set1", F1F2, 2, 2)
806 DEFINE_EASY_OPCODE(SETF, "setf", F1F2, 0, 0)
807 DEFINE_EASY_OPCODE(SHAB, "sha.b", F1F2, 0, 0)
808 DEFINE_EASY_OPCODE(SHAH, "sha.h", F1F2, 0, 1)
809 DEFINE_EASY_OPCODE(SHAW, "sha.w", F1F2, 0, 2)
810 DEFINE_EASY_OPCODE(SHLB, "shl.b", F1F2, 0, 0)
811 DEFINE_EASY_OPCODE(SHLH, "shl.h", F1F2, 0, 1)
812 DEFINE_EASY_OPCODE(SHLW, "shl.w", F1F2, 0, 2)
813 DEFINE_EASY_OPCODE(SKPCUB, "skpcu.b", F7b, 0, 0)
814 DEFINE_EASY_OPCODE(SKPCDB, "skpcd.b", F7b, 0, 0)
815 DEFINE_EASY_OPCODE(SKPCUH, "skpcu.h", F7b, 1, 1)
816 DEFINE_EASY_OPCODE(SKPCDH, "skpcd.h", F7b, 1, 1)
817 DEFINE_EASY_OPCODE(STPR, "stpr", F1F2, 2, 2)
818 DEFINE_EASY_OPCODE(STTASK, "sttask", F3, 2, 0)
819 DEFINE_TRIPLE_OPCODE(SUB, "sub", F1F2)
820 DEFINE_TRIPLE_OPCODE(SUBC, "subc", F1F2)
821 DEFINE_EASY_OPCODE(SUBDC, "subdc", F7c, 0, 0)
822 DEFINE_EASY_OPCODE(SUBRDC, "subrdc", F7c, 0, 0)
823 DEFINE_FPU_OPCODE(SUBF, "subf", F2)
824 DEFINE_EASY_OPCODE(TASI, "tasi", F3, 0, 0)
825 DEFINE_EASY_OPCODE(TB, "tb", F6, 0, 0)
826 DEFINE_TRIPLE_OPCODE(TEST, "test", F3)
827 DEFINE_EASY_OPCODE(TEST1, "test1", F1F2, 2, 2)
828 DEFINE_EASY_OPCODE_EX(TRAP, "trap", F3, 0, 0, DASMFLAG_STEP_OVER)
829 DEFINE_EASY_OPCODE(TRAPFL, "trapfl", F5, 0, 0)
830 DEFINE_EASY_OPCODE(UPDATE, "update", F1F2, 0, 3) // ?
831 DEFINE_EASY_OPCODE(UPDPSWH, "updpsw.h", F1F2, 2, 2)
832 DEFINE_EASY_OPCODE(UPDPSWW, "updpsw.w", F1F2, 2, 2)
833 DEFINE_EASY_OPCODE(UPDPTE, "updpte", F1F2, 0, 2) // ?
834 DEFINE_TRIPLE_OPCODE(XCH, "xch", F1)
835 DEFINE_TRIPLE_OPCODE(XOR, "xor", F1F2)
836 DEFINE_EASY_OPCODE(XORBSU, "xorbsu", F7b, 0x80, 0x80)
837 DEFINE_EASY_OPCODE(XORBSD, "xorbsd", F7b, 0x80, 0x80)
838 DEFINE_EASY_OPCODE(XORNBSU, "xornbsu", F7b, 0x80, 0x80)
839 DEFINE_EASY_OPCODE(XORNBSD, "xornbsd", F7b, 0x80, 0x80)
840 
841 static int (*const dasm_optable_58[32])(unsigned ipc, unsigned pc, char *out) =
842 {
843 	/* 0x00 */ dopCMPCB,
844 	/* 0x01 */ dopCMPCFB,
845 	/* 0x02 */ dopCMPCSB,
846 	/* 0x03 */ dop58UNHANDLED,
847 	/* 0x04 */ dop58UNHANDLED,
848 	/* 0x05 */ dop58UNHANDLED,
849 	/* 0x06 */ dop58UNHANDLED,
850 	/* 0x07 */ dop58UNHANDLED,
851 	/* 0x08 */ dopMOVCUB,
852 	/* 0x09 */ dopMOVCDB,
853 	/* 0x0A */ dopMOVCFUB,
854 	/* 0x0B */ dopMOVCFDB,
855 	/* 0x0C */ dopMOVCSB,
856 	/* 0x0D */ dop58UNHANDLED,
857 	/* 0x0E */ dop58UNHANDLED,
858 	/* 0x0F */ dop58UNHANDLED,
859 	/* 0x10 */ dop58UNHANDLED,
860 	/* 0x11 */ dop58UNHANDLED,
861 	/* 0x12 */ dop58UNHANDLED,
862 	/* 0x13 */ dop58UNHANDLED,
863 	/* 0x14 */ dop58UNHANDLED,
864 	/* 0x15 */ dop58UNHANDLED,
865 	/* 0x16 */ dop58UNHANDLED,
866 	/* 0x17 */ dop58UNHANDLED,
867 	/* 0x18 */ dopSCHCUB,
868 	/* 0x19 */ dopSCHCDB,
869 	/* 0x1A */ dopSKPCUB,
870 	/* 0x1B */ dopSKPCDB,
871 	/* 0x1C */ dop58UNHANDLED,
872 	/* 0x1D */ dop58UNHANDLED,
873 	/* 0x1E */ dop58UNHANDLED,
874 	/* 0x1F */ dop58UNHANDLED
875 };
876 
877 static int (*const dasm_optable_59[32])(unsigned ipc, unsigned pc, char *out) =
878 {
879 	/* 0x00 */ dopADDDC,
880 	/* 0x01 */ dopSUBDC,
881 	/* 0x02 */ dopSUBRDC,
882 	/* 0x03 */ dop59UNHANDLED,
883 	/* 0x04 */ dop59UNHANDLED,
884 	/* 0x05 */ dop59UNHANDLED,
885 	/* 0x06 */ dop59UNHANDLED,
886 	/* 0x07 */ dop59UNHANDLED,
887 	/* 0x08 */ dop59UNHANDLED,
888 	/* 0x09 */ dop59UNHANDLED,
889 	/* 0x0A */ dop59UNHANDLED,
890 	/* 0x0B */ dop59UNHANDLED,
891 	/* 0x0C */ dop59UNHANDLED,
892 	/* 0x0D */ dop59UNHANDLED,
893 	/* 0x0E */ dop59UNHANDLED,
894 	/* 0x0F */ dop59UNHANDLED,
895 	/* 0x10 */ dopCVTDPZ,
896 	/* 0x11 */ dop59UNHANDLED,
897 	/* 0x12 */ dop59UNHANDLED,
898 	/* 0x13 */ dop59UNHANDLED,
899 	/* 0x14 */ dop59UNHANDLED,
900 	/* 0x15 */ dop59UNHANDLED,
901 	/* 0x16 */ dop59UNHANDLED,
902 	/* 0x17 */ dop59UNHANDLED,
903 	/* 0x18 */ dopCVTDZP,
904 	/* 0x19 */ dop59UNHANDLED,
905 	/* 0x1A */ dop59UNHANDLED,
906 	/* 0x1B */ dop59UNHANDLED,
907 	/* 0x1C */ dop59UNHANDLED,
908 	/* 0x1D */ dop59UNHANDLED,
909 	/* 0x1E */ dop59UNHANDLED,
910 	/* 0x1F */ dop59UNHANDLED
911 };
912 
913 static int (*const dasm_optable_5A[32])(unsigned ipc, unsigned pc, char *out) =
914 {
915 	/* 0x00 */ dopCMPCH,
916 	/* 0x01 */ dopCMPCFH,
917 	/* 0x02 */ dopCMPCSH,
918 	/* 0x03 */ dop5AUNHANDLED,
919 	/* 0x04 */ dop5AUNHANDLED,
920 	/* 0x05 */ dop5AUNHANDLED,
921 	/* 0x06 */ dop5AUNHANDLED,
922 	/* 0x07 */ dop5AUNHANDLED,
923 	/* 0x08 */ dopMOVCUH,
924 	/* 0x09 */ dopMOVCDH,
925 	/* 0x0A */ dopMOVCFUH,
926 	/* 0x0B */ dopMOVCFDH,
927 	/* 0x0C */ dopMOVCSH,
928 	/* 0x0D */ dop5AUNHANDLED,
929 	/* 0x0E */ dop5AUNHANDLED,
930 	/* 0x0F */ dop5AUNHANDLED,
931 	/* 0x10 */ dop5AUNHANDLED,
932 	/* 0x11 */ dop5AUNHANDLED,
933 	/* 0x12 */ dop5AUNHANDLED,
934 	/* 0x13 */ dop5AUNHANDLED,
935 	/* 0x14 */ dop5AUNHANDLED,
936 	/* 0x15 */ dop5AUNHANDLED,
937 	/* 0x16 */ dop5AUNHANDLED,
938 	/* 0x17 */ dop5AUNHANDLED,
939 	/* 0x18 */ dopSCHCUH,
940 	/* 0x19 */ dopSCHCDH,
941 	/* 0x1A */ dopSKPCUH,
942 	/* 0x1B */ dopSKPCDH,
943 	/* 0x1C */ dop5AUNHANDLED,
944 	/* 0x1D */ dop5AUNHANDLED,
945 	/* 0x1E */ dop5AUNHANDLED,
946 	/* 0x1F */ dop5AUNHANDLED
947 };
948 
949 static int (*const dasm_optable_5B[32])(unsigned ipc, unsigned pc, char *out) =
950 {
951 	/* 0x00 */ dopSCH0BSU,
952 	/* 0x01 */ dopSCH0BSD,
953 	/* 0x02 */ dopSCH1BSU,
954 	/* 0x03 */ dopSCH1BSD,
955 	/* 0x04 */ dop5BUNHANDLED,
956 	/* 0x05 */ dop5BUNHANDLED,
957 	/* 0x06 */ dop5BUNHANDLED,
958 	/* 0x07 */ dop5BUNHANDLED,
959 	/* 0x08 */ dopMOVBSU,
960 	/* 0x09 */ dopMOVBSD,
961 	/* 0x0A */ dopNOTBSU,
962 	/* 0x0B */ dopNOTBSD,
963 	/* 0x0C */ dop5BUNHANDLED,
964 	/* 0x0D */ dop5BUNHANDLED,
965 	/* 0x0E */ dop5BUNHANDLED,
966 	/* 0x0F */ dop5BUNHANDLED,
967 	/* 0x10 */ dopANDBSU,
968 	/* 0x11 */ dopANDBSD,
969 	/* 0x12 */ dopANDNBSU,
970 	/* 0x13 */ dopANDNBSD,
971 	/* 0x14 */ dopORBSU,
972 	/* 0x15 */ dopORBSD,
973 	/* 0x16 */ dopORNBSU,
974 	/* 0x17 */ dopORNBSD,
975 	/* 0x18 */ dopXORBSU,
976 	/* 0x19 */ dopXORBSD,
977 	/* 0x1A */ dopXORNBSU,
978 	/* 0x1B */ dopXORNBSD,
979 	/* 0x1C */ dop5BUNHANDLED,
980 	/* 0x1D */ dop5BUNHANDLED,
981 	/* 0x1E */ dop5BUNHANDLED,
982 	/* 0x1F */ dop5BUNHANDLED
983 };
984 
985 static int (*const dasm_optable_5C[32])(unsigned ipc, unsigned pc, char *out) =
986 {
987 	/* 0x00 */ dopCMPFS,
988 	/* 0x01 */ dop5CUNHANDLED,
989 	/* 0x02 */ dop5CUNHANDLED,
990 	/* 0x03 */ dop5CUNHANDLED,
991 	/* 0x04 */ dop5CUNHANDLED,
992 	/* 0x05 */ dop5CUNHANDLED,
993 	/* 0x06 */ dop5CUNHANDLED,
994 	/* 0x07 */ dop5CUNHANDLED,
995 	/* 0x08 */ dopMOVFS,
996 	/* 0x09 */ dopNEGFS,
997 	/* 0x0A */ dopABSFS,
998 	/* 0x0B */ dop5CUNHANDLED,
999 	/* 0x0C */ dop5CUNHANDLED,
1000 	/* 0x0D */ dop5CUNHANDLED,
1001 	/* 0x0E */ dop5CUNHANDLED,
1002 	/* 0x0F */ dop5CUNHANDLED,
1003 	/* 0x10 */ dopSCLFS,
1004 	/* 0x11 */ dop5CUNHANDLED,
1005 	/* 0x12 */ dop5CUNHANDLED,
1006 	/* 0x13 */ dop5CUNHANDLED,
1007 	/* 0x14 */ dop5CUNHANDLED,
1008 	/* 0x15 */ dop5CUNHANDLED,
1009 	/* 0x16 */ dop5CUNHANDLED,
1010 	/* 0x17 */ dop5CUNHANDLED,
1011 	/* 0x18 */ dopADDFS,
1012 	/* 0x19 */ dopSUBFS,
1013 	/* 0x1A */ dopMULFS,
1014 	/* 0x1B */ dopDIVFS,
1015 	/* 0x1C */ dop5CUNHANDLED,
1016 	/* 0x1D */ dop5CUNHANDLED,
1017 	/* 0x1E */ dop5CUNHANDLED,
1018 	/* 0x1F */ dop5CUNHANDLED
1019 };
1020 
1021 static int (*const dasm_optable_5D[32])(unsigned ipc, unsigned pc, char *out) =
1022 {
1023 	/* 0x00 */ dopCMPBFS,
1024 	/* 0x01 */ dopCMPBFZ,
1025 	/* 0x02 */ dopCMPBFL,
1026 	/* 0x03 */ dop5DUNHANDLED,
1027 	/* 0x04 */ dop5DUNHANDLED,
1028 	/* 0x05 */ dop5DUNHANDLED,
1029 	/* 0x06 */ dop5DUNHANDLED,
1030 	/* 0x07 */ dop5DUNHANDLED,
1031 	/* 0x08 */ dopEXTBFS,
1032 	/* 0x09 */ dopEXTBFZ,
1033 	/* 0x0A */ dopEXTBFL,
1034 	/* 0x0B */ dop5DUNHANDLED,
1035 	/* 0x0C */ dop5DUNHANDLED,
1036 	/* 0x0D */ dop5DUNHANDLED,
1037 	/* 0x0E */ dop5DUNHANDLED,
1038 	/* 0x0F */ dop5DUNHANDLED,
1039 	/* 0x10 */ dop5DUNHANDLED,
1040 	/* 0x11 */ dop5DUNHANDLED,
1041 	/* 0x12 */ dop5DUNHANDLED,
1042 	/* 0x13 */ dop5DUNHANDLED,
1043 	/* 0x14 */ dop5DUNHANDLED,
1044 	/* 0x15 */ dop5DUNHANDLED,
1045 	/* 0x16 */ dop5DUNHANDLED,
1046 	/* 0x17 */ dop5DUNHANDLED,
1047 	/* 0x18 */ dopINSBFR,
1048 	/* 0x19 */ dopINSBFL,
1049 	/* 0x1A */ dop5DUNHANDLED,
1050 	/* 0x1B */ dop5DUNHANDLED,
1051 	/* 0x1C */ dop5DUNHANDLED,
1052 	/* 0x1D */ dop5DUNHANDLED,
1053 	/* 0x1E */ dop5DUNHANDLED,
1054 	/* 0x1F */ dop5DUNHANDLED
1055 };
1056 
1057 static int (*const dasm_optable_5E[32])(unsigned ipc, unsigned pc, char *out) =
1058 {
1059 	/* 0x00 */ dopCMPFL,
1060 	/* 0x01 */ dop5EUNHANDLED,
1061 	/* 0x02 */ dop5EUNHANDLED,
1062 	/* 0x03 */ dop5EUNHANDLED,
1063 	/* 0x04 */ dop5EUNHANDLED,
1064 	/* 0x05 */ dop5EUNHANDLED,
1065 	/* 0x06 */ dop5EUNHANDLED,
1066 	/* 0x07 */ dop5EUNHANDLED,
1067 	/* 0x08 */ dopMOVFL,
1068 	/* 0x09 */ dopNEGFL,
1069 	/* 0x0A */ dopABSFL,
1070 	/* 0x0B */ dop5EUNHANDLED,
1071 	/* 0x0C */ dop5EUNHANDLED,
1072 	/* 0x0D */ dop5EUNHANDLED,
1073 	/* 0x0E */ dop5EUNHANDLED,
1074 	/* 0x0F */ dop5EUNHANDLED,
1075 	/* 0x10 */ dopSCLFL,
1076 	/* 0x11 */ dop5EUNHANDLED,
1077 	/* 0x12 */ dop5EUNHANDLED,
1078 	/* 0x13 */ dop5EUNHANDLED,
1079 	/* 0x14 */ dop5EUNHANDLED,
1080 	/* 0x15 */ dop5EUNHANDLED,
1081 	/* 0x16 */ dop5EUNHANDLED,
1082 	/* 0x17 */ dop5EUNHANDLED,
1083 	/* 0x18 */ dopADDFL,
1084 	/* 0x19 */ dopSUBFL,
1085 	/* 0x1A */ dopMULFL,
1086 	/* 0x1B */ dopDIVFL,
1087 	/* 0x1C */ dop5EUNHANDLED,
1088 	/* 0x1D */ dop5EUNHANDLED,
1089 	/* 0x1E */ dop5EUNHANDLED,
1090 	/* 0x1F */ dop5EUNHANDLED
1091 };
1092 
1093 static int (*const dasm_optable_5F[32])(unsigned ipc, unsigned pc, char *out) =
1094 {
1095 	/* 0x00 */ dopCVTWS,
1096 	/* 0x01 */ dopCVTSW,
1097 	/* 0x02 */ dop5FUNHANDLED,
1098 	/* 0x03 */ dop5FUNHANDLED,
1099 	/* 0x04 */ dop5FUNHANDLED,
1100 	/* 0x05 */ dop5FUNHANDLED,
1101 	/* 0x06 */ dop5FUNHANDLED,
1102 	/* 0x07 */ dop5FUNHANDLED,
1103 	/* 0x08 */ dopCVTLS,
1104 	/* 0x09 */ dopCVTLW,
1105 	/* 0x0A */ dop5FUNHANDLED,
1106 	/* 0x0B */ dop5FUNHANDLED,
1107 	/* 0x0C */ dop5FUNHANDLED,
1108 	/* 0x0D */ dop5FUNHANDLED,
1109 	/* 0x0E */ dop5FUNHANDLED,
1110 	/* 0x0F */ dop5FUNHANDLED,
1111 	/* 0x10 */ dopCVTSL,
1112 	/* 0x11 */ dopCVTWL,
1113 	/* 0x12 */ dop5FUNHANDLED,
1114 	/* 0x13 */ dop5FUNHANDLED,
1115 	/* 0x14 */ dop5FUNHANDLED,
1116 	/* 0x15 */ dop5FUNHANDLED,
1117 	/* 0x16 */ dop5FUNHANDLED,
1118 	/* 0x17 */ dop5FUNHANDLED,
1119 	/* 0x18 */ dop5FUNHANDLED,
1120 	/* 0x19 */ dop5FUNHANDLED,
1121 	/* 0x1A */ dop5FUNHANDLED,
1122 	/* 0x1B */ dop5FUNHANDLED,
1123 	/* 0x1C */ dop5FUNHANDLED,
1124 	/* 0x1D */ dop5FUNHANDLED,
1125 	/* 0x1E */ dop5FUNHANDLED,
1126 	/* 0x1F */ dop5FUNHANDLED
1127 };
1128 
1129 static int (*const dasm_optable_C6[8])(unsigned ipc, unsigned pc, char *out) =
1130 {
1131 	/* 0x0 */ dopDBV,
1132 	/* 0x1 */ dopDBL,
1133 	/* 0x2 */ dopDBE,
1134 	/* 0x3 */ dopDBNH,
1135 	/* 0x4 */ dopDBN,
1136 	/* 0x5 */ dopDBR,
1137 	/* 0x6 */ dopDBLT,
1138 	/* 0x7 */ dopDBLE
1139 };
1140 
1141 static int (*const dasm_optable_C7[8])(unsigned ipc, unsigned pc, char *out) =
1142 {
1143 	/* 0x0 */ dopDBNV,
1144 	/* 0x1 */ dopDBNL,
1145 	/* 0x2 */ dopDBNE,
1146 	/* 0x3 */ dopDBH,
1147 	/* 0x4 */ dopDBP,
1148 	/* 0x5 */ dopTB,
1149 	/* 0x6 */ dopDBGE,
1150 	/* 0x7 */ dopDBGT
1151 };
1152 
dop58(unsigned ipc,unsigned pc,char * out)1153 static int dop58(unsigned ipc, unsigned pc, char *out)
1154 {
1155 	return dasm_optable_58[readop(pc) & 0x1f](ipc, pc, out);
1156 }
1157 
dop59(unsigned ipc,unsigned pc,char * out)1158 static int dop59(unsigned ipc, unsigned pc, char *out)
1159 {
1160 	return dasm_optable_59[readop(pc) & 0x1f](ipc, pc, out);
1161 }
1162 
dop5A(unsigned ipc,unsigned pc,char * out)1163 static int dop5A(unsigned ipc, unsigned pc, char *out)
1164 {
1165 	return dasm_optable_5A[readop(pc) & 0x1f](ipc, pc, out);
1166 }
1167 
dop5B(unsigned ipc,unsigned pc,char * out)1168 static int dop5B(unsigned ipc, unsigned pc, char *out)
1169 {
1170 	return dasm_optable_5B[readop(pc) & 0x1f](ipc, pc, out);
1171 }
1172 
dop5C(unsigned ipc,unsigned pc,char * out)1173 static int dop5C(unsigned ipc, unsigned pc, char *out)
1174 {
1175 	return dasm_optable_5C[readop(pc) & 0x1f](ipc, pc, out);
1176 }
1177 
dop5D(unsigned ipc,unsigned pc,char * out)1178 static int dop5D(unsigned ipc, unsigned pc, char *out)
1179 {
1180 	return dasm_optable_5D[readop(pc) & 0x1f](ipc, pc, out);
1181 }
1182 
dop5E(unsigned ipc,unsigned pc,char * out)1183 static int dop5E(unsigned ipc, unsigned pc, char *out)
1184 {
1185 	return dasm_optable_5E[readop(pc) & 0x1f](ipc, pc, out);
1186 }
1187 
dop5F(unsigned ipc,unsigned pc,char * out)1188 static int dop5F(unsigned ipc, unsigned pc, char *out)
1189 {
1190 	return dasm_optable_5F[readop(pc) & 0x1f](ipc, pc, out);
1191 }
1192 
dopC6(unsigned ipc,unsigned pc,char * out)1193 static int dopC6(unsigned ipc, unsigned pc, char *out)
1194 {
1195 	return dasm_optable_C6[readop(pc) >> 5](ipc, pc, out);
1196 }
1197 
dopC7(unsigned ipc,unsigned pc,char * out)1198 static int dopC7(unsigned ipc, unsigned pc, char *out)
1199 {
1200 	return dasm_optable_C7[readop(pc) >> 5](ipc, pc, out);
1201 }
1202 
1203 static int (*const dasm_optable[256])(unsigned ipc, unsigned pc, char *out) =
1204 {
1205 	/* 0x00 */ dopHALT,
1206 	/* 0x01 */ dopLDTASK,
1207 	/* 0x02 */ dopSTPR,
1208 	/* 0x03 */ dopGETRA,
1209 	/* 0x04 */ dopGETPTE,
1210 	/* 0x05 */ dopGETATE,
1211 	/* 0x06 */ dopUNHANDLED,
1212 	/* 0x07 */ dopUNHANDLED,
1213 	/* 0x08 */ dopRVBIT,
1214 	/* 0x09 */ dopMOVB,
1215 	/* 0x0A */ dopMOVSBH,
1216 	/* 0x0B */ dopMOVZBH,
1217 	/* 0x0C */ dopMOVSBW,
1218 	/* 0x0D */ dopMOVZBW,
1219 	/* 0x0E */ dopUNHANDLED,
1220 	/* 0x0F */ dopUNHANDLED,
1221 	/* 0x10 */ dopCLRTLBA,
1222 	/* 0x11 */ dopUNHANDLED,
1223 	/* 0x12 */ dopLDPR,
1224 	/* 0x13 */ dopUPDPSWW,
1225 	/* 0x14 */ dopUPDPTE,
1226 	/* 0x15 */ dopUPDATE,
1227 	/* 0x16 */ dopUNHANDLED,
1228 	/* 0x17 */ dopUNHANDLED,
1229 	/* 0x18 */ dopUNHANDLED,
1230 	/* 0x19 */ dopMOVTHB,
1231 	/* 0x1A */ dopUNHANDLED,
1232 	/* 0x1B */ dopMOVH,
1233 	/* 0x1C */ dopMOVSHW,
1234 	/* 0x1D */ dopMOVZHW,
1235 	/* 0x1E */ dopUNHANDLED,
1236 	/* 0x1F */ dopUNHANDLED,
1237 	/* 0x20 */ dopINB,
1238 	/* 0x21 */ dopOUTB,
1239 	/* 0x22 */ dopINH,
1240 	/* 0x23 */ dopOUTH,
1241 	/* 0x24 */ dopINW,
1242 	/* 0x25 */ dopOUTW,
1243 	/* 0x26 */ dopUNHANDLED,
1244 	/* 0x27 */ dopUNHANDLED,
1245 	/* 0x28 */ dopUNHANDLED,
1246 	/* 0x29 */ dopMOVTWB,
1247 	/* 0x2A */ dopUNHANDLED,
1248 	/* 0x2B */ dopMOVTWH,
1249 	/* 0x2C */ dopRVBYT,
1250 	/* 0x2D */ dopMOVW,
1251 	/* 0x2E */ dopUNHANDLED,
1252 	/* 0x2F */ dopUNHANDLED,
1253 	/* 0x30 */ dopUNHANDLED,
1254 	/* 0x31 */ dopUNHANDLED,
1255 	/* 0x32 */ dopUNHANDLED,
1256 	/* 0x33 */ dopUNHANDLED,
1257 	/* 0x34 */ dopUNHANDLED,
1258 	/* 0x35 */ dopUNHANDLED,
1259 	/* 0x36 */ dopUNHANDLED,
1260 	/* 0x37 */ dopUNHANDLED,
1261 	/* 0x38 */ dopNOTB,
1262 	/* 0x39 */ dopNEGB,
1263 	/* 0x3A */ dopNOTH,
1264 	/* 0x3B */ dopNEGH,
1265 	/* 0x3C */ dopNOTW,
1266 	/* 0x3D */ dopNEGW,
1267 	/* 0x3E */ dopUNHANDLED,
1268 	/* 0x3F */ dopMOVD,
1269 	/* 0x40 */ dopMOVEAB,
1270 	/* 0x41 */ dopXCHB,
1271 	/* 0x42 */ dopMOVEAH,
1272 	/* 0x43 */ dopXCHH,
1273 	/* 0x44 */ dopMOVEAW,
1274 	/* 0x45 */ dopXCHW,
1275 	/* 0x46 */ dopUNHANDLED,
1276 	/* 0x47 */ dopSETF,
1277 	/* 0x48 */ dopBSR,
1278 	/* 0x49 */ dopCALL,
1279 	/* 0x4A */ dopUPDPSWH,
1280 	/* 0x4B */ dopCHLVL,
1281 	/* 0x4C */ dopCAXI,
1282 	/* 0x4D */ dopCHKAR,
1283 	/* 0x4E */ dopCHKAW,
1284 	/* 0x4F */ dopCHKAE,
1285 	/* 0x50 */ dopREMB,
1286 	/* 0x51 */ dopREMUB,
1287 	/* 0x52 */ dopREMH,
1288 	/* 0x53 */ dopREMUH,
1289 	/* 0x54 */ dopREMW,
1290 	/* 0x55 */ dopREMUW,
1291 	/* 0x56 */ dopUNHANDLED,
1292 	/* 0x57 */ dopUNHANDLED,
1293 	/* 0x58 */ dop58,
1294 	/* 0x59 */ dop59,
1295 	/* 0x5A */ dop5A,
1296 	/* 0x5B */ dop5B,
1297 	/* 0x5C */ dop5C,
1298 	/* 0x5D */ dop5D,
1299 	/* 0x5E */ dop5E,
1300 	/* 0x5F */ dop5F,
1301 	/* 0x60 */ dopBV8,
1302 	/* 0x61 */ dopBNV8,
1303 	/* 0x62 */ dopBL8,
1304 	/* 0x63 */ dopBNL8,
1305 	/* 0x64 */ dopBE8,
1306 	/* 0x65 */ dopBNE8,
1307 	/* 0x66 */ dopBNH8,
1308 	/* 0x67 */ dopBH8,
1309 	/* 0x68 */ dopBN8,
1310 	/* 0x69 */ dopBP8,
1311 	/* 0x6A */ dopBR8,
1312 	/* 0x6B */ dopUNHANDLED,
1313 	/* 0x6C */ dopBLT8,
1314 	/* 0x6D */ dopBGE8,
1315 	/* 0x6E */ dopBLE8,
1316 	/* 0x6F */ dopBGT8,
1317 	/* 0x70 */ dopBV16,
1318 	/* 0x71 */ dopBNV16,
1319 	/* 0x72 */ dopBL16,
1320 	/* 0x73 */ dopBNL16,
1321 	/* 0x74 */ dopBE16,
1322 	/* 0x75 */ dopBNE16,
1323 	/* 0x76 */ dopBNH16,
1324 	/* 0x77 */ dopBH16,
1325 	/* 0x78 */ dopBN16,
1326 	/* 0x79 */ dopBP16,
1327 	/* 0x7A */ dopBR16,
1328 	/* 0x7B */ dopUNHANDLED,
1329 	/* 0x7C */ dopBLT16,
1330 	/* 0x7D */ dopBGE16,
1331 	/* 0x7E */ dopBLE16,
1332 	/* 0x7F */ dopBGT16,
1333 	/* 0x80 */ dopADDB,
1334 	/* 0x81 */ dopMULB,
1335 	/* 0x82 */ dopADDH,
1336 	/* 0x83 */ dopMULH,
1337 	/* 0x84 */ dopADDW,
1338 	/* 0x85 */ dopMULW,
1339 	/* 0x86 */ dopMULX,
1340 	/* 0x87 */ dopTEST1,
1341 	/* 0x88 */ dopORB,
1342 	/* 0x89 */ dopROTB,
1343 	/* 0x8A */ dopORH,
1344 	/* 0x8B */ dopROTH,
1345 	/* 0x8C */ dopORW,
1346 	/* 0x8D */ dopROTW,
1347 	/* 0x8E */ dopUNHANDLED,
1348 	/* 0x8F */ dopUNHANDLED,
1349 	/* 0x90 */ dopADDCB,
1350 	/* 0x91 */ dopMULUB,
1351 	/* 0x92 */ dopADDCH,
1352 	/* 0x93 */ dopMULUH,
1353 	/* 0x94 */ dopADDCW,
1354 	/* 0x95 */ dopMULUW,
1355 	/* 0x96 */ dopMULUX,
1356 	/* 0x97 */ dopSET1,
1357 	/* 0x98 */ dopSUBCB,
1358 	/* 0x99 */ dopROTCB,
1359 	/* 0x9A */ dopSUBCH,
1360 	/* 0x9B */ dopROTCH,
1361 	/* 0x9C */ dopSUBCW,
1362 	/* 0x9D */ dopROTCW,
1363 	/* 0x9E */ dopUNHANDLED,
1364 	/* 0x9F */ dopUNHANDLED,
1365 	/* 0xA0 */ dopANDB,
1366 	/* 0xA1 */ dopDIVB,
1367 	/* 0xA2 */ dopANDH,
1368 	/* 0xA3 */ dopDIVH,
1369 	/* 0xA4 */ dopANDW,
1370 	/* 0xA5 */ dopDIVW,
1371 	/* 0xA6 */ dopDIVX,
1372 	/* 0xA7 */ dopCLR1,
1373 	/* 0xA8 */ dopSUBB,
1374 	/* 0xA9 */ dopSHLB,
1375 	/* 0xAA */ dopSUBH,
1376 	/* 0xAB */ dopSHLH,
1377 	/* 0xAC */ dopSUBW,
1378 	/* 0xAD */ dopSHLW,
1379 	/* 0xAE */ dopUNHANDLED,
1380 	/* 0xAF */ dopUNHANDLED,
1381 	/* 0xB0 */ dopXORB,
1382 	/* 0xB1 */ dopDIVUB,
1383 	/* 0xB2 */ dopXORH,
1384 	/* 0xB3 */ dopDIVUH,
1385 	/* 0xB4 */ dopXORW,
1386 	/* 0xB5 */ dopDIVUW,
1387 	/* 0xB6 */ dopDIVUX,
1388 	/* 0xB7 */ dopNOT1,
1389 	/* 0xB8 */ dopCMPB,
1390 	/* 0xB9 */ dopSHAB,
1391 	/* 0xBA */ dopCMPH,
1392 	/* 0xBB */ dopSHAH,
1393 	/* 0xBC */ dopCMPW,
1394 	/* 0xBD */ dopSHAW,
1395 	/* 0xBE */ dopUNHANDLED,
1396 	/* 0xBF */ dopUNHANDLED,
1397 	/* 0xC0 */ dopUNHANDLED,
1398 	/* 0xC1 */ dopUNHANDLED,
1399 	/* 0xC2 */ dopUNHANDLED,
1400 	/* 0xC3 */ dopUNHANDLED,
1401 	/* 0xC4 */ dopUNHANDLED,
1402 	/* 0xC5 */ dopUNHANDLED,
1403 	/* 0xC6 */ dopC6,
1404 	/* 0xC7 */ dopC7,
1405 	/* 0xC8 */ dopBRK,
1406 	/* 0xC9 */ dopBRKV,
1407 	/* 0xCA */ dopRSR,
1408 	/* 0xCB */ dopTRAPFL,
1409 	/* 0xCC */ dopDISPOSE,
1410 	/* 0xCD */ dopNOP,
1411 	/* 0xCE */ dopUNHANDLED,
1412 	/* 0xCF */ dopUNHANDLED,
1413 	/* 0xD0 */ dopDECB,
1414 	/* 0xD1 */ dopDECB,
1415 	/* 0xD2 */ dopDECH,
1416 	/* 0xD3 */ dopDECH,
1417 	/* 0xD4 */ dopDECW,
1418 	/* 0xD5 */ dopDECW,
1419 	/* 0xD6 */ dopJMP,
1420 	/* 0xD7 */ dopJMP,
1421 	/* 0xD8 */ dopINCB,
1422 	/* 0xD9 */ dopINCB,
1423 	/* 0xDA */ dopINCH,
1424 	/* 0xDB */ dopINCH,
1425 	/* 0xDC */ dopINCW,
1426 	/* 0xDD */ dopINCW,
1427 	/* 0xDE */ dopPREPARE,
1428 	/* 0xDF */ dopPREPARE,
1429 	/* 0xE0 */ dopTASI,
1430 	/* 0xE1 */ dopTASI,
1431 	/* 0xE2 */ dopRET,
1432 	/* 0xE3 */ dopRET,
1433 	/* 0xE4 */ dopPOPM,
1434 	/* 0xE5 */ dopPOPM,
1435 	/* 0xE6 */ dopPOP,
1436 	/* 0xE7 */ dopPOP,
1437 	/* 0xE8 */ dopJSR,
1438 	/* 0xE9 */ dopJSR,
1439 	/* 0xEA */ dopRETIU,
1440 	/* 0xEB */ dopRETIU,
1441 	/* 0xEC */ dopPUSHM,
1442 	/* 0xED */ dopPUSHM,
1443 	/* 0xEE */ dopPUSH,
1444 	/* 0xEF */ dopPUSH,
1445 	/* 0xF0 */ dopTESTB,
1446 	/* 0xF1 */ dopTESTB,
1447 	/* 0xF2 */ dopTESTH,
1448 	/* 0xF3 */ dopTESTH,
1449 	/* 0xF4 */ dopTESTW,
1450 	/* 0xF5 */ dopTESTW,
1451 	/* 0xF6 */ dopGETPSW,
1452 	/* 0xF7 */ dopGETPSW,
1453 	/* 0xF8 */ dopTRAP,
1454 	/* 0xF9 */ dopTRAP,
1455 	/* 0xFA */ dopRETIS,
1456 	/* 0xFB */ dopRETIS,
1457 	/* 0xFC */ dopSTTASK,
1458 	/* 0xFD */ dopSTTASK,
1459 	/* 0xFE */ dopCLRTLB,
1460 	/* 0xFF */ dopCLRTLB
1461 };
1462 
1463 #ifdef MAME_DEBUG
v60_dasm(char * buffer,offs_t pc,const UINT8 * oprom,const UINT8 * opram)1464 offs_t v60_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
1465 {
1466 	rombase = oprom;
1467 	pcbase = pc;
1468 	return dasm_optable[oprom[0]](pc, pc+1, buffer) | DASMFLAG_SUPPORTED;
1469 }
1470 
v70_dasm(char * buffer,offs_t pc,const UINT8 * oprom,const UINT8 * opram)1471 offs_t v70_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
1472 {
1473 	rombase = oprom;
1474 	pcbase = pc;
1475 	return dasm_optable[oprom[0]](pc, pc+1, buffer) | DASMFLAG_SUPPORTED;
1476 }
1477 #endif
1478