1 | /* ======================================================================== */
|
---|
2 | /* ========================= LICENSING & COPYRIGHT ======================== */
|
---|
3 | /* ======================================================================== */
|
---|
4 | /*
|
---|
5 | * MUSASHI
|
---|
6 | * Version 3.4
|
---|
7 | *
|
---|
8 | * A portable Motorola M680x0 processor emulation engine.
|
---|
9 | * Copyright 1998-2001 Karl Stenerud. All rights reserved.
|
---|
10 | *
|
---|
11 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
12 | * of this software and associated documentation files (the "Software"), to deal
|
---|
13 | * in the Software without restriction, including without limitation the rights
|
---|
14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
15 | * copies of the Software, and to permit persons to whom the Software is
|
---|
16 | * furnished to do so, subject to the following conditions:
|
---|
17 | *
|
---|
18 | * The above copyright notice and this permission notice shall be included in
|
---|
19 | * all copies or substantial portions of the Software.
|
---|
20 |
|
---|
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
---|
26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
---|
27 | * THE SOFTWARE.
|
---|
28 | */
|
---|
29 |
|
---|
30 |
|
---|
31 |
|
---|
32 | /* ======================================================================== */
|
---|
33 | /* ================================ INCLUDES ============================== */
|
---|
34 | /* ======================================================================== */
|
---|
35 |
|
---|
36 | #include <stdlib.h>
|
---|
37 | #include <stdio.h>
|
---|
38 | #include <string.h>
|
---|
39 | #include "m68k.h"
|
---|
40 |
|
---|
41 | #ifndef DECL_SPEC
|
---|
42 | #define DECL_SPEC
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | /* ======================================================================== */
|
---|
46 | /* ============================ GENERAL DEFINES =========================== */
|
---|
47 | /* ======================================================================== */
|
---|
48 |
|
---|
49 | /* unsigned int and int must be at least 32 bits wide */
|
---|
50 | #undef uint
|
---|
51 | #define uint unsigned int
|
---|
52 |
|
---|
53 | /* Bit Isolation Functions */
|
---|
54 | #define BIT_0(A) ((A) & 0x00000001)
|
---|
55 | #define BIT_1(A) ((A) & 0x00000002)
|
---|
56 | #define BIT_2(A) ((A) & 0x00000004)
|
---|
57 | #define BIT_3(A) ((A) & 0x00000008)
|
---|
58 | #define BIT_4(A) ((A) & 0x00000010)
|
---|
59 | #define BIT_5(A) ((A) & 0x00000020)
|
---|
60 | #define BIT_6(A) ((A) & 0x00000040)
|
---|
61 | #define BIT_7(A) ((A) & 0x00000080)
|
---|
62 | #define BIT_8(A) ((A) & 0x00000100)
|
---|
63 | #define BIT_9(A) ((A) & 0x00000200)
|
---|
64 | #define BIT_A(A) ((A) & 0x00000400)
|
---|
65 | #define BIT_B(A) ((A) & 0x00000800)
|
---|
66 | #define BIT_C(A) ((A) & 0x00001000)
|
---|
67 | #define BIT_D(A) ((A) & 0x00002000)
|
---|
68 | #define BIT_E(A) ((A) & 0x00004000)
|
---|
69 | #define BIT_F(A) ((A) & 0x00008000)
|
---|
70 | #define BIT_10(A) ((A) & 0x00010000)
|
---|
71 | #define BIT_11(A) ((A) & 0x00020000)
|
---|
72 | #define BIT_12(A) ((A) & 0x00040000)
|
---|
73 | #define BIT_13(A) ((A) & 0x00080000)
|
---|
74 | #define BIT_14(A) ((A) & 0x00100000)
|
---|
75 | #define BIT_15(A) ((A) & 0x00200000)
|
---|
76 | #define BIT_16(A) ((A) & 0x00400000)
|
---|
77 | #define BIT_17(A) ((A) & 0x00800000)
|
---|
78 | #define BIT_18(A) ((A) & 0x01000000)
|
---|
79 | #define BIT_19(A) ((A) & 0x02000000)
|
---|
80 | #define BIT_1A(A) ((A) & 0x04000000)
|
---|
81 | #define BIT_1B(A) ((A) & 0x08000000)
|
---|
82 | #define BIT_1C(A) ((A) & 0x10000000)
|
---|
83 | #define BIT_1D(A) ((A) & 0x20000000)
|
---|
84 | #define BIT_1E(A) ((A) & 0x40000000)
|
---|
85 | #define BIT_1F(A) ((A) & 0x80000000)
|
---|
86 |
|
---|
87 | /* These are the CPU types understood by this disassembler */
|
---|
88 | #define TYPE_68000 1
|
---|
89 | #define TYPE_68010 2
|
---|
90 | #define TYPE_68020 4
|
---|
91 | #define TYPE_68030 8
|
---|
92 | #define TYPE_68040 16
|
---|
93 |
|
---|
94 | #define M68000_ONLY TYPE_68000
|
---|
95 |
|
---|
96 | #define M68010_ONLY TYPE_68010
|
---|
97 | #define M68010_LESS (TYPE_68000 | TYPE_68010)
|
---|
98 | #define M68010_PLUS (TYPE_68010 | TYPE_68020 | TYPE_68030 | TYPE_68040)
|
---|
99 |
|
---|
100 | #define M68020_ONLY TYPE_68020
|
---|
101 | #define M68020_LESS (TYPE_68010 | TYPE_68020)
|
---|
102 | #define M68020_PLUS (TYPE_68020 | TYPE_68030 | TYPE_68040)
|
---|
103 |
|
---|
104 | #define M68030_ONLY TYPE_68030
|
---|
105 | #define M68030_LESS (TYPE_68010 | TYPE_68020 | TYPE_68030)
|
---|
106 | #define M68030_PLUS (TYPE_68030 | TYPE_68040)
|
---|
107 |
|
---|
108 | #define M68040_PLUS TYPE_68040
|
---|
109 |
|
---|
110 |
|
---|
111 | /* Extension word formats */
|
---|
112 | #define EXT_8BIT_DISPLACEMENT(A) ((A)&0xff)
|
---|
113 | #define EXT_FULL(A) BIT_8(A)
|
---|
114 | #define EXT_EFFECTIVE_ZERO(A) (((A)&0xe4) == 0xc4 || ((A)&0xe2) == 0xc0)
|
---|
115 | #define EXT_BASE_REGISTER_PRESENT(A) (!BIT_7(A))
|
---|
116 | #define EXT_INDEX_REGISTER_PRESENT(A) (!BIT_6(A))
|
---|
117 | #define EXT_INDEX_REGISTER(A) (((A)>>12)&7)
|
---|
118 | #define EXT_INDEX_PRE_POST(A) (EXT_INDEX_PRESENT(A) && (A)&3)
|
---|
119 | #define EXT_INDEX_PRE(A) (EXT_INDEX_PRESENT(A) && ((A)&7) < 4 && ((A)&7) != 0)
|
---|
120 | #define EXT_INDEX_POST(A) (EXT_INDEX_PRESENT(A) && ((A)&7) > 4)
|
---|
121 | #define EXT_INDEX_SCALE(A) (((A)>>9)&3)
|
---|
122 | #define EXT_INDEX_LONG(A) BIT_B(A)
|
---|
123 | #define EXT_INDEX_AR(A) BIT_F(A)
|
---|
124 | #define EXT_BASE_DISPLACEMENT_PRESENT(A) (((A)&0x30) > 0x10)
|
---|
125 | #define EXT_BASE_DISPLACEMENT_WORD(A) (((A)&0x30) == 0x20)
|
---|
126 | #define EXT_BASE_DISPLACEMENT_LONG(A) (((A)&0x30) == 0x30)
|
---|
127 | #define EXT_OUTER_DISPLACEMENT_PRESENT(A) (((A)&3) > 1 && ((A)&0x47) < 0x44)
|
---|
128 | #define EXT_OUTER_DISPLACEMENT_WORD(A) (((A)&3) == 2 && ((A)&0x47) < 0x44)
|
---|
129 | #define EXT_OUTER_DISPLACEMENT_LONG(A) (((A)&3) == 3 && ((A)&0x47) < 0x44)
|
---|
130 |
|
---|
131 |
|
---|
132 |
|
---|
133 | /* ======================================================================== */
|
---|
134 | /* =============================== PROTOTYPES ============================= */
|
---|
135 | /* ======================================================================== */
|
---|
136 |
|
---|
137 | /* Read data at the PC and increment PC */
|
---|
138 | uint read_imm_8(void);
|
---|
139 | uint read_imm_16(void);
|
---|
140 | uint read_imm_32(void);
|
---|
141 |
|
---|
142 | /* Read data at the PC but don't imcrement the PC */
|
---|
143 | uint peek_imm_8(void);
|
---|
144 | uint peek_imm_16(void);
|
---|
145 | uint peek_imm_32(void);
|
---|
146 |
|
---|
147 | /* make signed integers 100% portably */
|
---|
148 | static int make_int_8(int value);
|
---|
149 | static int make_int_16(int value);
|
---|
150 |
|
---|
151 | /* make a string of a hex value */
|
---|
152 | static char* make_signed_hex_str_8(uint val);
|
---|
153 | static char* make_signed_hex_str_16(uint val);
|
---|
154 | static char* make_signed_hex_str_32(uint val);
|
---|
155 |
|
---|
156 | /* make string of ea mode */
|
---|
157 | static char* get_ea_mode_str(uint instruction, uint size);
|
---|
158 |
|
---|
159 | char* get_ea_mode_str_8(uint instruction);
|
---|
160 | char* get_ea_mode_str_16(uint instruction);
|
---|
161 | char* get_ea_mode_str_32(uint instruction);
|
---|
162 |
|
---|
163 | /* make string of immediate value */
|
---|
164 | static char* get_imm_str_s(uint size);
|
---|
165 | static char* get_imm_str_u(uint size);
|
---|
166 |
|
---|
167 | char* get_imm_str_s8(void);
|
---|
168 | char* get_imm_str_s16(void);
|
---|
169 | char* get_imm_str_s32(void);
|
---|
170 |
|
---|
171 | /* Stuff to build the opcode handler jump table */
|
---|
172 | static void build_opcode_table(void);
|
---|
173 | static int valid_ea(uint opcode, uint mask);
|
---|
174 | static int DECL_SPEC compare_nof_true_bits(const void *aptr, const void *bptr);
|
---|
175 |
|
---|
176 | /* used to build opcode handler jump table */
|
---|
177 | typedef struct
|
---|
178 | {
|
---|
179 | void (*opcode_handler)(void); /* handler function */
|
---|
180 | uint mask; /* mask on opcode */
|
---|
181 | uint match; /* what to match after masking */
|
---|
182 | uint ea_mask; /* what ea modes are allowed */
|
---|
183 | } opcode_struct;
|
---|
184 |
|
---|
185 |
|
---|
186 |
|
---|
187 | /* ======================================================================== */
|
---|
188 | /* ================================= DATA ================================= */
|
---|
189 | /* ======================================================================== */
|
---|
190 |
|
---|
191 | /* Opcode handler jump table */
|
---|
192 | static void (*g_instruction_table[0x10000])(void);
|
---|
193 | /* Flag if disassembler initialized */
|
---|
194 | static int g_initialized = 0;
|
---|
195 |
|
---|
196 | /* Address mask to simulate address lines */
|
---|
197 | static unsigned int g_address_mask = 0xffffffff;
|
---|
198 |
|
---|
199 | static char g_dasm_str[100]; /* string to hold disassembly */
|
---|
200 | static char g_helper_str[100]; /* string to hold helpful info */
|
---|
201 | static uint g_cpu_pc; /* program counter */
|
---|
202 | static uint g_cpu_ir; /* instruction register */
|
---|
203 | static uint g_cpu_type;
|
---|
204 |
|
---|
205 | /* used by ops like asr, ror, addq, etc */
|
---|
206 | static uint g_3bit_qdata_table[8] = {8, 1, 2, 3, 4, 5, 6, 7};
|
---|
207 |
|
---|
208 | static uint g_5bit_data_table[32] =
|
---|
209 | {
|
---|
210 | 32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
---|
211 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
|
---|
212 | };
|
---|
213 |
|
---|
214 | static char* g_cc[16] =
|
---|
215 | {"t", "f", "hi", "ls", "cc", "cs", "ne", "eq", "vc", "vs", "pl", "mi", "ge", "lt", "gt", "le"};
|
---|
216 |
|
---|
217 | static char* g_cpcc[64] =
|
---|
218 | {/* 000 001 010 011 100 101 110 111 */
|
---|
219 | "f", "eq", "ogt", "oge", "olt", "ole", "ogl", "or", /* 000 */
|
---|
220 | "un", "ueq", "ugt", "uge", "ult", "ule", "ne", "t", /* 001 */
|
---|
221 | "sf", "seq", "gt", "ge", "lt", "le", "gl" "gle", /* 010 */
|
---|
222 | "ngle", "ngl", "nle", "nlt", "nge", "ngt", "sne", "st", /* 011 */
|
---|
223 | "?", "?", "?", "?", "?", "?", "?", "?", /* 100 */
|
---|
224 | "?", "?", "?", "?", "?", "?", "?", "?", /* 101 */
|
---|
225 | "?", "?", "?", "?", "?", "?", "?", "?", /* 110 */
|
---|
226 | "?", "?", "?", "?", "?", "?", "?", "?" /* 111 */
|
---|
227 | };
|
---|
228 |
|
---|
229 |
|
---|
230 | /* ======================================================================== */
|
---|
231 | /* =========================== UTILITY FUNCTIONS ========================== */
|
---|
232 | /* ======================================================================== */
|
---|
233 |
|
---|
234 | #define LIMIT_CPU_TYPES(ALLOWED_CPU_TYPES) \
|
---|
235 | if(!(g_cpu_type & ALLOWED_CPU_TYPES)) \
|
---|
236 | { \
|
---|
237 | d68000_illegal(); \
|
---|
238 | return; \
|
---|
239 | }
|
---|
240 |
|
---|
241 | #define read_imm_8() (m68k_read_disassembler_16(((g_cpu_pc+=2)-2)&g_address_mask)&0xff)
|
---|
242 | #define read_imm_16() m68k_read_disassembler_16(((g_cpu_pc+=2)-2)&g_address_mask)
|
---|
243 | #define read_imm_32() m68k_read_disassembler_32(((g_cpu_pc+=4)-4)&g_address_mask)
|
---|
244 |
|
---|
245 | #define peek_imm_8() (m68k_read_disassembler_16(g_cpu_pc & g_address_mask)&0xff)
|
---|
246 | #define peek_imm_16() m68k_read_disassembler_16(g_cpu_pc & g_address_mask)
|
---|
247 | #define peek_imm_32() m68k_read_disassembler_32(g_cpu_pc & g_address_mask)
|
---|
248 |
|
---|
249 | /* Fake a split interface */
|
---|
250 | #define get_ea_mode_str_8(instruction) get_ea_mode_str(instruction, 0)
|
---|
251 | #define get_ea_mode_str_16(instruction) get_ea_mode_str(instruction, 1)
|
---|
252 | #define get_ea_mode_str_32(instruction) get_ea_mode_str(instruction, 2)
|
---|
253 |
|
---|
254 | #define get_imm_str_s8() get_imm_str_s(0)
|
---|
255 | #define get_imm_str_s16() get_imm_str_s(1)
|
---|
256 | #define get_imm_str_s32() get_imm_str_s(2)
|
---|
257 |
|
---|
258 | #define get_imm_str_u8() get_imm_str_u(0)
|
---|
259 | #define get_imm_str_u16() get_imm_str_u(1)
|
---|
260 | #define get_imm_str_u32() get_imm_str_u(2)
|
---|
261 |
|
---|
262 |
|
---|
263 | /* 100% portable signed int generators */
|
---|
264 | static int make_int_8(int value)
|
---|
265 | {
|
---|
266 | return (value & 0x80) ? value | ~0xff : value & 0xff;
|
---|
267 | }
|
---|
268 |
|
---|
269 | static int make_int_16(int value)
|
---|
270 | {
|
---|
271 | return (value & 0x8000) ? value | ~0xffff : value & 0xffff;
|
---|
272 | }
|
---|
273 |
|
---|
274 |
|
---|
275 | /* Get string representation of hex values */
|
---|
276 | static char* make_signed_hex_str_8(uint val)
|
---|
277 | {
|
---|
278 | static char str[20];
|
---|
279 |
|
---|
280 | val &= 0xff;
|
---|
281 |
|
---|
282 | if(val == 0x80)
|
---|
283 | sprintf(str, "-$80");
|
---|
284 | else if(val & 0x80)
|
---|
285 | sprintf(str, "-$%x", (0-val) & 0x7f);
|
---|
286 | else
|
---|
287 | sprintf(str, "$%x", val & 0x7f);
|
---|
288 |
|
---|
289 | return str;
|
---|
290 | }
|
---|
291 |
|
---|
292 | static char* make_signed_hex_str_16(uint val)
|
---|
293 | {
|
---|
294 | static char str[20];
|
---|
295 |
|
---|
296 | val &= 0xffff;
|
---|
297 |
|
---|
298 | if(val == 0x8000)
|
---|
299 | sprintf(str, "-$8000");
|
---|
300 | else if(val & 0x8000)
|
---|
301 | sprintf(str, "-$%x", (0-val) & 0x7fff);
|
---|
302 | else
|
---|
303 | sprintf(str, "$%x", val & 0x7fff);
|
---|
304 |
|
---|
305 | return str;
|
---|
306 | }
|
---|
307 |
|
---|
308 | static char* make_signed_hex_str_32(uint val)
|
---|
309 | {
|
---|
310 | static char str[20];
|
---|
311 |
|
---|
312 | val &= 0xffffffff;
|
---|
313 |
|
---|
314 | if(val == 0x80000000)
|
---|
315 | sprintf(str, "-$80000000");
|
---|
316 | else if(val & 0x80000000)
|
---|
317 | sprintf(str, "-$%x", (0-val) & 0x7fffffff);
|
---|
318 | else
|
---|
319 | sprintf(str, "$%x", val & 0x7fffffff);
|
---|
320 |
|
---|
321 | return str;
|
---|
322 | }
|
---|
323 |
|
---|
324 |
|
---|
325 | /* make string of immediate value */
|
---|
326 | static char* get_imm_str_s(uint size)
|
---|
327 | {
|
---|
328 | static char str[15];
|
---|
329 | if(size == 0)
|
---|
330 | sprintf(str, "#%s", make_signed_hex_str_8(read_imm_8()));
|
---|
331 | else if(size == 1)
|
---|
332 | sprintf(str, "#%s", make_signed_hex_str_16(read_imm_16()));
|
---|
333 | else
|
---|
334 | sprintf(str, "#%s", make_signed_hex_str_32(read_imm_32()));
|
---|
335 | return str;
|
---|
336 | }
|
---|
337 |
|
---|
338 | static char* get_imm_str_u(uint size)
|
---|
339 | {
|
---|
340 | static char str[15];
|
---|
341 | if(size == 0)
|
---|
342 | sprintf(str, "#$%x", read_imm_8() & 0xff);
|
---|
343 | else if(size == 1)
|
---|
344 | sprintf(str, "#$%x", read_imm_16() & 0xffff);
|
---|
345 | else
|
---|
346 | sprintf(str, "#$%x", read_imm_32() & 0xffffffff);
|
---|
347 | return str;
|
---|
348 | }
|
---|
349 |
|
---|
350 | /* Make string of effective address mode */
|
---|
351 | static char* get_ea_mode_str(uint instruction, uint size)
|
---|
352 | {
|
---|
353 | static char b1[64];
|
---|
354 | static char b2[64];
|
---|
355 | static char* mode = b2;
|
---|
356 | uint extension;
|
---|
357 | uint base;
|
---|
358 | uint outer;
|
---|
359 | char base_reg[4];
|
---|
360 | char index_reg[8];
|
---|
361 | uint preindex;
|
---|
362 | uint postindex;
|
---|
363 | uint comma = 0;
|
---|
364 | uint temp_value;
|
---|
365 |
|
---|
366 | /* Switch buffers so we don't clobber on a double-call to this function */
|
---|
367 | mode = mode == b1 ? b2 : b1;
|
---|
368 |
|
---|
369 | switch(instruction & 0x3f)
|
---|
370 | {
|
---|
371 | case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
|
---|
372 | /* data register direct */
|
---|
373 | sprintf(mode, "D%d", instruction&7);
|
---|
374 | break;
|
---|
375 | case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
|
---|
376 | /* address register direct */
|
---|
377 | sprintf(mode, "A%d", instruction&7);
|
---|
378 | break;
|
---|
379 | case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
|
---|
380 | /* address register indirect */
|
---|
381 | sprintf(mode, "(A%d)", instruction&7);
|
---|
382 | break;
|
---|
383 | case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
|
---|
384 | /* address register indirect with postincrement */
|
---|
385 | sprintf(mode, "(A%d)+", instruction&7);
|
---|
386 | break;
|
---|
387 | case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
|
---|
388 | /* address register indirect with predecrement */
|
---|
389 | sprintf(mode, "-(A%d)", instruction&7);
|
---|
390 | break;
|
---|
391 | case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
|
---|
392 | /* address register indirect with displacement*/
|
---|
393 | sprintf(mode, "(%s,A%d)", make_signed_hex_str_16(read_imm_16()), instruction&7);
|
---|
394 | break;
|
---|
395 | case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
|
---|
396 | /* address register indirect with index */
|
---|
397 | extension = read_imm_16();
|
---|
398 |
|
---|
399 | if(EXT_FULL(extension))
|
---|
400 | {
|
---|
401 | if(EXT_EFFECTIVE_ZERO(extension))
|
---|
402 | {
|
---|
403 | strcpy(mode, "0");
|
---|
404 | break;
|
---|
405 | }
|
---|
406 | base = EXT_BASE_DISPLACEMENT_PRESENT(extension) ? (EXT_BASE_DISPLACEMENT_LONG(extension) ? read_imm_32() : read_imm_16()) : 0;
|
---|
407 | outer = EXT_OUTER_DISPLACEMENT_PRESENT(extension) ? (EXT_OUTER_DISPLACEMENT_LONG(extension) ? read_imm_32() : read_imm_16()) : 0;
|
---|
408 | if(EXT_BASE_REGISTER_PRESENT(extension))
|
---|
409 | sprintf(base_reg, "A%d", instruction&7);
|
---|
410 | else
|
---|
411 | *base_reg = 0;
|
---|
412 | if(EXT_INDEX_REGISTER_PRESENT(extension))
|
---|
413 | {
|
---|
414 | sprintf(index_reg, "%c%d.%c", EXT_INDEX_AR(extension) ? 'A' : 'D', EXT_INDEX_REGISTER(extension), EXT_INDEX_LONG(extension) ? 'l' : 'w');
|
---|
415 | if(EXT_INDEX_SCALE(extension))
|
---|
416 | sprintf(index_reg+strlen(index_reg), "*%d", 1 << EXT_INDEX_SCALE(extension));
|
---|
417 | }
|
---|
418 | else
|
---|
419 | *index_reg = 0;
|
---|
420 | preindex = (extension&7) > 0 && (extension&7) < 4;
|
---|
421 | postindex = (extension&7) > 4;
|
---|
422 |
|
---|
423 | strcpy(mode, "(");
|
---|
424 | if(preindex || postindex)
|
---|
425 | strcat(mode, "[");
|
---|
426 | if(base)
|
---|
427 | {
|
---|
428 | strcat(mode, make_signed_hex_str_16(base));
|
---|
429 | comma = 1;
|
---|
430 | }
|
---|
431 | if(*base_reg)
|
---|
432 | {
|
---|
433 | if(comma)
|
---|
434 | strcat(mode, ",");
|
---|
435 | strcat(mode, base_reg);
|
---|
436 | comma = 1;
|
---|
437 | }
|
---|
438 | if(postindex)
|
---|
439 | {
|
---|
440 | strcat(mode, "]");
|
---|
441 | comma = 1;
|
---|
442 | }
|
---|
443 | if(*index_reg)
|
---|
444 | {
|
---|
445 | if(comma)
|
---|
446 | strcat(mode, ",");
|
---|
447 | strcat(mode, index_reg);
|
---|
448 | comma = 1;
|
---|
449 | }
|
---|
450 | if(preindex)
|
---|
451 | {
|
---|
452 | strcat(mode, "]");
|
---|
453 | comma = 1;
|
---|
454 | }
|
---|
455 | if(outer)
|
---|
456 | {
|
---|
457 | if(comma)
|
---|
458 | strcat(mode, ",");
|
---|
459 | strcat(mode, make_signed_hex_str_16(outer));
|
---|
460 | }
|
---|
461 | strcat(mode, ")");
|
---|
462 | break;
|
---|
463 | }
|
---|
464 |
|
---|
465 | if(EXT_8BIT_DISPLACEMENT(extension) == 0)
|
---|
466 | sprintf(mode, "(A%d,%c%d.%c", instruction&7, EXT_INDEX_AR(extension) ? 'A' : 'D', EXT_INDEX_REGISTER(extension), EXT_INDEX_LONG(extension) ? 'l' : 'w');
|
---|
467 | else
|
---|
468 | sprintf(mode, "(%s,A%d,%c%d.%c", make_signed_hex_str_8(extension), instruction&7, EXT_INDEX_AR(extension) ? 'A' : 'D', EXT_INDEX_REGISTER(extension), EXT_INDEX_LONG(extension) ? 'l' : 'w');
|
---|
469 | if(EXT_INDEX_SCALE(extension))
|
---|
470 | sprintf(mode+strlen(mode), "*%d", 1 << EXT_INDEX_SCALE(extension));
|
---|
471 | strcat(mode, ")");
|
---|
472 | break;
|
---|
473 | case 0x38:
|
---|
474 | /* absolute short address */
|
---|
475 | sprintf(mode, "$%x.w", read_imm_16());
|
---|
476 | break;
|
---|
477 | case 0x39:
|
---|
478 | /* absolute long address */
|
---|
479 | sprintf(mode, "$%x.l", read_imm_32());
|
---|
480 | break;
|
---|
481 | case 0x3a:
|
---|
482 | /* program counter with displacement */
|
---|
483 | temp_value = read_imm_16();
|
---|
484 | sprintf(mode, "(%s,PC)", make_signed_hex_str_16(temp_value));
|
---|
485 | sprintf(g_helper_str, "; ($%x)", (make_int_16(temp_value) + g_cpu_pc-2) & 0xffffffff);
|
---|
486 | break;
|
---|
487 | case 0x3b:
|
---|
488 | /* program counter with index */
|
---|
489 | extension = read_imm_16();
|
---|
490 |
|
---|
491 | if(EXT_FULL(extension))
|
---|
492 | {
|
---|
493 | if(EXT_EFFECTIVE_ZERO(extension))
|
---|
494 | {
|
---|
495 | strcpy(mode, "0");
|
---|
496 | break;
|
---|
497 | }
|
---|
498 | base = EXT_BASE_DISPLACEMENT_PRESENT(extension) ? (EXT_BASE_DISPLACEMENT_LONG(extension) ? read_imm_32() : read_imm_16()) : 0;
|
---|
499 | outer = EXT_OUTER_DISPLACEMENT_PRESENT(extension) ? (EXT_OUTER_DISPLACEMENT_LONG(extension) ? read_imm_32() : read_imm_16()) : 0;
|
---|
500 | if(EXT_BASE_REGISTER_PRESENT(extension))
|
---|
501 | strcpy(base_reg, "PC");
|
---|
502 | else
|
---|
503 | *base_reg = 0;
|
---|
504 | if(EXT_INDEX_REGISTER_PRESENT(extension))
|
---|
505 | {
|
---|
506 | sprintf(index_reg, "%c%d.%c", EXT_INDEX_AR(extension) ? 'A' : 'D', EXT_INDEX_REGISTER(extension), EXT_INDEX_LONG(extension) ? 'l' : 'w');
|
---|
507 | if(EXT_INDEX_SCALE(extension))
|
---|
508 | sprintf(index_reg+strlen(index_reg), "*%d", 1 << EXT_INDEX_SCALE(extension));
|
---|
509 | }
|
---|
510 | else
|
---|
511 | *index_reg = 0;
|
---|
512 | preindex = (extension&7) > 0 && (extension&7) < 4;
|
---|
513 | postindex = (extension&7) > 4;
|
---|
514 |
|
---|
515 | strcpy(mode, "(");
|
---|
516 | if(preindex || postindex)
|
---|
517 | strcat(mode, "[");
|
---|
518 | if(base)
|
---|
519 | {
|
---|
520 | strcat(mode, make_signed_hex_str_16(base));
|
---|
521 | comma = 1;
|
---|
522 | }
|
---|
523 | if(*base_reg)
|
---|
524 | {
|
---|
525 | if(comma)
|
---|
526 | strcat(mode, ",");
|
---|
527 | strcat(mode, base_reg);
|
---|
528 | comma = 1;
|
---|
529 | }
|
---|
530 | if(postindex)
|
---|
531 | {
|
---|
532 | strcat(mode, "]");
|
---|
533 | comma = 1;
|
---|
534 | }
|
---|
535 | if(*index_reg)
|
---|
536 | {
|
---|
537 | if(comma)
|
---|
538 | strcat(mode, ",");
|
---|
539 | strcat(mode, index_reg);
|
---|
540 | comma = 1;
|
---|
541 | }
|
---|
542 | if(preindex)
|
---|
543 | {
|
---|
544 | strcat(mode, "]");
|
---|
545 | comma = 1;
|
---|
546 | }
|
---|
547 | if(outer)
|
---|
548 | {
|
---|
549 | if(comma)
|
---|
550 | strcat(mode, ",");
|
---|
551 | strcat(mode, make_signed_hex_str_16(outer));
|
---|
552 | }
|
---|
553 | strcat(mode, ")");
|
---|
554 | break;
|
---|
555 | }
|
---|
556 |
|
---|
557 | if(EXT_8BIT_DISPLACEMENT(extension) == 0)
|
---|
558 | sprintf(mode, "(PC,%c%d.%c", EXT_INDEX_AR(extension) ? 'A' : 'D', EXT_INDEX_REGISTER(extension), EXT_INDEX_LONG(extension) ? 'l' : 'w');
|
---|
559 | else
|
---|
560 | sprintf(mode, "(%s,PC,%c%d.%c", make_signed_hex_str_8(extension), EXT_INDEX_AR(extension) ? 'A' : 'D', EXT_INDEX_REGISTER(extension), EXT_INDEX_LONG(extension) ? 'l' : 'w');
|
---|
561 | if(EXT_INDEX_SCALE(extension))
|
---|
562 | sprintf(mode+strlen(mode), "*%d", 1 << EXT_INDEX_SCALE(extension));
|
---|
563 | strcat(mode, ")");
|
---|
564 | break;
|
---|
565 | case 0x3c:
|
---|
566 | /* Immediate */
|
---|
567 | sprintf(mode, "%s", get_imm_str_u(size));
|
---|
568 | break;
|
---|
569 | default:
|
---|
570 | sprintf(mode, "INVALID %x", instruction & 0x3f);
|
---|
571 | }
|
---|
572 | return mode;
|
---|
573 | }
|
---|
574 |
|
---|
575 |
|
---|
576 |
|
---|
577 | /* ======================================================================== */
|
---|
578 | /* ========================= INSTRUCTION HANDLERS ========================= */
|
---|
579 | /* ======================================================================== */
|
---|
580 | /* Instruction handler function names follow this convention:
|
---|
581 | *
|
---|
582 | * d68000_NAME_EXTENSIONS(void)
|
---|
583 | * where NAME is the name of the opcode it handles and EXTENSIONS are any
|
---|
584 | * extensions for special instances of that opcode.
|
---|
585 | *
|
---|
586 | * Examples:
|
---|
587 | * d68000_add_er_8(): add opcode, from effective address to register,
|
---|
588 | * size = byte
|
---|
589 | *
|
---|
590 | * d68000_asr_s_8(): arithmetic shift right, static count, size = byte
|
---|
591 | *
|
---|
592 | *
|
---|
593 | * Common extensions:
|
---|
594 | * 8 : size = byte
|
---|
595 | * 16 : size = word
|
---|
596 | * 32 : size = long
|
---|
597 | * rr : register to register
|
---|
598 | * mm : memory to memory
|
---|
599 | * r : register
|
---|
600 | * s : static
|
---|
601 | * er : effective address -> register
|
---|
602 | * re : register -> effective address
|
---|
603 | * ea : using effective address mode of operation
|
---|
604 | * d : data register direct
|
---|
605 | * a : address register direct
|
---|
606 | * ai : address register indirect
|
---|
607 | * pi : address register indirect with postincrement
|
---|
608 | * pd : address register indirect with predecrement
|
---|
609 | * di : address register indirect with displacement
|
---|
610 | * ix : address register indirect with index
|
---|
611 | * aw : absolute word
|
---|
612 | * al : absolute long
|
---|
613 | */
|
---|
614 |
|
---|
615 | static void d68000_illegal(void)
|
---|
616 | {
|
---|
617 | sprintf(g_dasm_str, "dc.w $%04x; ILLEGAL", g_cpu_ir);
|
---|
618 | }
|
---|
619 |
|
---|
620 | static void d68000_1010(void)
|
---|
621 | {
|
---|
622 | sprintf(g_dasm_str, "dc.w $%04x; opcode 1010", g_cpu_ir);
|
---|
623 | }
|
---|
624 |
|
---|
625 |
|
---|
626 | static void d68000_1111(void)
|
---|
627 | {
|
---|
628 | sprintf(g_dasm_str, "dc.w $%04x; opcode 1111", g_cpu_ir);
|
---|
629 | }
|
---|
630 |
|
---|
631 |
|
---|
632 | static void d68000_abcd_rr(void)
|
---|
633 | {
|
---|
634 | sprintf(g_dasm_str, "abcd D%d, D%d", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
635 | }
|
---|
636 |
|
---|
637 |
|
---|
638 | static void d68000_abcd_mm(void)
|
---|
639 | {
|
---|
640 | sprintf(g_dasm_str, "abcd -(A%d), -(A%d)", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
641 | }
|
---|
642 |
|
---|
643 | static void d68000_add_er_8(void)
|
---|
644 | {
|
---|
645 | sprintf(g_dasm_str, "add.b %s, D%d", get_ea_mode_str_8(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
646 | }
|
---|
647 |
|
---|
648 |
|
---|
649 | static void d68000_add_er_16(void)
|
---|
650 | {
|
---|
651 | sprintf(g_dasm_str, "add.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
652 | }
|
---|
653 |
|
---|
654 | static void d68000_add_er_32(void)
|
---|
655 | {
|
---|
656 | sprintf(g_dasm_str, "add.l %s, D%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
657 | }
|
---|
658 |
|
---|
659 | static void d68000_add_re_8(void)
|
---|
660 | {
|
---|
661 | sprintf(g_dasm_str, "add.b D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
662 | }
|
---|
663 |
|
---|
664 | static void d68000_add_re_16(void)
|
---|
665 | {
|
---|
666 | sprintf(g_dasm_str, "add.w D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_16(g_cpu_ir));
|
---|
667 | }
|
---|
668 |
|
---|
669 | static void d68000_add_re_32(void)
|
---|
670 | {
|
---|
671 | sprintf(g_dasm_str, "add.l D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_32(g_cpu_ir));
|
---|
672 | }
|
---|
673 |
|
---|
674 | static void d68000_adda_16(void)
|
---|
675 | {
|
---|
676 | sprintf(g_dasm_str, "adda.w %s, A%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
677 | }
|
---|
678 |
|
---|
679 | static void d68000_adda_32(void)
|
---|
680 | {
|
---|
681 | sprintf(g_dasm_str, "adda.l %s, A%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
682 | }
|
---|
683 |
|
---|
684 | static void d68000_addi_8(void)
|
---|
685 | {
|
---|
686 | char* str = get_imm_str_s8();
|
---|
687 | sprintf(g_dasm_str, "addi.b %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
688 | }
|
---|
689 |
|
---|
690 | static void d68000_addi_16(void)
|
---|
691 | {
|
---|
692 | char* str = get_imm_str_s16();
|
---|
693 | sprintf(g_dasm_str, "addi.w %s, %s", str, get_ea_mode_str_16(g_cpu_ir));
|
---|
694 | }
|
---|
695 |
|
---|
696 | static void d68000_addi_32(void)
|
---|
697 | {
|
---|
698 | char* str = get_imm_str_s32();
|
---|
699 | sprintf(g_dasm_str, "addi.l %s, %s", str, get_ea_mode_str_32(g_cpu_ir));
|
---|
700 | }
|
---|
701 |
|
---|
702 | static void d68000_addq_8(void)
|
---|
703 | {
|
---|
704 | sprintf(g_dasm_str, "addq.b #%d, %s", g_3bit_qdata_table[(g_cpu_ir>>9)&7], get_ea_mode_str_8(g_cpu_ir));
|
---|
705 | }
|
---|
706 |
|
---|
707 | static void d68000_addq_16(void)
|
---|
708 | {
|
---|
709 | sprintf(g_dasm_str, "addq.w #%d, %s", g_3bit_qdata_table[(g_cpu_ir>>9)&7], get_ea_mode_str_16(g_cpu_ir));
|
---|
710 | }
|
---|
711 |
|
---|
712 | static void d68000_addq_32(void)
|
---|
713 | {
|
---|
714 | sprintf(g_dasm_str, "addq.l #%d, %s", g_3bit_qdata_table[(g_cpu_ir>>9)&7], get_ea_mode_str_32(g_cpu_ir));
|
---|
715 | }
|
---|
716 |
|
---|
717 | static void d68000_addx_rr_8(void)
|
---|
718 | {
|
---|
719 | sprintf(g_dasm_str, "addx.b D%d, D%d", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
720 | }
|
---|
721 |
|
---|
722 | static void d68000_addx_rr_16(void)
|
---|
723 | {
|
---|
724 | sprintf(g_dasm_str, "addx.w D%d, D%d", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
725 | }
|
---|
726 |
|
---|
727 | static void d68000_addx_rr_32(void)
|
---|
728 | {
|
---|
729 | sprintf(g_dasm_str, "addx.l D%d, D%d", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
730 | }
|
---|
731 |
|
---|
732 | static void d68000_addx_mm_8(void)
|
---|
733 | {
|
---|
734 | sprintf(g_dasm_str, "addx.b -(A%d), -(A%d)", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
735 | }
|
---|
736 |
|
---|
737 | static void d68000_addx_mm_16(void)
|
---|
738 | {
|
---|
739 | sprintf(g_dasm_str, "addx.w -(A%d), -(A%d)", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
740 | }
|
---|
741 |
|
---|
742 | static void d68000_addx_mm_32(void)
|
---|
743 | {
|
---|
744 | sprintf(g_dasm_str, "addx.l -(A%d), -(A%d)", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
745 | }
|
---|
746 |
|
---|
747 | static void d68000_and_er_8(void)
|
---|
748 | {
|
---|
749 | sprintf(g_dasm_str, "and.b %s, D%d", get_ea_mode_str_8(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
750 | }
|
---|
751 |
|
---|
752 | static void d68000_and_er_16(void)
|
---|
753 | {
|
---|
754 | sprintf(g_dasm_str, "and.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
755 | }
|
---|
756 |
|
---|
757 | static void d68000_and_er_32(void)
|
---|
758 | {
|
---|
759 | sprintf(g_dasm_str, "and.l %s, D%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
760 | }
|
---|
761 |
|
---|
762 | static void d68000_and_re_8(void)
|
---|
763 | {
|
---|
764 | sprintf(g_dasm_str, "and.b D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
765 | }
|
---|
766 |
|
---|
767 | static void d68000_and_re_16(void)
|
---|
768 | {
|
---|
769 | sprintf(g_dasm_str, "and.w D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_16(g_cpu_ir));
|
---|
770 | }
|
---|
771 |
|
---|
772 | static void d68000_and_re_32(void)
|
---|
773 | {
|
---|
774 | sprintf(g_dasm_str, "and.l D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_32(g_cpu_ir));
|
---|
775 | }
|
---|
776 |
|
---|
777 | static void d68000_andi_8(void)
|
---|
778 | {
|
---|
779 | char* str = get_imm_str_u8();
|
---|
780 | sprintf(g_dasm_str, "andi.b %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
781 | }
|
---|
782 |
|
---|
783 | static void d68000_andi_16(void)
|
---|
784 | {
|
---|
785 | char* str = get_imm_str_u16();
|
---|
786 | sprintf(g_dasm_str, "andi.w %s, %s", str, get_ea_mode_str_16(g_cpu_ir));
|
---|
787 | }
|
---|
788 |
|
---|
789 | static void d68000_andi_32(void)
|
---|
790 | {
|
---|
791 | char* str = get_imm_str_u32();
|
---|
792 | sprintf(g_dasm_str, "andi.l %s, %s", str, get_ea_mode_str_32(g_cpu_ir));
|
---|
793 | }
|
---|
794 |
|
---|
795 | static void d68000_andi_to_ccr(void)
|
---|
796 | {
|
---|
797 | sprintf(g_dasm_str, "andi %s, CCR", get_imm_str_u8());
|
---|
798 | }
|
---|
799 |
|
---|
800 | static void d68000_andi_to_sr(void)
|
---|
801 | {
|
---|
802 | sprintf(g_dasm_str, "andi %s, SR", get_imm_str_u16());
|
---|
803 | }
|
---|
804 |
|
---|
805 | static void d68000_asr_s_8(void)
|
---|
806 | {
|
---|
807 | sprintf(g_dasm_str, "asr.b #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
808 | }
|
---|
809 |
|
---|
810 | static void d68000_asr_s_16(void)
|
---|
811 | {
|
---|
812 | sprintf(g_dasm_str, "asr.w #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
813 | }
|
---|
814 |
|
---|
815 | static void d68000_asr_s_32(void)
|
---|
816 | {
|
---|
817 | sprintf(g_dasm_str, "asr.l #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
818 | }
|
---|
819 |
|
---|
820 | static void d68000_asr_r_8(void)
|
---|
821 | {
|
---|
822 | sprintf(g_dasm_str, "asr.b D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
823 | }
|
---|
824 |
|
---|
825 | static void d68000_asr_r_16(void)
|
---|
826 | {
|
---|
827 | sprintf(g_dasm_str, "asr.w D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
828 | }
|
---|
829 |
|
---|
830 | static void d68000_asr_r_32(void)
|
---|
831 | {
|
---|
832 | sprintf(g_dasm_str, "asr.l D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
833 | }
|
---|
834 |
|
---|
835 | static void d68000_asr_ea(void)
|
---|
836 | {
|
---|
837 | sprintf(g_dasm_str, "asr.w %s", get_ea_mode_str_16(g_cpu_ir));
|
---|
838 | }
|
---|
839 |
|
---|
840 | static void d68000_asl_s_8(void)
|
---|
841 | {
|
---|
842 | sprintf(g_dasm_str, "asl.b #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
843 | }
|
---|
844 |
|
---|
845 | static void d68000_asl_s_16(void)
|
---|
846 | {
|
---|
847 | sprintf(g_dasm_str, "asl.w #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
848 | }
|
---|
849 |
|
---|
850 | static void d68000_asl_s_32(void)
|
---|
851 | {
|
---|
852 | sprintf(g_dasm_str, "asl.l #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
853 | }
|
---|
854 |
|
---|
855 | static void d68000_asl_r_8(void)
|
---|
856 | {
|
---|
857 | sprintf(g_dasm_str, "asl.b D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
858 | }
|
---|
859 |
|
---|
860 | static void d68000_asl_r_16(void)
|
---|
861 | {
|
---|
862 | sprintf(g_dasm_str, "asl.w D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
863 | }
|
---|
864 |
|
---|
865 | static void d68000_asl_r_32(void)
|
---|
866 | {
|
---|
867 | sprintf(g_dasm_str, "asl.l D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
868 | }
|
---|
869 |
|
---|
870 | static void d68000_asl_ea(void)
|
---|
871 | {
|
---|
872 | sprintf(g_dasm_str, "asl.w %s", get_ea_mode_str_16(g_cpu_ir));
|
---|
873 | }
|
---|
874 |
|
---|
875 | static void d68000_bcc_8(void)
|
---|
876 | {
|
---|
877 | uint temp_pc = g_cpu_pc;
|
---|
878 | sprintf(g_dasm_str, "b%-2s %x", g_cc[(g_cpu_ir>>8)&0xf], temp_pc + make_int_8(g_cpu_ir));
|
---|
879 | }
|
---|
880 |
|
---|
881 | static void d68000_bcc_16(void)
|
---|
882 | {
|
---|
883 | uint temp_pc = g_cpu_pc;
|
---|
884 | sprintf(g_dasm_str, "b%-2s %x", g_cc[(g_cpu_ir>>8)&0xf], temp_pc + make_int_16(read_imm_16()));
|
---|
885 | }
|
---|
886 |
|
---|
887 | static void d68020_bcc_32(void)
|
---|
888 | {
|
---|
889 | uint temp_pc = g_cpu_pc;
|
---|
890 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
891 | sprintf(g_dasm_str, "b%-2s %x; (2+)", g_cc[(g_cpu_ir>>8)&0xf], temp_pc + read_imm_32());
|
---|
892 | }
|
---|
893 |
|
---|
894 | static void d68000_bchg_r(void)
|
---|
895 | {
|
---|
896 | sprintf(g_dasm_str, "bchg D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
897 | }
|
---|
898 |
|
---|
899 | static void d68000_bchg_s(void)
|
---|
900 | {
|
---|
901 | char* str = get_imm_str_u8();
|
---|
902 | sprintf(g_dasm_str, "bchg %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
903 | }
|
---|
904 |
|
---|
905 | static void d68000_bclr_r(void)
|
---|
906 | {
|
---|
907 | sprintf(g_dasm_str, "bclr D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
908 | }
|
---|
909 |
|
---|
910 | static void d68000_bclr_s(void)
|
---|
911 | {
|
---|
912 | char* str = get_imm_str_u8();
|
---|
913 | sprintf(g_dasm_str, "bclr %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
914 | }
|
---|
915 |
|
---|
916 | static void d68010_bkpt(void)
|
---|
917 | {
|
---|
918 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
919 | sprintf(g_dasm_str, "bkpt #%d; (1+)", g_cpu_ir&7);
|
---|
920 | }
|
---|
921 |
|
---|
922 | static void d68020_bfchg(void)
|
---|
923 | {
|
---|
924 | uint extension;
|
---|
925 | char offset[3];
|
---|
926 | char width[3];
|
---|
927 |
|
---|
928 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
929 |
|
---|
930 | extension = read_imm_16();
|
---|
931 |
|
---|
932 | if(BIT_B(extension))
|
---|
933 | sprintf(offset, "D%d", (extension>>6)&7);
|
---|
934 | else
|
---|
935 | sprintf(offset, "%d", (extension>>6)&31);
|
---|
936 | if(BIT_5(extension))
|
---|
937 | sprintf(width, "D%d", extension&7);
|
---|
938 | else
|
---|
939 | sprintf(width, "%d", g_5bit_data_table[extension&31]);
|
---|
940 | sprintf(g_dasm_str, "bfchg %s {%s:%s}; (2+)", get_ea_mode_str_8(g_cpu_ir), offset, width);
|
---|
941 | }
|
---|
942 |
|
---|
943 | static void d68020_bfclr(void)
|
---|
944 | {
|
---|
945 | uint extension;
|
---|
946 | char offset[3];
|
---|
947 | char width[3];
|
---|
948 |
|
---|
949 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
950 |
|
---|
951 | extension = read_imm_16();
|
---|
952 |
|
---|
953 | if(BIT_B(extension))
|
---|
954 | sprintf(offset, "D%d", (extension>>6)&7);
|
---|
955 | else
|
---|
956 | sprintf(offset, "%d", (extension>>6)&31);
|
---|
957 | if(BIT_5(extension))
|
---|
958 | sprintf(width, "D%d", extension&7);
|
---|
959 | else
|
---|
960 | sprintf(width, "%d", g_5bit_data_table[extension&31]);
|
---|
961 | sprintf(g_dasm_str, "bfclr %s {%s:%s}; (2+)", get_ea_mode_str_8(g_cpu_ir), offset, width);
|
---|
962 | }
|
---|
963 |
|
---|
964 | static void d68020_bfexts(void)
|
---|
965 | {
|
---|
966 | uint extension;
|
---|
967 | char offset[3];
|
---|
968 | char width[3];
|
---|
969 |
|
---|
970 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
971 |
|
---|
972 | extension = read_imm_16();
|
---|
973 |
|
---|
974 | if(BIT_B(extension))
|
---|
975 | sprintf(offset, "D%d", (extension>>6)&7);
|
---|
976 | else
|
---|
977 | sprintf(offset, "%d", (extension>>6)&31);
|
---|
978 | if(BIT_5(extension))
|
---|
979 | sprintf(width, "D%d", extension&7);
|
---|
980 | else
|
---|
981 | sprintf(width, "%d", g_5bit_data_table[extension&31]);
|
---|
982 | sprintf(g_dasm_str, "bfexts %s {%s:%s}, D%d; (2+)", get_ea_mode_str_8(g_cpu_ir), offset, width, (extension>>12)&7);
|
---|
983 | }
|
---|
984 |
|
---|
985 | static void d68020_bfextu(void)
|
---|
986 | {
|
---|
987 | uint extension;
|
---|
988 | char offset[3];
|
---|
989 | char width[3];
|
---|
990 |
|
---|
991 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
992 |
|
---|
993 | extension = read_imm_16();
|
---|
994 |
|
---|
995 | if(BIT_B(extension))
|
---|
996 | sprintf(offset, "D%d", (extension>>6)&7);
|
---|
997 | else
|
---|
998 | sprintf(offset, "%d", (extension>>6)&31);
|
---|
999 | if(BIT_5(extension))
|
---|
1000 | sprintf(width, "D%d", extension&7);
|
---|
1001 | else
|
---|
1002 | sprintf(width, "%d", g_5bit_data_table[extension&31]);
|
---|
1003 | sprintf(g_dasm_str, "bfextu %s {%s:%s}, D%d; (2+)", get_ea_mode_str_8(g_cpu_ir), offset, width, (extension>>12)&7);
|
---|
1004 | }
|
---|
1005 |
|
---|
1006 | static void d68020_bfffo(void)
|
---|
1007 | {
|
---|
1008 | uint extension;
|
---|
1009 | char offset[3];
|
---|
1010 | char width[3];
|
---|
1011 |
|
---|
1012 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1013 |
|
---|
1014 | extension = read_imm_16();
|
---|
1015 |
|
---|
1016 | if(BIT_B(extension))
|
---|
1017 | sprintf(offset, "D%d", (extension>>6)&7);
|
---|
1018 | else
|
---|
1019 | sprintf(offset, "%d", (extension>>6)&31);
|
---|
1020 | if(BIT_5(extension))
|
---|
1021 | sprintf(width, "D%d", extension&7);
|
---|
1022 | else
|
---|
1023 | sprintf(width, "%d", g_5bit_data_table[extension&31]);
|
---|
1024 | sprintf(g_dasm_str, "bfffo %s {%s:%s}, D%d; (2+)", get_ea_mode_str_8(g_cpu_ir), offset, width, (extension>>12)&7);
|
---|
1025 | }
|
---|
1026 |
|
---|
1027 | static void d68020_bfins(void)
|
---|
1028 | {
|
---|
1029 | uint extension;
|
---|
1030 | char offset[3];
|
---|
1031 | char width[3];
|
---|
1032 |
|
---|
1033 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1034 |
|
---|
1035 | extension = read_imm_16();
|
---|
1036 |
|
---|
1037 | if(BIT_B(extension))
|
---|
1038 | sprintf(offset, "D%d", (extension>>6)&7);
|
---|
1039 | else
|
---|
1040 | sprintf(offset, "%d", (extension>>6)&31);
|
---|
1041 | if(BIT_5(extension))
|
---|
1042 | sprintf(width, "D%d", extension&7);
|
---|
1043 | else
|
---|
1044 | sprintf(width, "%d", g_5bit_data_table[extension&31]);
|
---|
1045 | sprintf(g_dasm_str, "bfins D%d, %s {%s:%s}; (2+)", (extension>>12)&7, get_ea_mode_str_8(g_cpu_ir), offset, width);
|
---|
1046 | }
|
---|
1047 |
|
---|
1048 | static void d68020_bfset(void)
|
---|
1049 | {
|
---|
1050 | uint extension;
|
---|
1051 | char offset[3];
|
---|
1052 | char width[3];
|
---|
1053 |
|
---|
1054 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1055 |
|
---|
1056 | extension = read_imm_16();
|
---|
1057 |
|
---|
1058 | if(BIT_B(extension))
|
---|
1059 | sprintf(offset, "D%d", (extension>>6)&7);
|
---|
1060 | else
|
---|
1061 | sprintf(offset, "%d", (extension>>6)&31);
|
---|
1062 | if(BIT_5(extension))
|
---|
1063 | sprintf(width, "D%d", extension&7);
|
---|
1064 | else
|
---|
1065 | sprintf(width, "%d", g_5bit_data_table[extension&31]);
|
---|
1066 | sprintf(g_dasm_str, "bfset %s {%s:%s}; (2+)", get_ea_mode_str_8(g_cpu_ir), offset, width);
|
---|
1067 | }
|
---|
1068 |
|
---|
1069 | static void d68020_bftst(void)
|
---|
1070 | {
|
---|
1071 | uint extension;
|
---|
1072 | char offset[3];
|
---|
1073 | char width[3];
|
---|
1074 |
|
---|
1075 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1076 |
|
---|
1077 | extension = read_imm_16();
|
---|
1078 |
|
---|
1079 | if(BIT_B(extension))
|
---|
1080 | sprintf(offset, "D%d", (extension>>6)&7);
|
---|
1081 | else
|
---|
1082 | sprintf(offset, "%d", (extension>>6)&31);
|
---|
1083 | if(BIT_5(extension))
|
---|
1084 | sprintf(width, "D%d", extension&7);
|
---|
1085 | else
|
---|
1086 | sprintf(width, "%d", g_5bit_data_table[extension&31]);
|
---|
1087 | sprintf(g_dasm_str, "bftst %s {%s:%s}; (2+)", get_ea_mode_str_8(g_cpu_ir), offset, width);
|
---|
1088 | }
|
---|
1089 |
|
---|
1090 | static void d68000_bra_8(void)
|
---|
1091 | {
|
---|
1092 | uint temp_pc = g_cpu_pc;
|
---|
1093 | sprintf(g_dasm_str, "bra %x", temp_pc + make_int_8(g_cpu_ir));
|
---|
1094 | }
|
---|
1095 |
|
---|
1096 | static void d68000_bra_16(void)
|
---|
1097 | {
|
---|
1098 | uint temp_pc = g_cpu_pc;
|
---|
1099 | sprintf(g_dasm_str, "bra %x", temp_pc + make_int_16(read_imm_16()));
|
---|
1100 | }
|
---|
1101 |
|
---|
1102 | static void d68020_bra_32(void)
|
---|
1103 | {
|
---|
1104 | uint temp_pc = g_cpu_pc;
|
---|
1105 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1106 | sprintf(g_dasm_str, "bra %x; (2+)", temp_pc + read_imm_32());
|
---|
1107 | }
|
---|
1108 |
|
---|
1109 | static void d68000_bset_r(void)
|
---|
1110 | {
|
---|
1111 | sprintf(g_dasm_str, "bset D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
1112 | }
|
---|
1113 |
|
---|
1114 | static void d68000_bset_s(void)
|
---|
1115 | {
|
---|
1116 | char* str = get_imm_str_u8();
|
---|
1117 | sprintf(g_dasm_str, "bset %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
1118 | }
|
---|
1119 |
|
---|
1120 | static void d68000_bsr_8(void)
|
---|
1121 | {
|
---|
1122 | uint temp_pc = g_cpu_pc;
|
---|
1123 | sprintf(g_dasm_str, "bsr %x", temp_pc + make_int_8(g_cpu_ir));
|
---|
1124 | }
|
---|
1125 |
|
---|
1126 | static void d68000_bsr_16(void)
|
---|
1127 | {
|
---|
1128 | uint temp_pc = g_cpu_pc;
|
---|
1129 | sprintf(g_dasm_str, "bsr %x", temp_pc + make_int_16(read_imm_16()));
|
---|
1130 | }
|
---|
1131 |
|
---|
1132 | static void d68020_bsr_32(void)
|
---|
1133 | {
|
---|
1134 | uint temp_pc = g_cpu_pc;
|
---|
1135 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1136 | sprintf(g_dasm_str, "bsr %x; (2+)", temp_pc + peek_imm_32());
|
---|
1137 | }
|
---|
1138 |
|
---|
1139 | static void d68000_btst_r(void)
|
---|
1140 | {
|
---|
1141 | sprintf(g_dasm_str, "btst D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
1142 | }
|
---|
1143 |
|
---|
1144 | static void d68000_btst_s(void)
|
---|
1145 | {
|
---|
1146 | char* str = get_imm_str_u8();
|
---|
1147 | sprintf(g_dasm_str, "btst %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
1148 | }
|
---|
1149 |
|
---|
1150 | static void d68020_callm(void)
|
---|
1151 | {
|
---|
1152 | char* str;
|
---|
1153 | LIMIT_CPU_TYPES(M68020_ONLY);
|
---|
1154 | str = get_imm_str_u8();
|
---|
1155 |
|
---|
1156 | sprintf(g_dasm_str, "callm %s, %s; (2)", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
1157 | }
|
---|
1158 |
|
---|
1159 | static void d68020_cas_8(void)
|
---|
1160 | {
|
---|
1161 | uint extension;
|
---|
1162 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1163 | extension = read_imm_16();
|
---|
1164 | sprintf(g_dasm_str, "cas.b D%d, D%d, %s; (2+)", extension&7, (extension>>6)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
1165 | }
|
---|
1166 |
|
---|
1167 | static void d68020_cas_16(void)
|
---|
1168 | {
|
---|
1169 | uint extension;
|
---|
1170 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1171 | extension = read_imm_16();
|
---|
1172 | sprintf(g_dasm_str, "cas.w D%d, D%d, %s; (2+)", extension&7, (extension>>6)&7, get_ea_mode_str_16(g_cpu_ir));
|
---|
1173 | }
|
---|
1174 |
|
---|
1175 | static void d68020_cas_32(void)
|
---|
1176 | {
|
---|
1177 | uint extension;
|
---|
1178 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1179 | extension = read_imm_16();
|
---|
1180 | sprintf(g_dasm_str, "cas.l D%d, D%d, %s; (2+)", extension&7, (extension>>6)&7, get_ea_mode_str_32(g_cpu_ir));
|
---|
1181 | }
|
---|
1182 |
|
---|
1183 | static void d68020_cas2_16(void)
|
---|
1184 | {
|
---|
1185 | /* CAS2 Dc1:Dc2,Du1:Dc2:(Rn1):(Rn2)
|
---|
1186 | f e d c b a 9 8 7 6 5 4 3 2 1 0
|
---|
1187 | DARn1 0 0 0 Du1 0 0 0 Dc1
|
---|
1188 | DARn2 0 0 0 Du2 0 0 0 Dc2
|
---|
1189 | */
|
---|
1190 |
|
---|
1191 | uint extension;
|
---|
1192 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1193 | extension = read_imm_32();
|
---|
1194 | sprintf(g_dasm_str, "cas2.w D%d:D%d, D%d:D%d, (%c%d):(%c%d); (2+)",
|
---|
1195 | (extension>>16)&7, extension&7, (extension>>22)&7, (extension>>6)&7,
|
---|
1196 | BIT_1F(extension) ? 'A' : 'D', (extension>>28)&7,
|
---|
1197 | BIT_F(extension) ? 'A' : 'D', (extension>>12)&7);
|
---|
1198 | }
|
---|
1199 |
|
---|
1200 | static void d68020_cas2_32(void)
|
---|
1201 | {
|
---|
1202 | uint extension;
|
---|
1203 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1204 | extension = read_imm_32();
|
---|
1205 | sprintf(g_dasm_str, "cas2.l D%d:D%d, D%d:D%d, (%c%d):(%c%d); (2+)",
|
---|
1206 | (extension>>16)&7, extension&7, (extension>>22)&7, (extension>>6)&7,
|
---|
1207 | BIT_1F(extension) ? 'A' : 'D', (extension>>28)&7,
|
---|
1208 | BIT_F(extension) ? 'A' : 'D', (extension>>12)&7);
|
---|
1209 | }
|
---|
1210 |
|
---|
1211 | static void d68000_chk_16(void)
|
---|
1212 | {
|
---|
1213 | sprintf(g_dasm_str, "chk.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1214 | }
|
---|
1215 |
|
---|
1216 | static void d68020_chk_32(void)
|
---|
1217 | {
|
---|
1218 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1219 | sprintf(g_dasm_str, "chk.l %s, D%d; (2+)", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1220 | }
|
---|
1221 |
|
---|
1222 | static void d68020_chk2_cmp2_8(void)
|
---|
1223 | {
|
---|
1224 | uint extension;
|
---|
1225 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1226 | extension = read_imm_16();
|
---|
1227 | sprintf(g_dasm_str, "%s.b %s, %c%d; (2+)", BIT_B(extension) ? "chk2" : "cmp2", get_ea_mode_str_8(g_cpu_ir), BIT_F(extension) ? 'A' : 'D', (extension>>12)&7);
|
---|
1228 | }
|
---|
1229 |
|
---|
1230 | static void d68020_chk2_cmp2_16(void)
|
---|
1231 | {
|
---|
1232 | uint extension;
|
---|
1233 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1234 | extension = read_imm_16();
|
---|
1235 | sprintf(g_dasm_str, "%s.w %s, %c%d; (2+)", BIT_B(extension) ? "chk2" : "cmp2", get_ea_mode_str_16(g_cpu_ir), BIT_F(extension) ? 'A' : 'D', (extension>>12)&7);
|
---|
1236 | }
|
---|
1237 |
|
---|
1238 | static void d68020_chk2_cmp2_32(void)
|
---|
1239 | {
|
---|
1240 | uint extension;
|
---|
1241 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1242 | extension = read_imm_16();
|
---|
1243 | sprintf(g_dasm_str, "%s.l %s, %c%d; (2+)", BIT_B(extension) ? "chk2" : "cmp2", get_ea_mode_str_32(g_cpu_ir), BIT_F(extension) ? 'A' : 'D', (extension>>12)&7);
|
---|
1244 | }
|
---|
1245 |
|
---|
1246 | static void d68040_cinv(void)
|
---|
1247 | {
|
---|
1248 | LIMIT_CPU_TYPES(M68040_PLUS);
|
---|
1249 | switch((g_cpu_ir>>3)&3)
|
---|
1250 | {
|
---|
1251 | case 0:
|
---|
1252 | sprintf(g_dasm_str, "cinv (illegal scope); (4)");
|
---|
1253 | break;
|
---|
1254 | case 1:
|
---|
1255 | sprintf(g_dasm_str, "cinvl %d, (A%d); (4)", (g_cpu_ir>>6)&3, g_cpu_ir&7);
|
---|
1256 | break;
|
---|
1257 | case 2:
|
---|
1258 | sprintf(g_dasm_str, "cinvp %d, (A%d); (4)", (g_cpu_ir>>6)&3, g_cpu_ir&7);
|
---|
1259 | break;
|
---|
1260 | case 3:
|
---|
1261 | sprintf(g_dasm_str, "cinva %d; (4)", (g_cpu_ir>>6)&3);
|
---|
1262 | break;
|
---|
1263 | }
|
---|
1264 | }
|
---|
1265 |
|
---|
1266 | static void d68000_clr_8(void)
|
---|
1267 | {
|
---|
1268 | sprintf(g_dasm_str, "clr.b %s", get_ea_mode_str_8(g_cpu_ir));
|
---|
1269 | }
|
---|
1270 |
|
---|
1271 | static void d68000_clr_16(void)
|
---|
1272 | {
|
---|
1273 | sprintf(g_dasm_str, "clr.w %s", get_ea_mode_str_16(g_cpu_ir));
|
---|
1274 | }
|
---|
1275 |
|
---|
1276 | static void d68000_clr_32(void)
|
---|
1277 | {
|
---|
1278 | sprintf(g_dasm_str, "clr.l %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
1279 | }
|
---|
1280 |
|
---|
1281 | static void d68000_cmp_8(void)
|
---|
1282 | {
|
---|
1283 | sprintf(g_dasm_str, "cmp.b %s, D%d", get_ea_mode_str_8(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 | static void d68000_cmp_16(void)
|
---|
1287 | {
|
---|
1288 | sprintf(g_dasm_str, "cmp.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1289 | }
|
---|
1290 |
|
---|
1291 | static void d68000_cmp_32(void)
|
---|
1292 | {
|
---|
1293 | sprintf(g_dasm_str, "cmp.l %s, D%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1294 | }
|
---|
1295 |
|
---|
1296 | static void d68000_cmpa_16(void)
|
---|
1297 | {
|
---|
1298 | sprintf(g_dasm_str, "cmpa.w %s, A%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1299 | }
|
---|
1300 |
|
---|
1301 | static void d68000_cmpa_32(void)
|
---|
1302 | {
|
---|
1303 | sprintf(g_dasm_str, "cmpa.l %s, A%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1304 | }
|
---|
1305 |
|
---|
1306 | static void d68000_cmpi_8(void)
|
---|
1307 | {
|
---|
1308 | char* str = get_imm_str_s8();
|
---|
1309 | sprintf(g_dasm_str, "cmpi.b %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
1310 | }
|
---|
1311 |
|
---|
1312 | static void d68020_cmpi_pcdi_8(void)
|
---|
1313 | {
|
---|
1314 | char* str;
|
---|
1315 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
1316 | str = get_imm_str_s8();
|
---|
1317 | sprintf(g_dasm_str, "cmpi.b %s, %s; (2+)", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
1318 | }
|
---|
1319 |
|
---|
1320 | static void d68020_cmpi_pcix_8(void)
|
---|
1321 | {
|
---|
1322 | char* str;
|
---|
1323 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
1324 | str = get_imm_str_s8();
|
---|
1325 | sprintf(g_dasm_str, "cmpi.b %s, %s; (2+)", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
1326 | }
|
---|
1327 |
|
---|
1328 | static void d68000_cmpi_16(void)
|
---|
1329 | {
|
---|
1330 | char* str;
|
---|
1331 | str = get_imm_str_s16();
|
---|
1332 | sprintf(g_dasm_str, "cmpi.w %s, %s", str, get_ea_mode_str_16(g_cpu_ir));
|
---|
1333 | }
|
---|
1334 |
|
---|
1335 | static void d68020_cmpi_pcdi_16(void)
|
---|
1336 | {
|
---|
1337 | char* str;
|
---|
1338 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
1339 | str = get_imm_str_s16();
|
---|
1340 | sprintf(g_dasm_str, "cmpi.w %s, %s; (2+)", str, get_ea_mode_str_16(g_cpu_ir));
|
---|
1341 | }
|
---|
1342 |
|
---|
1343 | static void d68020_cmpi_pcix_16(void)
|
---|
1344 | {
|
---|
1345 | char* str;
|
---|
1346 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
1347 | str = get_imm_str_s16();
|
---|
1348 | sprintf(g_dasm_str, "cmpi.w %s, %s; (2+)", str, get_ea_mode_str_16(g_cpu_ir));
|
---|
1349 | }
|
---|
1350 |
|
---|
1351 | static void d68000_cmpi_32(void)
|
---|
1352 | {
|
---|
1353 | char* str;
|
---|
1354 | str = get_imm_str_s32();
|
---|
1355 | sprintf(g_dasm_str, "cmpi.l %s, %s", str, get_ea_mode_str_32(g_cpu_ir));
|
---|
1356 | }
|
---|
1357 |
|
---|
1358 | static void d68020_cmpi_pcdi_32(void)
|
---|
1359 | {
|
---|
1360 | char* str;
|
---|
1361 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
1362 | str = get_imm_str_s32();
|
---|
1363 | sprintf(g_dasm_str, "cmpi.l %s, %s; (2+)", str, get_ea_mode_str_32(g_cpu_ir));
|
---|
1364 | }
|
---|
1365 |
|
---|
1366 | static void d68020_cmpi_pcix_32(void)
|
---|
1367 | {
|
---|
1368 | char* str;
|
---|
1369 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
1370 | str = get_imm_str_s32();
|
---|
1371 | sprintf(g_dasm_str, "cmpi.l %s, %s; (2+)", str, get_ea_mode_str_32(g_cpu_ir));
|
---|
1372 | }
|
---|
1373 |
|
---|
1374 | static void d68000_cmpm_8(void)
|
---|
1375 | {
|
---|
1376 | sprintf(g_dasm_str, "cmpm.b (A%d)+, (A%d)+", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
1377 | }
|
---|
1378 |
|
---|
1379 | static void d68000_cmpm_16(void)
|
---|
1380 | {
|
---|
1381 | sprintf(g_dasm_str, "cmpm.w (A%d)+, (A%d)+", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
1382 | }
|
---|
1383 |
|
---|
1384 | static void d68000_cmpm_32(void)
|
---|
1385 | {
|
---|
1386 | sprintf(g_dasm_str, "cmpm.l (A%d)+, (A%d)+", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
1387 | }
|
---|
1388 |
|
---|
1389 | static void d68020_cpbcc_16(void)
|
---|
1390 | {
|
---|
1391 | uint extension;
|
---|
1392 | uint new_pc = g_cpu_pc;
|
---|
1393 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1394 | extension = read_imm_16();
|
---|
1395 | new_pc += make_int_16(peek_imm_16());
|
---|
1396 | sprintf(g_dasm_str, "%db%-4s %s; %x (extension = %x) (2-3)", (g_cpu_ir>>9)&7, g_cpcc[g_cpu_ir&0x3f], get_imm_str_s16(), new_pc, extension);
|
---|
1397 | }
|
---|
1398 |
|
---|
1399 | static void d68020_cpbcc_32(void)
|
---|
1400 | {
|
---|
1401 | uint extension;
|
---|
1402 | uint new_pc = g_cpu_pc;
|
---|
1403 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1404 | extension = read_imm_16();
|
---|
1405 | new_pc += peek_imm_32();
|
---|
1406 | sprintf(g_dasm_str, "%db%-4s %s; %x (extension = %x) (2-3)", (g_cpu_ir>>9)&7, g_cpcc[g_cpu_ir&0x3f], get_imm_str_s16(), new_pc, extension);
|
---|
1407 | }
|
---|
1408 |
|
---|
1409 | static void d68020_cpdbcc(void)
|
---|
1410 | {
|
---|
1411 | uint extension1;
|
---|
1412 | uint extension2;
|
---|
1413 | uint new_pc = g_cpu_pc;
|
---|
1414 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1415 | extension1 = read_imm_16();
|
---|
1416 | extension2 = read_imm_16();
|
---|
1417 | new_pc += make_int_16(peek_imm_16());
|
---|
1418 | sprintf(g_dasm_str, "%ddb%-4s D%d,%s; %x (extension = %x) (2-3)", (g_cpu_ir>>9)&7, g_cpcc[extension1&0x3f], g_cpu_ir&7, get_imm_str_s16(), new_pc, extension2);
|
---|
1419 | }
|
---|
1420 |
|
---|
1421 | static void d68020_cpgen(void)
|
---|
1422 | {
|
---|
1423 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1424 | sprintf(g_dasm_str, "%dgen %s; (2-3)", (g_cpu_ir>>9)&7, get_imm_str_u32());
|
---|
1425 | }
|
---|
1426 |
|
---|
1427 | static void d68020_cprestore(void)
|
---|
1428 | {
|
---|
1429 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1430 | sprintf(g_dasm_str, "%drestore %s; (2-3)", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
1431 | }
|
---|
1432 |
|
---|
1433 | static void d68020_cpsave(void)
|
---|
1434 | {
|
---|
1435 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1436 | sprintf(g_dasm_str, "%dsave %s; (2-3)", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
1437 | }
|
---|
1438 |
|
---|
1439 | static void d68020_cpscc(void)
|
---|
1440 | {
|
---|
1441 | uint extension1;
|
---|
1442 | uint extension2;
|
---|
1443 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1444 | extension1 = read_imm_16();
|
---|
1445 | extension2 = read_imm_16();
|
---|
1446 | sprintf(g_dasm_str, "%ds%-4s %s; (extension = %x) (2-3)", (g_cpu_ir>>9)&7, g_cpcc[extension1&0x3f], get_ea_mode_str_8(g_cpu_ir), extension2);
|
---|
1447 | }
|
---|
1448 |
|
---|
1449 | static void d68020_cptrapcc_0(void)
|
---|
1450 | {
|
---|
1451 | uint extension1;
|
---|
1452 | uint extension2;
|
---|
1453 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1454 | extension1 = read_imm_16();
|
---|
1455 | extension2 = read_imm_16();
|
---|
1456 | sprintf(g_dasm_str, "%dtrap%-4s; (extension = %x) (2-3)", (g_cpu_ir>>9)&7, g_cpcc[extension1&0x3f], extension2);
|
---|
1457 | }
|
---|
1458 |
|
---|
1459 | static void d68020_cptrapcc_16(void)
|
---|
1460 | {
|
---|
1461 | uint extension1;
|
---|
1462 | uint extension2;
|
---|
1463 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1464 | extension1 = read_imm_16();
|
---|
1465 | extension2 = read_imm_16();
|
---|
1466 | sprintf(g_dasm_str, "%dtrap%-4s %s; (extension = %x) (2-3)", (g_cpu_ir>>9)&7, g_cpcc[extension1&0x3f], get_imm_str_u16(), extension2);
|
---|
1467 | }
|
---|
1468 |
|
---|
1469 | static void d68020_cptrapcc_32(void)
|
---|
1470 | {
|
---|
1471 | uint extension1;
|
---|
1472 | uint extension2;
|
---|
1473 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1474 | extension1 = read_imm_16();
|
---|
1475 | extension2 = read_imm_16();
|
---|
1476 | sprintf(g_dasm_str, "%dtrap%-4s %s; (extension = %x) (2-3)", (g_cpu_ir>>9)&7, g_cpcc[extension1&0x3f], get_imm_str_u32(), extension2);
|
---|
1477 | }
|
---|
1478 |
|
---|
1479 | static void d68040_cpush(void)
|
---|
1480 | {
|
---|
1481 | LIMIT_CPU_TYPES(M68040_PLUS);
|
---|
1482 | switch((g_cpu_ir>>3)&3)
|
---|
1483 | {
|
---|
1484 | case 0:
|
---|
1485 | sprintf(g_dasm_str, "cpush (illegal scope); (4)");
|
---|
1486 | break;
|
---|
1487 | case 1:
|
---|
1488 | sprintf(g_dasm_str, "cpushl %d, (A%d); (4)", (g_cpu_ir>>6)&3, g_cpu_ir&7);
|
---|
1489 | break;
|
---|
1490 | case 2:
|
---|
1491 | sprintf(g_dasm_str, "cpushp %d, (A%d); (4)", (g_cpu_ir>>6)&3, g_cpu_ir&7);
|
---|
1492 | break;
|
---|
1493 | case 3:
|
---|
1494 | sprintf(g_dasm_str, "cpusha %d; (4)", (g_cpu_ir>>6)&3);
|
---|
1495 | break;
|
---|
1496 | }
|
---|
1497 | }
|
---|
1498 |
|
---|
1499 | static void d68000_dbra(void)
|
---|
1500 | {
|
---|
1501 | uint temp_pc = g_cpu_pc;
|
---|
1502 | sprintf(g_dasm_str, "dbra D%d, %x", g_cpu_ir & 7, temp_pc + make_int_16(read_imm_16()));
|
---|
1503 | }
|
---|
1504 |
|
---|
1505 | static void d68000_dbcc(void)
|
---|
1506 | {
|
---|
1507 | uint temp_pc = g_cpu_pc;
|
---|
1508 | sprintf(g_dasm_str, "db%-2s D%d, %x", g_cc[(g_cpu_ir>>8)&0xf], g_cpu_ir & 7, temp_pc + make_int_16(read_imm_16()));
|
---|
1509 | }
|
---|
1510 |
|
---|
1511 | static void d68000_divs(void)
|
---|
1512 | {
|
---|
1513 | sprintf(g_dasm_str, "divs.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1514 | }
|
---|
1515 |
|
---|
1516 | static void d68000_divu(void)
|
---|
1517 | {
|
---|
1518 | sprintf(g_dasm_str, "divu.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1519 | }
|
---|
1520 |
|
---|
1521 | static void d68020_divl(void)
|
---|
1522 | {
|
---|
1523 | uint extension;
|
---|
1524 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1525 | extension = read_imm_16();
|
---|
1526 |
|
---|
1527 | if(BIT_A(extension))
|
---|
1528 | sprintf(g_dasm_str, "div%c.l %s, D%d:D%d; (2+)", BIT_B(extension) ? 's' : 'u', get_ea_mode_str_32(g_cpu_ir), extension&7, (extension>>12)&7);
|
---|
1529 | else if((extension&7) == ((extension>>12)&7))
|
---|
1530 | sprintf(g_dasm_str, "div%c.l %s, D%d; (2+)", BIT_B(extension) ? 's' : 'u', get_ea_mode_str_32(g_cpu_ir), (extension>>12)&7);
|
---|
1531 | else
|
---|
1532 | sprintf(g_dasm_str, "div%cl.l %s, D%d:D%d; (2+)", BIT_B(extension) ? 's' : 'u', get_ea_mode_str_32(g_cpu_ir), extension&7, (extension>>12)&7);
|
---|
1533 | }
|
---|
1534 |
|
---|
1535 | static void d68000_eor_8(void)
|
---|
1536 | {
|
---|
1537 | sprintf(g_dasm_str, "eor.b D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
1538 | }
|
---|
1539 |
|
---|
1540 | static void d68000_eor_16(void)
|
---|
1541 | {
|
---|
1542 | sprintf(g_dasm_str, "eor.w D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_16(g_cpu_ir));
|
---|
1543 | }
|
---|
1544 |
|
---|
1545 | static void d68000_eor_32(void)
|
---|
1546 | {
|
---|
1547 | sprintf(g_dasm_str, "eor.l D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_32(g_cpu_ir));
|
---|
1548 | }
|
---|
1549 |
|
---|
1550 | static void d68000_eori_8(void)
|
---|
1551 | {
|
---|
1552 | char* str = get_imm_str_u8();
|
---|
1553 | sprintf(g_dasm_str, "eori.b %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
1554 | }
|
---|
1555 |
|
---|
1556 | static void d68000_eori_16(void)
|
---|
1557 | {
|
---|
1558 | char* str = get_imm_str_u16();
|
---|
1559 | sprintf(g_dasm_str, "eori.w %s, %s", str, get_ea_mode_str_16(g_cpu_ir));
|
---|
1560 | }
|
---|
1561 |
|
---|
1562 | static void d68000_eori_32(void)
|
---|
1563 | {
|
---|
1564 | char* str = get_imm_str_u32();
|
---|
1565 | sprintf(g_dasm_str, "eori.l %s, %s", str, get_ea_mode_str_32(g_cpu_ir));
|
---|
1566 | }
|
---|
1567 |
|
---|
1568 | static void d68000_eori_to_ccr(void)
|
---|
1569 | {
|
---|
1570 | sprintf(g_dasm_str, "eori %s, CCR", get_imm_str_u8());
|
---|
1571 | }
|
---|
1572 |
|
---|
1573 | static void d68000_eori_to_sr(void)
|
---|
1574 | {
|
---|
1575 | sprintf(g_dasm_str, "eori %s, SR", get_imm_str_u16());
|
---|
1576 | }
|
---|
1577 |
|
---|
1578 | static void d68000_exg_dd(void)
|
---|
1579 | {
|
---|
1580 | sprintf(g_dasm_str, "exg D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
1581 | }
|
---|
1582 |
|
---|
1583 | static void d68000_exg_aa(void)
|
---|
1584 | {
|
---|
1585 | sprintf(g_dasm_str, "exg A%d, A%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
1586 | }
|
---|
1587 |
|
---|
1588 | static void d68000_exg_da(void)
|
---|
1589 | {
|
---|
1590 | sprintf(g_dasm_str, "exg D%d, A%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
1591 | }
|
---|
1592 |
|
---|
1593 | static void d68000_ext_16(void)
|
---|
1594 | {
|
---|
1595 | sprintf(g_dasm_str, "ext.w D%d", g_cpu_ir&7);
|
---|
1596 | }
|
---|
1597 |
|
---|
1598 | static void d68000_ext_32(void)
|
---|
1599 | {
|
---|
1600 | sprintf(g_dasm_str, "ext.l D%d", g_cpu_ir&7);
|
---|
1601 | }
|
---|
1602 |
|
---|
1603 | static void d68020_extb_32(void)
|
---|
1604 | {
|
---|
1605 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1606 | sprintf(g_dasm_str, "extb.l D%d; (2+)", g_cpu_ir&7);
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 | static void d68000_jmp(void)
|
---|
1610 | {
|
---|
1611 | sprintf(g_dasm_str, "jmp %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
1612 | }
|
---|
1613 |
|
---|
1614 | static void d68000_jsr(void)
|
---|
1615 | {
|
---|
1616 | sprintf(g_dasm_str, "jsr %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
1617 | }
|
---|
1618 |
|
---|
1619 | static void d68000_lea(void)
|
---|
1620 | {
|
---|
1621 | sprintf(g_dasm_str, "lea %s, A%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1622 | }
|
---|
1623 |
|
---|
1624 | static void d68000_link_16(void)
|
---|
1625 | {
|
---|
1626 | sprintf(g_dasm_str, "link A%d, %s", g_cpu_ir&7, get_imm_str_s16());
|
---|
1627 | }
|
---|
1628 |
|
---|
1629 | static void d68020_link_32(void)
|
---|
1630 | {
|
---|
1631 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
1632 | sprintf(g_dasm_str, "link A%d, %s; (2+)", g_cpu_ir&7, get_imm_str_s32());
|
---|
1633 | }
|
---|
1634 |
|
---|
1635 | static void d68000_lsr_s_8(void)
|
---|
1636 | {
|
---|
1637 | sprintf(g_dasm_str, "lsr.b #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
1638 | }
|
---|
1639 |
|
---|
1640 | static void d68000_lsr_s_16(void)
|
---|
1641 | {
|
---|
1642 | sprintf(g_dasm_str, "lsr.w #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
1643 | }
|
---|
1644 |
|
---|
1645 | static void d68000_lsr_s_32(void)
|
---|
1646 | {
|
---|
1647 | sprintf(g_dasm_str, "lsr.l #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
1648 | }
|
---|
1649 |
|
---|
1650 | static void d68000_lsr_r_8(void)
|
---|
1651 | {
|
---|
1652 | sprintf(g_dasm_str, "lsr.b D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
1653 | }
|
---|
1654 |
|
---|
1655 | static void d68000_lsr_r_16(void)
|
---|
1656 | {
|
---|
1657 | sprintf(g_dasm_str, "lsr.w D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
1658 | }
|
---|
1659 |
|
---|
1660 | static void d68000_lsr_r_32(void)
|
---|
1661 | {
|
---|
1662 | sprintf(g_dasm_str, "lsr.l D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
1663 | }
|
---|
1664 |
|
---|
1665 | static void d68000_lsr_ea(void)
|
---|
1666 | {
|
---|
1667 | sprintf(g_dasm_str, "lsr.w %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
1668 | }
|
---|
1669 |
|
---|
1670 | static void d68000_lsl_s_8(void)
|
---|
1671 | {
|
---|
1672 | sprintf(g_dasm_str, "lsl.b #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
1673 | }
|
---|
1674 |
|
---|
1675 | static void d68000_lsl_s_16(void)
|
---|
1676 | {
|
---|
1677 | sprintf(g_dasm_str, "lsl.w #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
1678 | }
|
---|
1679 |
|
---|
1680 | static void d68000_lsl_s_32(void)
|
---|
1681 | {
|
---|
1682 | sprintf(g_dasm_str, "lsl.l #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
1683 | }
|
---|
1684 |
|
---|
1685 | static void d68000_lsl_r_8(void)
|
---|
1686 | {
|
---|
1687 | sprintf(g_dasm_str, "lsl.b D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
1688 | }
|
---|
1689 |
|
---|
1690 | static void d68000_lsl_r_16(void)
|
---|
1691 | {
|
---|
1692 | sprintf(g_dasm_str, "lsl.w D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
1693 | }
|
---|
1694 |
|
---|
1695 | static void d68000_lsl_r_32(void)
|
---|
1696 | {
|
---|
1697 | sprintf(g_dasm_str, "lsl.l D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
1698 | }
|
---|
1699 |
|
---|
1700 | static void d68000_lsl_ea(void)
|
---|
1701 | {
|
---|
1702 | sprintf(g_dasm_str, "lsl.w %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
1703 | }
|
---|
1704 |
|
---|
1705 | static void d68000_move_8(void)
|
---|
1706 | {
|
---|
1707 | char* str = get_ea_mode_str_8(g_cpu_ir);
|
---|
1708 | sprintf(g_dasm_str, "move.b %s, %s", str, get_ea_mode_str_8(((g_cpu_ir>>9) & 7) | ((g_cpu_ir>>3) & 0x38)));
|
---|
1709 | }
|
---|
1710 |
|
---|
1711 | static void d68000_move_16(void)
|
---|
1712 | {
|
---|
1713 | char* str = get_ea_mode_str_16(g_cpu_ir);
|
---|
1714 | sprintf(g_dasm_str, "move.w %s, %s", str, get_ea_mode_str_16(((g_cpu_ir>>9) & 7) | ((g_cpu_ir>>3) & 0x38)));
|
---|
1715 | }
|
---|
1716 |
|
---|
1717 | static void d68000_move_32(void)
|
---|
1718 | {
|
---|
1719 | char* str = get_ea_mode_str_32(g_cpu_ir);
|
---|
1720 | sprintf(g_dasm_str, "move.l %s, %s", str, get_ea_mode_str_32(((g_cpu_ir>>9) & 7) | ((g_cpu_ir>>3) & 0x38)));
|
---|
1721 | }
|
---|
1722 |
|
---|
1723 | static void d68000_movea_16(void)
|
---|
1724 | {
|
---|
1725 | sprintf(g_dasm_str, "movea.w %s, A%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1726 | }
|
---|
1727 |
|
---|
1728 | static void d68000_movea_32(void)
|
---|
1729 | {
|
---|
1730 | sprintf(g_dasm_str, "movea.l %s, A%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
1731 | }
|
---|
1732 |
|
---|
1733 | static void d68000_move_to_ccr(void)
|
---|
1734 | {
|
---|
1735 | sprintf(g_dasm_str, "move %s, CCR", get_ea_mode_str_8(g_cpu_ir));
|
---|
1736 | }
|
---|
1737 |
|
---|
1738 | static void d68010_move_fr_ccr(void)
|
---|
1739 | {
|
---|
1740 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
1741 | sprintf(g_dasm_str, "move CCR, %s; (1+)", get_ea_mode_str_8(g_cpu_ir));
|
---|
1742 | }
|
---|
1743 |
|
---|
1744 | static void d68000_move_fr_sr(void)
|
---|
1745 | {
|
---|
1746 | sprintf(g_dasm_str, "move SR, %s", get_ea_mode_str_16(g_cpu_ir));
|
---|
1747 | }
|
---|
1748 |
|
---|
1749 | static void d68000_move_to_sr(void)
|
---|
1750 | {
|
---|
1751 | sprintf(g_dasm_str, "move %s, SR", get_ea_mode_str_16(g_cpu_ir));
|
---|
1752 | }
|
---|
1753 |
|
---|
1754 | static void d68000_move_fr_usp(void)
|
---|
1755 | {
|
---|
1756 | sprintf(g_dasm_str, "move USP, A%d", g_cpu_ir&7);
|
---|
1757 | }
|
---|
1758 |
|
---|
1759 | static void d68000_move_to_usp(void)
|
---|
1760 | {
|
---|
1761 | sprintf(g_dasm_str, "move A%d, USP", g_cpu_ir&7);
|
---|
1762 | }
|
---|
1763 |
|
---|
1764 | static void d68010_movec(void)
|
---|
1765 | {
|
---|
1766 | uint extension;
|
---|
1767 | char* reg_name;
|
---|
1768 | char* processor;
|
---|
1769 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
1770 | extension = read_imm_16();
|
---|
1771 |
|
---|
1772 | switch(extension & 0xfff)
|
---|
1773 | {
|
---|
1774 | case 0x000:
|
---|
1775 | reg_name = "SFC";
|
---|
1776 | processor = "1+";
|
---|
1777 | break;
|
---|
1778 | case 0x001:
|
---|
1779 | reg_name = "DFC";
|
---|
1780 | processor = "1+";
|
---|
1781 | break;
|
---|
1782 | case 0x800:
|
---|
1783 | reg_name = "USP";
|
---|
1784 | processor = "1+";
|
---|
1785 | break;
|
---|
1786 | case 0x801:
|
---|
1787 | reg_name = "VBR";
|
---|
1788 | processor = "1+";
|
---|
1789 | break;
|
---|
1790 | case 0x002:
|
---|
1791 | reg_name = "CACR";
|
---|
1792 | processor = "2+";
|
---|
1793 | break;
|
---|
1794 | case 0x802:
|
---|
1795 | reg_name = "CAAR";
|
---|
1796 | processor = "2,3";
|
---|
1797 | break;
|
---|
1798 | case 0x803:
|
---|
1799 | reg_name = "MSP";
|
---|
1800 | processor = "2+";
|
---|
1801 | break;
|
---|
1802 | case 0x804:
|
---|
1803 | reg_name = "ISP";
|
---|
1804 | processor = "2+";
|
---|
1805 | break;
|
---|
1806 | case 0x003:
|
---|
1807 | reg_name = "TC";
|
---|
1808 | processor = "4+";
|
---|
1809 | break;
|
---|
1810 | case 0x004:
|
---|
1811 | reg_name = "ITT0";
|
---|
1812 | processor = "4+";
|
---|
1813 | break;
|
---|
1814 | case 0x005:
|
---|
1815 | reg_name = "ITT1";
|
---|
1816 | processor = "4+";
|
---|
1817 | break;
|
---|
1818 | case 0x006:
|
---|
1819 | reg_name = "DTT0";
|
---|
1820 | processor = "4+";
|
---|
1821 | break;
|
---|
1822 | case 0x007:
|
---|
1823 | reg_name = "DTT1";
|
---|
1824 | processor = "4+";
|
---|
1825 | break;
|
---|
1826 | case 0x805:
|
---|
1827 | reg_name = "MMUSR";
|
---|
1828 | processor = "4+";
|
---|
1829 | break;
|
---|
1830 | case 0x806:
|
---|
1831 | reg_name = "URP";
|
---|
1832 | processor = "4+";
|
---|
1833 | break;
|
---|
1834 | case 0x807:
|
---|
1835 | reg_name = "SRP";
|
---|
1836 | processor = "4+";
|
---|
1837 | break;
|
---|
1838 | default:
|
---|
1839 | reg_name = make_signed_hex_str_16(extension & 0xfff);
|
---|
1840 | processor = "?";
|
---|
1841 | }
|
---|
1842 |
|
---|
1843 | if(BIT_1(g_cpu_ir))
|
---|
1844 | sprintf(g_dasm_str, "movec %c%d, %s; (%s)", BIT_F(extension) ? 'A' : 'D', (extension>>12)&7, reg_name, processor);
|
---|
1845 | else
|
---|
1846 | sprintf(g_dasm_str, "movec %s, %c%d; (%s)", reg_name, BIT_F(extension) ? 'A' : 'D', (extension>>12)&7, processor);
|
---|
1847 | }
|
---|
1848 |
|
---|
1849 | static void d68000_movem_pd_16(void)
|
---|
1850 | {
|
---|
1851 | uint data = read_imm_16();
|
---|
1852 | char buffer[40];
|
---|
1853 | uint first;
|
---|
1854 | uint run_length;
|
---|
1855 | uint i;
|
---|
1856 |
|
---|
1857 | buffer[0] = 0;
|
---|
1858 | for(i=0;i<8;i++)
|
---|
1859 | {
|
---|
1860 | if(data&(1<<(15-i)))
|
---|
1861 | {
|
---|
1862 | first = i;
|
---|
1863 | run_length = 0;
|
---|
1864 | while(i<7 && (data&(1<<(15-(i+1)))))
|
---|
1865 | {
|
---|
1866 | i++;
|
---|
1867 | run_length++;
|
---|
1868 | }
|
---|
1869 | if(buffer[0] != 0)
|
---|
1870 | strcat(buffer, "/");
|
---|
1871 | sprintf(buffer+strlen(buffer), "D%d", first);
|
---|
1872 | if(run_length > 0)
|
---|
1873 | sprintf(buffer+strlen(buffer), "-D%d", first + run_length);
|
---|
1874 | }
|
---|
1875 | }
|
---|
1876 | for(i=0;i<8;i++)
|
---|
1877 | {
|
---|
1878 | if(data&(1<<(7-i)))
|
---|
1879 | {
|
---|
1880 | first = i;
|
---|
1881 | run_length = 0;
|
---|
1882 | while(i<7 && (data&(1<<(7-(i+1)))))
|
---|
1883 | {
|
---|
1884 | i++;
|
---|
1885 | run_length++;
|
---|
1886 | }
|
---|
1887 | if(buffer[0] != 0)
|
---|
1888 | strcat(buffer, "/");
|
---|
1889 | sprintf(buffer+strlen(buffer), "A%d", first);
|
---|
1890 | if(run_length > 0)
|
---|
1891 | sprintf(buffer+strlen(buffer), "-A%d", first + run_length);
|
---|
1892 | }
|
---|
1893 | }
|
---|
1894 | sprintf(g_dasm_str, "movem.w %s, %s", buffer, get_ea_mode_str_16(g_cpu_ir));
|
---|
1895 | }
|
---|
1896 |
|
---|
1897 | static void d68000_movem_pd_32(void)
|
---|
1898 | {
|
---|
1899 | uint data = read_imm_16();
|
---|
1900 | char buffer[40];
|
---|
1901 | uint first;
|
---|
1902 | uint run_length;
|
---|
1903 | uint i;
|
---|
1904 |
|
---|
1905 | buffer[0] = 0;
|
---|
1906 | for(i=0;i<8;i++)
|
---|
1907 | {
|
---|
1908 | if(data&(1<<(15-i)))
|
---|
1909 | {
|
---|
1910 | first = i;
|
---|
1911 | run_length = 0;
|
---|
1912 | while(i<7 && (data&(1<<(15-(i+1)))))
|
---|
1913 | {
|
---|
1914 | i++;
|
---|
1915 | run_length++;
|
---|
1916 | }
|
---|
1917 | if(buffer[0] != 0)
|
---|
1918 | strcat(buffer, "/");
|
---|
1919 | sprintf(buffer+strlen(buffer), "D%d", first);
|
---|
1920 | if(run_length > 0)
|
---|
1921 | sprintf(buffer+strlen(buffer), "-D%d", first + run_length);
|
---|
1922 | }
|
---|
1923 | }
|
---|
1924 | for(i=0;i<8;i++)
|
---|
1925 | {
|
---|
1926 | if(data&(1<<(7-i)))
|
---|
1927 | {
|
---|
1928 | first = i;
|
---|
1929 | run_length = 0;
|
---|
1930 | while(i<7 && (data&(1<<(7-(i+1)))))
|
---|
1931 | {
|
---|
1932 | i++;
|
---|
1933 | run_length++;
|
---|
1934 | }
|
---|
1935 | if(buffer[0] != 0)
|
---|
1936 | strcat(buffer, "/");
|
---|
1937 | sprintf(buffer+strlen(buffer), "A%d", first);
|
---|
1938 | if(run_length > 0)
|
---|
1939 | sprintf(buffer+strlen(buffer), "-A%d", first + run_length);
|
---|
1940 | }
|
---|
1941 | }
|
---|
1942 | sprintf(g_dasm_str, "movem.l %s, %s", buffer, get_ea_mode_str_32(g_cpu_ir));
|
---|
1943 | }
|
---|
1944 |
|
---|
1945 | static void d68000_movem_er_16(void)
|
---|
1946 | {
|
---|
1947 | uint data = read_imm_16();
|
---|
1948 | char buffer[40];
|
---|
1949 | uint first;
|
---|
1950 | uint run_length;
|
---|
1951 | uint i;
|
---|
1952 |
|
---|
1953 | buffer[0] = 0;
|
---|
1954 | for(i=0;i<8;i++)
|
---|
1955 | {
|
---|
1956 | if(data&(1<<i))
|
---|
1957 | {
|
---|
1958 | first = i;
|
---|
1959 | run_length = 0;
|
---|
1960 | while(i<7 && (data&(1<<(i+1))))
|
---|
1961 | {
|
---|
1962 | i++;
|
---|
1963 | run_length++;
|
---|
1964 | }
|
---|
1965 | if(buffer[0] != 0)
|
---|
1966 | strcat(buffer, "/");
|
---|
1967 | sprintf(buffer+strlen(buffer), "D%d", first);
|
---|
1968 | if(run_length > 0)
|
---|
1969 | sprintf(buffer+strlen(buffer), "-D%d", first + run_length);
|
---|
1970 | }
|
---|
1971 | }
|
---|
1972 | for(i=0;i<8;i++)
|
---|
1973 | {
|
---|
1974 | if(data&(1<<(i+8)))
|
---|
1975 | {
|
---|
1976 | first = i;
|
---|
1977 | run_length = 0;
|
---|
1978 | while(i<7 && (data&(1<<(i+8+1))))
|
---|
1979 | {
|
---|
1980 | i++;
|
---|
1981 | run_length++;
|
---|
1982 | }
|
---|
1983 | if(buffer[0] != 0)
|
---|
1984 | strcat(buffer, "/");
|
---|
1985 | sprintf(buffer+strlen(buffer), "A%d", first);
|
---|
1986 | if(run_length > 0)
|
---|
1987 | sprintf(buffer+strlen(buffer), "-A%d", first + run_length);
|
---|
1988 | }
|
---|
1989 | }
|
---|
1990 | sprintf(g_dasm_str, "movem.w %s, %s", get_ea_mode_str_16(g_cpu_ir), buffer);
|
---|
1991 | }
|
---|
1992 |
|
---|
1993 | static void d68000_movem_er_32(void)
|
---|
1994 | {
|
---|
1995 | uint data = read_imm_16();
|
---|
1996 | char buffer[40];
|
---|
1997 | uint first;
|
---|
1998 | uint run_length;
|
---|
1999 | uint i;
|
---|
2000 |
|
---|
2001 | buffer[0] = 0;
|
---|
2002 | for(i=0;i<8;i++)
|
---|
2003 | {
|
---|
2004 | if(data&(1<<i))
|
---|
2005 | {
|
---|
2006 | first = i;
|
---|
2007 | run_length = 0;
|
---|
2008 | while(i<7 && (data&(1<<(i+1))))
|
---|
2009 | {
|
---|
2010 | i++;
|
---|
2011 | run_length++;
|
---|
2012 | }
|
---|
2013 | if(buffer[0] != 0)
|
---|
2014 | strcat(buffer, "/");
|
---|
2015 | sprintf(buffer+strlen(buffer), "D%d", first);
|
---|
2016 | if(run_length > 0)
|
---|
2017 | sprintf(buffer+strlen(buffer), "-D%d", first + run_length);
|
---|
2018 | }
|
---|
2019 | }
|
---|
2020 | for(i=0;i<8;i++)
|
---|
2021 | {
|
---|
2022 | if(data&(1<<(i+8)))
|
---|
2023 | {
|
---|
2024 | first = i;
|
---|
2025 | run_length = 0;
|
---|
2026 | while(i<7 && (data&(1<<(i+8+1))))
|
---|
2027 | {
|
---|
2028 | i++;
|
---|
2029 | run_length++;
|
---|
2030 | }
|
---|
2031 | if(buffer[0] != 0)
|
---|
2032 | strcat(buffer, "/");
|
---|
2033 | sprintf(buffer+strlen(buffer), "A%d", first);
|
---|
2034 | if(run_length > 0)
|
---|
2035 | sprintf(buffer+strlen(buffer), "-A%d", first + run_length);
|
---|
2036 | }
|
---|
2037 | }
|
---|
2038 | sprintf(g_dasm_str, "movem.l %s, %s", get_ea_mode_str_32(g_cpu_ir), buffer);
|
---|
2039 | }
|
---|
2040 |
|
---|
2041 | static void d68000_movem_re_16(void)
|
---|
2042 | {
|
---|
2043 | uint data = read_imm_16();
|
---|
2044 | char buffer[40];
|
---|
2045 | uint first;
|
---|
2046 | uint run_length;
|
---|
2047 | uint i;
|
---|
2048 |
|
---|
2049 | buffer[0] = 0;
|
---|
2050 | for(i=0;i<8;i++)
|
---|
2051 | {
|
---|
2052 | if(data&(1<<i))
|
---|
2053 | {
|
---|
2054 | first = i;
|
---|
2055 | run_length = 0;
|
---|
2056 | while(i<7 && (data&(1<<(i+1))))
|
---|
2057 | {
|
---|
2058 | i++;
|
---|
2059 | run_length++;
|
---|
2060 | }
|
---|
2061 | if(buffer[0] != 0)
|
---|
2062 | strcat(buffer, "/");
|
---|
2063 | sprintf(buffer+strlen(buffer), "D%d", first);
|
---|
2064 | if(run_length > 0)
|
---|
2065 | sprintf(buffer+strlen(buffer), "-D%d", first + run_length);
|
---|
2066 | }
|
---|
2067 | }
|
---|
2068 | for(i=0;i<8;i++)
|
---|
2069 | {
|
---|
2070 | if(data&(1<<(i+8)))
|
---|
2071 | {
|
---|
2072 | first = i;
|
---|
2073 | run_length = 0;
|
---|
2074 | while(i<7 && (data&(1<<(i+8+1))))
|
---|
2075 | {
|
---|
2076 | i++;
|
---|
2077 | run_length++;
|
---|
2078 | }
|
---|
2079 | if(buffer[0] != 0)
|
---|
2080 | strcat(buffer, "/");
|
---|
2081 | sprintf(buffer+strlen(buffer), "A%d", first);
|
---|
2082 | if(run_length > 0)
|
---|
2083 | sprintf(buffer+strlen(buffer), "-A%d", first + run_length);
|
---|
2084 | }
|
---|
2085 | }
|
---|
2086 | sprintf(g_dasm_str, "movem.w %s, %s", buffer, get_ea_mode_str_16(g_cpu_ir));
|
---|
2087 | }
|
---|
2088 |
|
---|
2089 | static void d68000_movem_re_32(void)
|
---|
2090 | {
|
---|
2091 | uint data = read_imm_16();
|
---|
2092 | char buffer[40];
|
---|
2093 | uint first;
|
---|
2094 | uint run_length;
|
---|
2095 | uint i;
|
---|
2096 |
|
---|
2097 | buffer[0] = 0;
|
---|
2098 | for(i=0;i<8;i++)
|
---|
2099 | {
|
---|
2100 | if(data&(1<<i))
|
---|
2101 | {
|
---|
2102 | first = i;
|
---|
2103 | run_length = 0;
|
---|
2104 | while(i<7 && (data&(1<<(i+1))))
|
---|
2105 | {
|
---|
2106 | i++;
|
---|
2107 | run_length++;
|
---|
2108 | }
|
---|
2109 | if(buffer[0] != 0)
|
---|
2110 | strcat(buffer, "/");
|
---|
2111 | sprintf(buffer+strlen(buffer), "D%d", first);
|
---|
2112 | if(run_length > 0)
|
---|
2113 | sprintf(buffer+strlen(buffer), "-D%d", first + run_length);
|
---|
2114 | }
|
---|
2115 | }
|
---|
2116 | for(i=0;i<8;i++)
|
---|
2117 | {
|
---|
2118 | if(data&(1<<(i+8)))
|
---|
2119 | {
|
---|
2120 | first = i;
|
---|
2121 | run_length = 0;
|
---|
2122 | while(i<7 && (data&(1<<(i+8+1))))
|
---|
2123 | {
|
---|
2124 | i++;
|
---|
2125 | run_length++;
|
---|
2126 | }
|
---|
2127 | if(buffer[0] != 0)
|
---|
2128 | strcat(buffer, "/");
|
---|
2129 | sprintf(buffer+strlen(buffer), "A%d", first);
|
---|
2130 | if(run_length > 0)
|
---|
2131 | sprintf(buffer+strlen(buffer), "-A%d", first + run_length);
|
---|
2132 | }
|
---|
2133 | }
|
---|
2134 | sprintf(g_dasm_str, "movem.l %s, %s", buffer, get_ea_mode_str_32(g_cpu_ir));
|
---|
2135 | }
|
---|
2136 |
|
---|
2137 | static void d68000_movep_re_16(void)
|
---|
2138 | {
|
---|
2139 | sprintf(g_dasm_str, "movep.w D%d, ($%x,A%d)", (g_cpu_ir>>9)&7, read_imm_16(), g_cpu_ir&7);
|
---|
2140 | }
|
---|
2141 |
|
---|
2142 | static void d68000_movep_re_32(void)
|
---|
2143 | {
|
---|
2144 | sprintf(g_dasm_str, "movep.l D%d, ($%x,A%d)", (g_cpu_ir>>9)&7, read_imm_16(), g_cpu_ir&7);
|
---|
2145 | }
|
---|
2146 |
|
---|
2147 | static void d68000_movep_er_16(void)
|
---|
2148 | {
|
---|
2149 | sprintf(g_dasm_str, "movep.w ($%x,A%d), D%d", read_imm_16(), g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2150 | }
|
---|
2151 |
|
---|
2152 | static void d68000_movep_er_32(void)
|
---|
2153 | {
|
---|
2154 | sprintf(g_dasm_str, "movep.l ($%x,A%d), D%d", read_imm_16(), g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2155 | }
|
---|
2156 |
|
---|
2157 | static void d68010_moves_8(void)
|
---|
2158 | {
|
---|
2159 | uint extension;
|
---|
2160 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
2161 | extension = read_imm_16();
|
---|
2162 | if(BIT_B(extension))
|
---|
2163 | sprintf(g_dasm_str, "moves.b %c%d, %s; (1+)", BIT_F(extension) ? 'A' : 'D', (extension>>12)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
2164 | else
|
---|
2165 | sprintf(g_dasm_str, "moves.b %s, %c%d; (1+)", get_ea_mode_str_8(g_cpu_ir), BIT_F(extension) ? 'A' : 'D', (extension>>12)&7);
|
---|
2166 | }
|
---|
2167 |
|
---|
2168 | static void d68010_moves_16(void)
|
---|
2169 | {
|
---|
2170 | uint extension;
|
---|
2171 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
2172 | extension = read_imm_16();
|
---|
2173 | if(BIT_B(extension))
|
---|
2174 | sprintf(g_dasm_str, "moves.w %c%d, %s; (1+)", BIT_F(extension) ? 'A' : 'D', (extension>>12)&7, get_ea_mode_str_16(g_cpu_ir));
|
---|
2175 | else
|
---|
2176 | sprintf(g_dasm_str, "moves.w %s, %c%d; (1+)", get_ea_mode_str_16(g_cpu_ir), BIT_F(extension) ? 'A' : 'D', (extension>>12)&7);
|
---|
2177 | }
|
---|
2178 |
|
---|
2179 | static void d68010_moves_32(void)
|
---|
2180 | {
|
---|
2181 | uint extension;
|
---|
2182 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
2183 | extension = read_imm_16();
|
---|
2184 | if(BIT_B(extension))
|
---|
2185 | sprintf(g_dasm_str, "moves.l %c%d, %s; (1+)", BIT_F(extension) ? 'A' : 'D', (extension>>12)&7, get_ea_mode_str_32(g_cpu_ir));
|
---|
2186 | else
|
---|
2187 | sprintf(g_dasm_str, "moves.l %s, %c%d; (1+)", get_ea_mode_str_32(g_cpu_ir), BIT_F(extension) ? 'A' : 'D', (extension>>12)&7);
|
---|
2188 | }
|
---|
2189 |
|
---|
2190 | static void d68000_moveq(void)
|
---|
2191 | {
|
---|
2192 | sprintf(g_dasm_str, "moveq #%s, D%d", make_signed_hex_str_8(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2193 | }
|
---|
2194 |
|
---|
2195 | static void d68040_move16_pi_pi(void)
|
---|
2196 | {
|
---|
2197 | LIMIT_CPU_TYPES(M68040_PLUS);
|
---|
2198 | sprintf(g_dasm_str, "move16 (A%d)+, (A%d)+; (4)", g_cpu_ir&7, (read_imm_16()>>12)&7);
|
---|
2199 | }
|
---|
2200 |
|
---|
2201 | static void d68040_move16_pi_al(void)
|
---|
2202 | {
|
---|
2203 | LIMIT_CPU_TYPES(M68040_PLUS);
|
---|
2204 | sprintf(g_dasm_str, "move16 (A%d)+, %s; (4)", g_cpu_ir&7, get_imm_str_u32());
|
---|
2205 | }
|
---|
2206 |
|
---|
2207 | static void d68040_move16_al_pi(void)
|
---|
2208 | {
|
---|
2209 | LIMIT_CPU_TYPES(M68040_PLUS);
|
---|
2210 | sprintf(g_dasm_str, "move16 %s, (A%d)+; (4)", get_imm_str_u32(), g_cpu_ir&7);
|
---|
2211 | }
|
---|
2212 |
|
---|
2213 | static void d68040_move16_ai_al(void)
|
---|
2214 | {
|
---|
2215 | LIMIT_CPU_TYPES(M68040_PLUS);
|
---|
2216 | sprintf(g_dasm_str, "move16 (A%d), %s; (4)", g_cpu_ir&7, get_imm_str_u32());
|
---|
2217 | }
|
---|
2218 |
|
---|
2219 | static void d68040_move16_al_ai(void)
|
---|
2220 | {
|
---|
2221 | LIMIT_CPU_TYPES(M68040_PLUS);
|
---|
2222 | sprintf(g_dasm_str, "move16 %s, (A%d); (4)", get_imm_str_u32(), g_cpu_ir&7);
|
---|
2223 | }
|
---|
2224 |
|
---|
2225 | static void d68000_muls(void)
|
---|
2226 | {
|
---|
2227 | sprintf(g_dasm_str, "muls.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2228 | }
|
---|
2229 |
|
---|
2230 | static void d68000_mulu(void)
|
---|
2231 | {
|
---|
2232 | sprintf(g_dasm_str, "mulu.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2233 | }
|
---|
2234 |
|
---|
2235 | static void d68020_mull(void)
|
---|
2236 | {
|
---|
2237 | uint extension;
|
---|
2238 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2239 | extension = read_imm_16();
|
---|
2240 |
|
---|
2241 | if(BIT_A(extension))
|
---|
2242 | sprintf(g_dasm_str, "mul%c.l %s, D%d:D%d; (2+)", BIT_B(extension) ? 's' : 'u', get_ea_mode_str_32(g_cpu_ir), extension&7, (extension>>12)&7);
|
---|
2243 | else
|
---|
2244 | sprintf(g_dasm_str, "mul%c.l %s, D%d; (2+)", BIT_B(extension) ? 's' : 'u', get_ea_mode_str_32(g_cpu_ir), (extension>>12)&7);
|
---|
2245 | }
|
---|
2246 |
|
---|
2247 | static void d68000_nbcd(void)
|
---|
2248 | {
|
---|
2249 | sprintf(g_dasm_str, "nbcd %s", get_ea_mode_str_8(g_cpu_ir));
|
---|
2250 | }
|
---|
2251 |
|
---|
2252 | static void d68000_neg_8(void)
|
---|
2253 | {
|
---|
2254 | sprintf(g_dasm_str, "neg.b %s", get_ea_mode_str_8(g_cpu_ir));
|
---|
2255 | }
|
---|
2256 |
|
---|
2257 | static void d68000_neg_16(void)
|
---|
2258 | {
|
---|
2259 | sprintf(g_dasm_str, "neg.w %s", get_ea_mode_str_16(g_cpu_ir));
|
---|
2260 | }
|
---|
2261 |
|
---|
2262 | static void d68000_neg_32(void)
|
---|
2263 | {
|
---|
2264 | sprintf(g_dasm_str, "neg.l %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
2265 | }
|
---|
2266 |
|
---|
2267 | static void d68000_negx_8(void)
|
---|
2268 | {
|
---|
2269 | sprintf(g_dasm_str, "negx.b %s", get_ea_mode_str_8(g_cpu_ir));
|
---|
2270 | }
|
---|
2271 |
|
---|
2272 | static void d68000_negx_16(void)
|
---|
2273 | {
|
---|
2274 | sprintf(g_dasm_str, "negx.w %s", get_ea_mode_str_16(g_cpu_ir));
|
---|
2275 | }
|
---|
2276 |
|
---|
2277 | static void d68000_negx_32(void)
|
---|
2278 | {
|
---|
2279 | sprintf(g_dasm_str, "negx.l %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
2280 | }
|
---|
2281 |
|
---|
2282 | static void d68000_nop(void)
|
---|
2283 | {
|
---|
2284 | sprintf(g_dasm_str, "nop");
|
---|
2285 | }
|
---|
2286 |
|
---|
2287 | static void d68000_not_8(void)
|
---|
2288 | {
|
---|
2289 | sprintf(g_dasm_str, "not.b %s", get_ea_mode_str_8(g_cpu_ir));
|
---|
2290 | }
|
---|
2291 |
|
---|
2292 | static void d68000_not_16(void)
|
---|
2293 | {
|
---|
2294 | sprintf(g_dasm_str, "not.w %s", get_ea_mode_str_16(g_cpu_ir));
|
---|
2295 | }
|
---|
2296 |
|
---|
2297 | static void d68000_not_32(void)
|
---|
2298 | {
|
---|
2299 | sprintf(g_dasm_str, "not.l %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
2300 | }
|
---|
2301 |
|
---|
2302 | static void d68000_or_er_8(void)
|
---|
2303 | {
|
---|
2304 | sprintf(g_dasm_str, "or.b %s, D%d", get_ea_mode_str_8(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2305 | }
|
---|
2306 |
|
---|
2307 | static void d68000_or_er_16(void)
|
---|
2308 | {
|
---|
2309 | sprintf(g_dasm_str, "or.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2310 | }
|
---|
2311 |
|
---|
2312 | static void d68000_or_er_32(void)
|
---|
2313 | {
|
---|
2314 | sprintf(g_dasm_str, "or.l %s, D%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2315 | }
|
---|
2316 |
|
---|
2317 | static void d68000_or_re_8(void)
|
---|
2318 | {
|
---|
2319 | sprintf(g_dasm_str, "or.b D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
2320 | }
|
---|
2321 |
|
---|
2322 | static void d68000_or_re_16(void)
|
---|
2323 | {
|
---|
2324 | sprintf(g_dasm_str, "or.w D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_16(g_cpu_ir));
|
---|
2325 | }
|
---|
2326 |
|
---|
2327 | static void d68000_or_re_32(void)
|
---|
2328 | {
|
---|
2329 | sprintf(g_dasm_str, "or.l D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_32(g_cpu_ir));
|
---|
2330 | }
|
---|
2331 |
|
---|
2332 | static void d68000_ori_8(void)
|
---|
2333 | {
|
---|
2334 | char* str = get_imm_str_u8();
|
---|
2335 | sprintf(g_dasm_str, "ori.b %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
2336 | }
|
---|
2337 |
|
---|
2338 | static void d68000_ori_16(void)
|
---|
2339 | {
|
---|
2340 | char* str = get_imm_str_u16();
|
---|
2341 | sprintf(g_dasm_str, "ori.w %s, %s", str, get_ea_mode_str_16(g_cpu_ir));
|
---|
2342 | }
|
---|
2343 |
|
---|
2344 | static void d68000_ori_32(void)
|
---|
2345 | {
|
---|
2346 | char* str = get_imm_str_u32();
|
---|
2347 | sprintf(g_dasm_str, "ori.l %s, %s", str, get_ea_mode_str_32(g_cpu_ir));
|
---|
2348 | }
|
---|
2349 |
|
---|
2350 | static void d68000_ori_to_ccr(void)
|
---|
2351 | {
|
---|
2352 | sprintf(g_dasm_str, "ori %s, CCR", get_imm_str_u8());
|
---|
2353 | }
|
---|
2354 |
|
---|
2355 | static void d68000_ori_to_sr(void)
|
---|
2356 | {
|
---|
2357 | sprintf(g_dasm_str, "ori %s, SR", get_imm_str_u16());
|
---|
2358 | }
|
---|
2359 |
|
---|
2360 | static void d68020_pack_rr(void)
|
---|
2361 | {
|
---|
2362 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2363 | sprintf(g_dasm_str, "pack D%d, D%d, %s; (2+)", g_cpu_ir&7, (g_cpu_ir>>9)&7, get_imm_str_u16());
|
---|
2364 | }
|
---|
2365 |
|
---|
2366 | static void d68020_pack_mm(void)
|
---|
2367 | {
|
---|
2368 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2369 | sprintf(g_dasm_str, "pack -(A%d), -(A%d), %s; (2+)", g_cpu_ir&7, (g_cpu_ir>>9)&7, get_imm_str_u16());
|
---|
2370 | }
|
---|
2371 |
|
---|
2372 | static void d68000_pea(void)
|
---|
2373 | {
|
---|
2374 | sprintf(g_dasm_str, "pea %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
2375 | }
|
---|
2376 |
|
---|
2377 | static void d68000_reset(void)
|
---|
2378 | {
|
---|
2379 | sprintf(g_dasm_str, "reset");
|
---|
2380 | }
|
---|
2381 |
|
---|
2382 | static void d68000_ror_s_8(void)
|
---|
2383 | {
|
---|
2384 | sprintf(g_dasm_str, "ror.b #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2385 | }
|
---|
2386 |
|
---|
2387 | static void d68000_ror_s_16(void)
|
---|
2388 | {
|
---|
2389 | sprintf(g_dasm_str, "ror.w #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7],g_cpu_ir&7);
|
---|
2390 | }
|
---|
2391 |
|
---|
2392 | static void d68000_ror_s_32(void)
|
---|
2393 | {
|
---|
2394 | sprintf(g_dasm_str, "ror.l #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2395 | }
|
---|
2396 |
|
---|
2397 | static void d68000_ror_r_8(void)
|
---|
2398 | {
|
---|
2399 | sprintf(g_dasm_str, "ror.b D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2400 | }
|
---|
2401 |
|
---|
2402 | static void d68000_ror_r_16(void)
|
---|
2403 | {
|
---|
2404 | sprintf(g_dasm_str, "ror.w D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2405 | }
|
---|
2406 |
|
---|
2407 | static void d68000_ror_r_32(void)
|
---|
2408 | {
|
---|
2409 | sprintf(g_dasm_str, "ror.l D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2410 | }
|
---|
2411 |
|
---|
2412 | static void d68000_ror_ea(void)
|
---|
2413 | {
|
---|
2414 | sprintf(g_dasm_str, "ror.w %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
2415 | }
|
---|
2416 |
|
---|
2417 | static void d68000_rol_s_8(void)
|
---|
2418 | {
|
---|
2419 | sprintf(g_dasm_str, "rol.b #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2420 | }
|
---|
2421 |
|
---|
2422 | static void d68000_rol_s_16(void)
|
---|
2423 | {
|
---|
2424 | sprintf(g_dasm_str, "rol.w #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2425 | }
|
---|
2426 |
|
---|
2427 | static void d68000_rol_s_32(void)
|
---|
2428 | {
|
---|
2429 | sprintf(g_dasm_str, "rol.l #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2430 | }
|
---|
2431 |
|
---|
2432 | static void d68000_rol_r_8(void)
|
---|
2433 | {
|
---|
2434 | sprintf(g_dasm_str, "rol.b D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2435 | }
|
---|
2436 |
|
---|
2437 | static void d68000_rol_r_16(void)
|
---|
2438 | {
|
---|
2439 | sprintf(g_dasm_str, "rol.w D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2440 | }
|
---|
2441 |
|
---|
2442 | static void d68000_rol_r_32(void)
|
---|
2443 | {
|
---|
2444 | sprintf(g_dasm_str, "rol.l D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2445 | }
|
---|
2446 |
|
---|
2447 | static void d68000_rol_ea(void)
|
---|
2448 | {
|
---|
2449 | sprintf(g_dasm_str, "rol.w %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
2450 | }
|
---|
2451 |
|
---|
2452 | static void d68000_roxr_s_8(void)
|
---|
2453 | {
|
---|
2454 | sprintf(g_dasm_str, "roxr.b #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2455 | }
|
---|
2456 |
|
---|
2457 | static void d68000_roxr_s_16(void)
|
---|
2458 | {
|
---|
2459 | sprintf(g_dasm_str, "roxr.w #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2460 | }
|
---|
2461 |
|
---|
2462 |
|
---|
2463 | static void d68000_roxr_s_32(void)
|
---|
2464 | {
|
---|
2465 | sprintf(g_dasm_str, "roxr.l #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2466 | }
|
---|
2467 |
|
---|
2468 | static void d68000_roxr_r_8(void)
|
---|
2469 | {
|
---|
2470 | sprintf(g_dasm_str, "roxr.b D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2471 | }
|
---|
2472 |
|
---|
2473 | static void d68000_roxr_r_16(void)
|
---|
2474 | {
|
---|
2475 | sprintf(g_dasm_str, "roxr.w D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2476 | }
|
---|
2477 |
|
---|
2478 | static void d68000_roxr_r_32(void)
|
---|
2479 | {
|
---|
2480 | sprintf(g_dasm_str, "roxr.l D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2481 | }
|
---|
2482 |
|
---|
2483 | static void d68000_roxr_ea(void)
|
---|
2484 | {
|
---|
2485 | sprintf(g_dasm_str, "roxr.w %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
2486 | }
|
---|
2487 |
|
---|
2488 | static void d68000_roxl_s_8(void)
|
---|
2489 | {
|
---|
2490 | sprintf(g_dasm_str, "roxl.b #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2491 | }
|
---|
2492 |
|
---|
2493 | static void d68000_roxl_s_16(void)
|
---|
2494 | {
|
---|
2495 | sprintf(g_dasm_str, "roxl.w #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2496 | }
|
---|
2497 |
|
---|
2498 | static void d68000_roxl_s_32(void)
|
---|
2499 | {
|
---|
2500 | sprintf(g_dasm_str, "roxl.l #%d, D%d", g_3bit_qdata_table[(g_cpu_ir>>9)&7], g_cpu_ir&7);
|
---|
2501 | }
|
---|
2502 |
|
---|
2503 | static void d68000_roxl_r_8(void)
|
---|
2504 | {
|
---|
2505 | sprintf(g_dasm_str, "roxl.b D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2506 | }
|
---|
2507 |
|
---|
2508 | static void d68000_roxl_r_16(void)
|
---|
2509 | {
|
---|
2510 | sprintf(g_dasm_str, "roxl.w D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2511 | }
|
---|
2512 |
|
---|
2513 | static void d68000_roxl_r_32(void)
|
---|
2514 | {
|
---|
2515 | sprintf(g_dasm_str, "roxl.l D%d, D%d", (g_cpu_ir>>9)&7, g_cpu_ir&7);
|
---|
2516 | }
|
---|
2517 |
|
---|
2518 | static void d68000_roxl_ea(void)
|
---|
2519 | {
|
---|
2520 | sprintf(g_dasm_str, "roxl.w %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
2521 | }
|
---|
2522 |
|
---|
2523 | static void d68010_rtd(void)
|
---|
2524 | {
|
---|
2525 | LIMIT_CPU_TYPES(M68010_PLUS);
|
---|
2526 | sprintf(g_dasm_str, "rtd %s; (1+)", get_imm_str_s16());
|
---|
2527 | }
|
---|
2528 |
|
---|
2529 | static void d68000_rte(void)
|
---|
2530 | {
|
---|
2531 | sprintf(g_dasm_str, "rte");
|
---|
2532 | }
|
---|
2533 |
|
---|
2534 | static void d68020_rtm(void)
|
---|
2535 | {
|
---|
2536 | LIMIT_CPU_TYPES(M68020_ONLY);
|
---|
2537 | sprintf(g_dasm_str, "rtm %c%d; (2+)", BIT_3(g_cpu_ir) ? 'A' : 'D', g_cpu_ir&7);
|
---|
2538 | }
|
---|
2539 |
|
---|
2540 | static void d68000_rtr(void)
|
---|
2541 | {
|
---|
2542 | sprintf(g_dasm_str, "rtr");
|
---|
2543 | }
|
---|
2544 |
|
---|
2545 | static void d68000_rts(void)
|
---|
2546 | {
|
---|
2547 | sprintf(g_dasm_str, "rts");
|
---|
2548 | }
|
---|
2549 |
|
---|
2550 | static void d68000_sbcd_rr(void)
|
---|
2551 | {
|
---|
2552 | sprintf(g_dasm_str, "sbcd D%d, D%d", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2553 | }
|
---|
2554 |
|
---|
2555 | static void d68000_sbcd_mm(void)
|
---|
2556 | {
|
---|
2557 | sprintf(g_dasm_str, "sbcd -(A%d), -(A%d)", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2558 | }
|
---|
2559 |
|
---|
2560 | static void d68000_scc(void)
|
---|
2561 | {
|
---|
2562 | sprintf(g_dasm_str, "s%-2s %s", g_cc[(g_cpu_ir>>8)&0xf], get_ea_mode_str_8(g_cpu_ir));
|
---|
2563 | }
|
---|
2564 |
|
---|
2565 | static void d68000_stop(void)
|
---|
2566 | {
|
---|
2567 | sprintf(g_dasm_str, "stop %s", get_imm_str_s16());
|
---|
2568 | }
|
---|
2569 |
|
---|
2570 | static void d68000_sub_er_8(void)
|
---|
2571 | {
|
---|
2572 | sprintf(g_dasm_str, "sub.b %s, D%d", get_ea_mode_str_8(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2573 | }
|
---|
2574 |
|
---|
2575 | static void d68000_sub_er_16(void)
|
---|
2576 | {
|
---|
2577 | sprintf(g_dasm_str, "sub.w %s, D%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2578 | }
|
---|
2579 |
|
---|
2580 | static void d68000_sub_er_32(void)
|
---|
2581 | {
|
---|
2582 | sprintf(g_dasm_str, "sub.l %s, D%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2583 | }
|
---|
2584 |
|
---|
2585 | static void d68000_sub_re_8(void)
|
---|
2586 | {
|
---|
2587 | sprintf(g_dasm_str, "sub.b D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_8(g_cpu_ir));
|
---|
2588 | }
|
---|
2589 |
|
---|
2590 | static void d68000_sub_re_16(void)
|
---|
2591 | {
|
---|
2592 | sprintf(g_dasm_str, "sub.w D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_16(g_cpu_ir));
|
---|
2593 | }
|
---|
2594 |
|
---|
2595 | static void d68000_sub_re_32(void)
|
---|
2596 | {
|
---|
2597 | sprintf(g_dasm_str, "sub.l D%d, %s", (g_cpu_ir>>9)&7, get_ea_mode_str_32(g_cpu_ir));
|
---|
2598 | }
|
---|
2599 |
|
---|
2600 | static void d68000_suba_16(void)
|
---|
2601 | {
|
---|
2602 | sprintf(g_dasm_str, "suba.w %s, A%d", get_ea_mode_str_16(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2603 | }
|
---|
2604 |
|
---|
2605 | static void d68000_suba_32(void)
|
---|
2606 | {
|
---|
2607 | sprintf(g_dasm_str, "suba.l %s, A%d", get_ea_mode_str_32(g_cpu_ir), (g_cpu_ir>>9)&7);
|
---|
2608 | }
|
---|
2609 |
|
---|
2610 | static void d68000_subi_8(void)
|
---|
2611 | {
|
---|
2612 | char* str = get_imm_str_s8();
|
---|
2613 | sprintf(g_dasm_str, "subi.b %s, %s", str, get_ea_mode_str_8(g_cpu_ir));
|
---|
2614 | }
|
---|
2615 |
|
---|
2616 | static void d68000_subi_16(void)
|
---|
2617 | {
|
---|
2618 | char* str = get_imm_str_s16();
|
---|
2619 | sprintf(g_dasm_str, "subi.w %s, %s", str, get_ea_mode_str_16(g_cpu_ir));
|
---|
2620 | }
|
---|
2621 |
|
---|
2622 | static void d68000_subi_32(void)
|
---|
2623 | {
|
---|
2624 | char* str = get_imm_str_s32();
|
---|
2625 | sprintf(g_dasm_str, "subi.l %s, %s", str, get_ea_mode_str_32(g_cpu_ir));
|
---|
2626 | }
|
---|
2627 |
|
---|
2628 | static void d68000_subq_8(void)
|
---|
2629 | {
|
---|
2630 | sprintf(g_dasm_str, "subq.b #%d, %s", g_3bit_qdata_table[(g_cpu_ir>>9)&7], get_ea_mode_str_8(g_cpu_ir));
|
---|
2631 | }
|
---|
2632 |
|
---|
2633 | static void d68000_subq_16(void)
|
---|
2634 | {
|
---|
2635 | sprintf(g_dasm_str, "subq.w #%d, %s", g_3bit_qdata_table[(g_cpu_ir>>9)&7], get_ea_mode_str_16(g_cpu_ir));
|
---|
2636 | }
|
---|
2637 |
|
---|
2638 | static void d68000_subq_32(void)
|
---|
2639 | {
|
---|
2640 | sprintf(g_dasm_str, "subq.l #%d, %s", g_3bit_qdata_table[(g_cpu_ir>>9)&7], get_ea_mode_str_32(g_cpu_ir));
|
---|
2641 | }
|
---|
2642 |
|
---|
2643 | static void d68000_subx_rr_8(void)
|
---|
2644 | {
|
---|
2645 | sprintf(g_dasm_str, "subx.b D%d, D%d", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2646 | }
|
---|
2647 |
|
---|
2648 | static void d68000_subx_rr_16(void)
|
---|
2649 | {
|
---|
2650 | sprintf(g_dasm_str, "subx.w D%d, D%d", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2651 | }
|
---|
2652 |
|
---|
2653 | static void d68000_subx_rr_32(void)
|
---|
2654 | {
|
---|
2655 | sprintf(g_dasm_str, "subx.l D%d, D%d", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2656 | }
|
---|
2657 |
|
---|
2658 | static void d68000_subx_mm_8(void)
|
---|
2659 | {
|
---|
2660 | sprintf(g_dasm_str, "subx.b -(A%d), -(A%d)", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2661 | }
|
---|
2662 |
|
---|
2663 | static void d68000_subx_mm_16(void)
|
---|
2664 | {
|
---|
2665 | sprintf(g_dasm_str, "subx.w -(A%d), -(A%d)", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2666 | }
|
---|
2667 |
|
---|
2668 | static void d68000_subx_mm_32(void)
|
---|
2669 | {
|
---|
2670 | sprintf(g_dasm_str, "subx.l -(A%d), -(A%d)", g_cpu_ir&7, (g_cpu_ir>>9)&7);
|
---|
2671 | }
|
---|
2672 |
|
---|
2673 | static void d68000_swap(void)
|
---|
2674 | {
|
---|
2675 | sprintf(g_dasm_str, "swap D%d", g_cpu_ir&7);
|
---|
2676 | }
|
---|
2677 |
|
---|
2678 | static void d68000_tas(void)
|
---|
2679 | {
|
---|
2680 | sprintf(g_dasm_str, "tas %s", get_ea_mode_str_8(g_cpu_ir));
|
---|
2681 | }
|
---|
2682 |
|
---|
2683 | static void d68000_trap(void)
|
---|
2684 | {
|
---|
2685 | sprintf(g_dasm_str, "trap #$%x", g_cpu_ir&0xf);
|
---|
2686 | }
|
---|
2687 |
|
---|
2688 | static void d68020_trapcc_0(void)
|
---|
2689 | {
|
---|
2690 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2691 | sprintf(g_dasm_str, "trap%-2s; (2+)", g_cc[(g_cpu_ir>>8)&0xf]);
|
---|
2692 | }
|
---|
2693 |
|
---|
2694 | static void d68020_trapcc_16(void)
|
---|
2695 | {
|
---|
2696 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2697 | sprintf(g_dasm_str, "trap%-2s %s; (2+)", g_cc[(g_cpu_ir>>8)&0xf], get_imm_str_u16());
|
---|
2698 | }
|
---|
2699 |
|
---|
2700 | static void d68020_trapcc_32(void)
|
---|
2701 | {
|
---|
2702 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2703 | sprintf(g_dasm_str, "trap%-2s %s; (2+)", g_cc[(g_cpu_ir>>8)&0xf], get_imm_str_u32());
|
---|
2704 | }
|
---|
2705 |
|
---|
2706 | static void d68000_trapv(void)
|
---|
2707 | {
|
---|
2708 | sprintf(g_dasm_str, "trapv");
|
---|
2709 | }
|
---|
2710 |
|
---|
2711 | static void d68000_tst_8(void)
|
---|
2712 | {
|
---|
2713 | sprintf(g_dasm_str, "tst.b %s", get_ea_mode_str_8(g_cpu_ir));
|
---|
2714 | }
|
---|
2715 |
|
---|
2716 | static void d68020_tst_pcdi_8(void)
|
---|
2717 | {
|
---|
2718 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2719 | sprintf(g_dasm_str, "tst.b %s; (2+)", get_ea_mode_str_8(g_cpu_ir));
|
---|
2720 | }
|
---|
2721 |
|
---|
2722 | static void d68020_tst_pcix_8(void)
|
---|
2723 | {
|
---|
2724 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2725 | sprintf(g_dasm_str, "tst.b %s; (2+)", get_ea_mode_str_8(g_cpu_ir));
|
---|
2726 | }
|
---|
2727 |
|
---|
2728 | static void d68020_tst_i_8(void)
|
---|
2729 | {
|
---|
2730 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2731 | sprintf(g_dasm_str, "tst.b %s; (2+)", get_ea_mode_str_8(g_cpu_ir));
|
---|
2732 | }
|
---|
2733 |
|
---|
2734 | static void d68000_tst_16(void)
|
---|
2735 | {
|
---|
2736 | sprintf(g_dasm_str, "tst.w %s", get_ea_mode_str_16(g_cpu_ir));
|
---|
2737 | }
|
---|
2738 |
|
---|
2739 | static void d68020_tst_a_16(void)
|
---|
2740 | {
|
---|
2741 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2742 | sprintf(g_dasm_str, "tst.w %s; (2+)", get_ea_mode_str_16(g_cpu_ir));
|
---|
2743 | }
|
---|
2744 |
|
---|
2745 | static void d68020_tst_pcdi_16(void)
|
---|
2746 | {
|
---|
2747 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2748 | sprintf(g_dasm_str, "tst.w %s; (2+)", get_ea_mode_str_16(g_cpu_ir));
|
---|
2749 | }
|
---|
2750 |
|
---|
2751 | static void d68020_tst_pcix_16(void)
|
---|
2752 | {
|
---|
2753 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2754 | sprintf(g_dasm_str, "tst.w %s; (2+)", get_ea_mode_str_16(g_cpu_ir));
|
---|
2755 | }
|
---|
2756 |
|
---|
2757 | static void d68020_tst_i_16(void)
|
---|
2758 | {
|
---|
2759 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2760 | sprintf(g_dasm_str, "tst.w %s; (2+)", get_ea_mode_str_16(g_cpu_ir));
|
---|
2761 | }
|
---|
2762 |
|
---|
2763 | static void d68000_tst_32(void)
|
---|
2764 | {
|
---|
2765 | sprintf(g_dasm_str, "tst.l %s", get_ea_mode_str_32(g_cpu_ir));
|
---|
2766 | }
|
---|
2767 |
|
---|
2768 | static void d68020_tst_a_32(void)
|
---|
2769 | {
|
---|
2770 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2771 | sprintf(g_dasm_str, "tst.l %s; (2+)", get_ea_mode_str_32(g_cpu_ir));
|
---|
2772 | }
|
---|
2773 |
|
---|
2774 | static void d68020_tst_pcdi_32(void)
|
---|
2775 | {
|
---|
2776 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2777 | sprintf(g_dasm_str, "tst.l %s; (2+)", get_ea_mode_str_32(g_cpu_ir));
|
---|
2778 | }
|
---|
2779 |
|
---|
2780 | static void d68020_tst_pcix_32(void)
|
---|
2781 | {
|
---|
2782 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2783 | sprintf(g_dasm_str, "tst.l %s; (2+)", get_ea_mode_str_32(g_cpu_ir));
|
---|
2784 | }
|
---|
2785 |
|
---|
2786 | static void d68020_tst_i_32(void)
|
---|
2787 | {
|
---|
2788 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2789 | sprintf(g_dasm_str, "tst.l %s; (2+)", get_ea_mode_str_32(g_cpu_ir));
|
---|
2790 | }
|
---|
2791 |
|
---|
2792 | static void d68000_unlk(void)
|
---|
2793 | {
|
---|
2794 | sprintf(g_dasm_str, "unlk A%d", g_cpu_ir&7);
|
---|
2795 | }
|
---|
2796 |
|
---|
2797 | static void d68020_unpk_rr(void)
|
---|
2798 | {
|
---|
2799 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2800 | sprintf(g_dasm_str, "unpk D%d, D%d, %s; (2+)", g_cpu_ir&7, (g_cpu_ir>>9)&7, get_imm_str_u16());
|
---|
2801 | }
|
---|
2802 |
|
---|
2803 | static void d68020_unpk_mm(void)
|
---|
2804 | {
|
---|
2805 | LIMIT_CPU_TYPES(M68020_PLUS);
|
---|
2806 | sprintf(g_dasm_str, "unpk -(A%d), -(A%d), %s; (2+)", g_cpu_ir&7, (g_cpu_ir>>9)&7, get_imm_str_u16());
|
---|
2807 | }
|
---|
2808 |
|
---|
2809 |
|
---|
2810 |
|
---|
2811 | /* ======================================================================== */
|
---|
2812 | /* ======================= INSTRUCTION TABLE BUILDER ====================== */
|
---|
2813 | /* ======================================================================== */
|
---|
2814 |
|
---|
2815 | /* EA Masks:
|
---|
2816 | 800 = data register direct
|
---|
2817 | 400 = address register direct
|
---|
2818 | 200 = address register indirect
|
---|
2819 | 100 = ARI postincrement
|
---|
2820 | 80 = ARI pre-decrement
|
---|
2821 | 40 = ARI displacement
|
---|
2822 | 20 = ARI index
|
---|
2823 | 10 = absolute short
|
---|
2824 | 8 = absolute long
|
---|
2825 | 4 = immediate / sr
|
---|
2826 | 2 = pc displacement
|
---|
2827 | 1 = pc idx
|
---|
2828 | */
|
---|
2829 |
|
---|
2830 | static opcode_struct g_opcode_info[] =
|
---|
2831 | {
|
---|
2832 | /* opcode handler mask match ea mask */
|
---|
2833 | {d68000_1010 , 0xf000, 0xa000, 0x000},
|
---|
2834 | {d68000_1111 , 0xf000, 0xf000, 0x000},
|
---|
2835 | {d68000_abcd_rr , 0xf1f8, 0xc100, 0x000},
|
---|
2836 | {d68000_abcd_mm , 0xf1f8, 0xc108, 0x000},
|
---|
2837 | {d68000_add_er_8 , 0xf1c0, 0xd000, 0xbff},
|
---|
2838 | {d68000_add_er_16 , 0xf1c0, 0xd040, 0xfff},
|
---|
2839 | {d68000_add_er_32 , 0xf1c0, 0xd080, 0xfff},
|
---|
2840 | {d68000_add_re_8 , 0xf1c0, 0xd100, 0x3f8},
|
---|
2841 | {d68000_add_re_16 , 0xf1c0, 0xd140, 0x3f8},
|
---|
2842 | {d68000_add_re_32 , 0xf1c0, 0xd180, 0x3f8},
|
---|
2843 | {d68000_adda_16 , 0xf1c0, 0xd0c0, 0xfff},
|
---|
2844 | {d68000_adda_32 , 0xf1c0, 0xd1c0, 0xfff},
|
---|
2845 | {d68000_addi_8 , 0xffc0, 0x0600, 0xbf8},
|
---|
2846 | {d68000_addi_16 , 0xffc0, 0x0640, 0xbf8},
|
---|
2847 | {d68000_addi_32 , 0xffc0, 0x0680, 0xbf8},
|
---|
2848 | {d68000_addq_8 , 0xf1c0, 0x5000, 0xbf8},
|
---|
2849 | {d68000_addq_16 , 0xf1c0, 0x5040, 0xff8},
|
---|
2850 | {d68000_addq_32 , 0xf1c0, 0x5080, 0xff8},
|
---|
2851 | {d68000_addx_rr_8 , 0xf1f8, 0xd100, 0x000},
|
---|
2852 | {d68000_addx_rr_16 , 0xf1f8, 0xd140, 0x000},
|
---|
2853 | {d68000_addx_rr_32 , 0xf1f8, 0xd180, 0x000},
|
---|
2854 | {d68000_addx_mm_8 , 0xf1f8, 0xd108, 0x000},
|
---|
2855 | {d68000_addx_mm_16 , 0xf1f8, 0xd148, 0x000},
|
---|
2856 | {d68000_addx_mm_32 , 0xf1f8, 0xd188, 0x000},
|
---|
2857 | {d68000_and_er_8 , 0xf1c0, 0xc000, 0xbff},
|
---|
2858 | {d68000_and_er_16 , 0xf1c0, 0xc040, 0xbff},
|
---|
2859 | {d68000_and_er_32 , 0xf1c0, 0xc080, 0xbff},
|
---|
2860 | {d68000_and_re_8 , 0xf1c0, 0xc100, 0x3f8},
|
---|
2861 | {d68000_and_re_16 , 0xf1c0, 0xc140, 0x3f8},
|
---|
2862 | {d68000_and_re_32 , 0xf1c0, 0xc180, 0x3f8},
|
---|
2863 | {d68000_andi_to_ccr , 0xffff, 0x023c, 0x000},
|
---|
2864 | {d68000_andi_to_sr , 0xffff, 0x027c, 0x000},
|
---|
2865 | {d68000_andi_8 , 0xffc0, 0x0200, 0xbf8},
|
---|
2866 | {d68000_andi_16 , 0xffc0, 0x0240, 0xbf8},
|
---|
2867 | {d68000_andi_32 , 0xffc0, 0x0280, 0xbf8},
|
---|
2868 | {d68000_asr_s_8 , 0xf1f8, 0xe000, 0x000},
|
---|
2869 | {d68000_asr_s_16 , 0xf1f8, 0xe040, 0x000},
|
---|
2870 | {d68000_asr_s_32 , 0xf1f8, 0xe080, 0x000},
|
---|
2871 | {d68000_asr_r_8 , 0xf1f8, 0xe020, 0x000},
|
---|
2872 | {d68000_asr_r_16 , 0xf1f8, 0xe060, 0x000},
|
---|
2873 | {d68000_asr_r_32 , 0xf1f8, 0xe0a0, 0x000},
|
---|
2874 | {d68000_asr_ea , 0xffc0, 0xe0c0, 0x3f8},
|
---|
2875 | {d68000_asl_s_8 , 0xf1f8, 0xe100, 0x000},
|
---|
2876 | {d68000_asl_s_16 , 0xf1f8, 0xe140, 0x000},
|
---|
2877 | {d68000_asl_s_32 , 0xf1f8, 0xe180, 0x000},
|
---|
2878 | {d68000_asl_r_8 , 0xf1f8, 0xe120, 0x000},
|
---|
2879 | {d68000_asl_r_16 , 0xf1f8, 0xe160, 0x000},
|
---|
2880 | {d68000_asl_r_32 , 0xf1f8, 0xe1a0, 0x000},
|
---|
2881 | {d68000_asl_ea , 0xffc0, 0xe1c0, 0x3f8},
|
---|
2882 | {d68000_bcc_8 , 0xf000, 0x6000, 0x000},
|
---|
2883 | {d68000_bcc_16 , 0xf0ff, 0x6000, 0x000},
|
---|
2884 | {d68020_bcc_32 , 0xf0ff, 0x60ff, 0x000},
|
---|
2885 | {d68000_bchg_r , 0xf1c0, 0x0140, 0xbf8},
|
---|
2886 | {d68000_bchg_s , 0xffc0, 0x0840, 0xbf8},
|
---|
2887 | {d68000_bclr_r , 0xf1c0, 0x0180, 0xbf8},
|
---|
2888 | {d68000_bclr_s , 0xffc0, 0x0880, 0xbf8},
|
---|
2889 | {d68020_bfchg , 0xffc0, 0xeac0, 0xa78},
|
---|
2890 | {d68020_bfclr , 0xffc0, 0xecc0, 0xa78},
|
---|
2891 | {d68020_bfexts , 0xffc0, 0xebc0, 0xa7b},
|
---|
2892 | {d68020_bfextu , 0xffc0, 0xe9c0, 0xa7b},
|
---|
2893 | {d68020_bfffo , 0xffc0, 0xedc0, 0xa7b},
|
---|
2894 | {d68020_bfins , 0xffc0, 0xefc0, 0xa78},
|
---|
2895 | {d68020_bfset , 0xffc0, 0xeec0, 0xa78},
|
---|
2896 | {d68020_bftst , 0xffc0, 0xe8c0, 0xa7b},
|
---|
2897 | {d68010_bkpt , 0xfff8, 0x4848, 0x000},
|
---|
2898 | {d68000_bra_8 , 0xff00, 0x6000, 0x000},
|
---|
2899 | {d68000_bra_16 , 0xffff, 0x6000, 0x000},
|
---|
2900 | {d68020_bra_32 , 0xffff, 0x60ff, 0x000},
|
---|
2901 | {d68000_bset_r , 0xf1c0, 0x01c0, 0xbf8},
|
---|
2902 | {d68000_bset_s , 0xffc0, 0x08c0, 0xbf8},
|
---|
2903 | {d68000_bsr_8 , 0xff00, 0x6100, 0x000},
|
---|
2904 | {d68000_bsr_16 , 0xffff, 0x6100, 0x000},
|
---|
2905 | {d68020_bsr_32 , 0xffff, 0x61ff, 0x000},
|
---|
2906 | {d68000_btst_r , 0xf1c0, 0x0100, 0xbff},
|
---|
2907 | {d68000_btst_s , 0xffc0, 0x0800, 0xbfb},
|
---|
2908 | {d68020_callm , 0xffc0, 0x06c0, 0x27b},
|
---|
2909 | {d68020_cas_8 , 0xffc0, 0x0ac0, 0x3f8},
|
---|
2910 | {d68020_cas_16 , 0xffc0, 0x0cc0, 0x3f8},
|
---|
2911 | {d68020_cas_32 , 0xffc0, 0x0ec0, 0x3f8},
|
---|
2912 | {d68020_cas2_16 , 0xffff, 0x0cfc, 0x000},
|
---|
2913 | {d68020_cas2_32 , 0xffff, 0x0efc, 0x000},
|
---|
2914 | {d68000_chk_16 , 0xf1c0, 0x4180, 0xbff},
|
---|
2915 | {d68020_chk_32 , 0xf1c0, 0x4100, 0xbff},
|
---|
2916 | {d68020_chk2_cmp2_8 , 0xffc0, 0x00c0, 0x27b},
|
---|
2917 | {d68020_chk2_cmp2_16 , 0xffc0, 0x02c0, 0x27b},
|
---|
2918 | {d68020_chk2_cmp2_32 , 0xffc0, 0x04c0, 0x27b},
|
---|
2919 | {d68040_cinv , 0xff20, 0xf400, 0x000},
|
---|
2920 | {d68000_clr_8 , 0xffc0, 0x4200, 0xbf8},
|
---|
2921 | {d68000_clr_16 , 0xffc0, 0x4240, 0xbf8},
|
---|
2922 | {d68000_clr_32 , 0xffc0, 0x4280, 0xbf8},
|
---|
2923 | {d68000_cmp_8 , 0xf1c0, 0xb000, 0xbff},
|
---|
2924 | {d68000_cmp_16 , 0xf1c0, 0xb040, 0xfff},
|
---|
2925 | {d68000_cmp_32 , 0xf1c0, 0xb080, 0xfff},
|
---|
2926 | {d68000_cmpa_16 , 0xf1c0, 0xb0c0, 0xfff},
|
---|
2927 | {d68000_cmpa_32 , 0xf1c0, 0xb1c0, 0xfff},
|
---|
2928 | {d68000_cmpi_8 , 0xffc0, 0x0c00, 0xbf8},
|
---|
2929 | {d68020_cmpi_pcdi_8 , 0xffff, 0x0c3a, 0x000},
|
---|
2930 | {d68020_cmpi_pcix_8 , 0xffff, 0x0c3b, 0x000},
|
---|
2931 | {d68000_cmpi_16 , 0xffc0, 0x0c40, 0xbf8},
|
---|
2932 | {d68020_cmpi_pcdi_16 , 0xffff, 0x0c7a, 0x000},
|
---|
2933 | {d68020_cmpi_pcix_16 , 0xffff, 0x0c7b, 0x000},
|
---|
2934 | {d68000_cmpi_32 , 0xffc0, 0x0c80, 0xbf8},
|
---|
2935 | {d68020_cmpi_pcdi_32 , 0xffff, 0x0cba, 0x000},
|
---|
2936 | {d68020_cmpi_pcix_32 , 0xffff, 0x0cbb, 0x000},
|
---|
2937 | {d68000_cmpm_8 , 0xf1f8, 0xb108, 0x000},
|
---|
2938 | {d68000_cmpm_16 , 0xf1f8, 0xb148, 0x000},
|
---|
2939 | {d68000_cmpm_32 , 0xf1f8, 0xb188, 0x000},
|
---|
2940 | {d68020_cpbcc_16 , 0xf1c0, 0xf080, 0x000},
|
---|
2941 | {d68020_cpbcc_32 , 0xf1c0, 0xf0c0, 0x000},
|
---|
2942 | {d68020_cpdbcc , 0xf1f8, 0xf048, 0x000},
|
---|
2943 | {d68020_cpgen , 0xf1c0, 0xf000, 0x000},
|
---|
2944 | {d68020_cprestore , 0xf1c0, 0xf140, 0x37f},
|
---|
2945 | {d68020_cpsave , 0xf1c0, 0xf100, 0x2f8},
|
---|
2946 | {d68020_cpscc , 0xf1c0, 0xf040, 0xbf8},
|
---|
2947 | {d68020_cptrapcc_0 , 0xf1ff, 0xf07c, 0x000},
|
---|
2948 | {d68020_cptrapcc_16 , 0xf1ff, 0xf07a, 0x000},
|
---|
2949 | {d68020_cptrapcc_32 , 0xf1ff, 0xf07b, 0x000},
|
---|
2950 | {d68040_cpush , 0xff20, 0xf420, 0x000},
|
---|
2951 | {d68000_dbcc , 0xf0f8, 0x50c8, 0x000},
|
---|
2952 | {d68000_dbra , 0xfff8, 0x51c8, 0x000},
|
---|
2953 | {d68000_divs , 0xf1c0, 0x81c0, 0xbff},
|
---|
2954 | {d68000_divu , 0xf1c0, 0x80c0, 0xbff},
|
---|
2955 | {d68020_divl , 0xffc0, 0x4c40, 0xbff},
|
---|
2956 | {d68000_eor_8 , 0xf1c0, 0xb100, 0xbf8},
|
---|
2957 | {d68000_eor_16 , 0xf1c0, 0xb140, 0xbf8},
|
---|
2958 | {d68000_eor_32 , 0xf1c0, 0xb180, 0xbf8},
|
---|
2959 | {d68000_eori_to_ccr , 0xffff, 0x0a3c, 0x000},
|
---|
2960 | {d68000_eori_to_sr , 0xffff, 0x0a7c, 0x000},
|
---|
2961 | {d68000_eori_8 , 0xffc0, 0x0a00, 0xbf8},
|
---|
2962 | {d68000_eori_16 , 0xffc0, 0x0a40, 0xbf8},
|
---|
2963 | {d68000_eori_32 , 0xffc0, 0x0a80, 0xbf8},
|
---|
2964 | {d68000_exg_dd , 0xf1f8, 0xc140, 0x000},
|
---|
2965 | {d68000_exg_aa , 0xf1f8, 0xc148, 0x000},
|
---|
2966 | {d68000_exg_da , 0xf1f8, 0xc188, 0x000},
|
---|
2967 | {d68020_extb_32 , 0xfff8, 0x49c0, 0x000},
|
---|
2968 | {d68000_ext_16 , 0xfff8, 0x4880, 0x000},
|
---|
2969 | {d68000_ext_32 , 0xfff8, 0x48c0, 0x000},
|
---|
2970 | {d68000_illegal , 0xffff, 0x4afc, 0x000},
|
---|
2971 | {d68000_jmp , 0xffc0, 0x4ec0, 0x27b},
|
---|
2972 | {d68000_jsr , 0xffc0, 0x4e80, 0x27b},
|
---|
2973 | {d68000_lea , 0xf1c0, 0x41c0, 0x27b},
|
---|
2974 | {d68000_link_16 , 0xfff8, 0x4e50, 0x000},
|
---|
2975 | {d68020_link_32 , 0xfff8, 0x4808, 0x000},
|
---|
2976 | {d68000_lsr_s_8 , 0xf1f8, 0xe008, 0x000},
|
---|
2977 | {d68000_lsr_s_16 , 0xf1f8, 0xe048, 0x000},
|
---|
2978 | {d68000_lsr_s_32 , 0xf1f8, 0xe088, 0x000},
|
---|
2979 | {d68000_lsr_r_8 , 0xf1f8, 0xe028, 0x000},
|
---|
2980 | {d68000_lsr_r_16 , 0xf1f8, 0xe068, 0x000},
|
---|
2981 | {d68000_lsr_r_32 , 0xf1f8, 0xe0a8, 0x000},
|
---|
2982 | {d68000_lsr_ea , 0xffc0, 0xe2c0, 0x3f8},
|
---|
2983 | {d68000_lsl_s_8 , 0xf1f8, 0xe108, 0x000},
|
---|
2984 | {d68000_lsl_s_16 , 0xf1f8, 0xe148, 0x000},
|
---|
2985 | {d68000_lsl_s_32 , 0xf1f8, 0xe188, 0x000},
|
---|
2986 | {d68000_lsl_r_8 , 0xf1f8, 0xe128, 0x000},
|
---|
2987 | {d68000_lsl_r_16 , 0xf1f8, 0xe168, 0x000},
|
---|
2988 | {d68000_lsl_r_32 , 0xf1f8, 0xe1a8, 0x000},
|
---|
2989 | {d68000_lsl_ea , 0xffc0, 0xe3c0, 0x3f8},
|
---|
2990 | {d68000_move_8 , 0xf000, 0x1000, 0xbff},
|
---|
2991 | {d68000_move_16 , 0xf000, 0x3000, 0xfff},
|
---|
2992 | {d68000_move_32 , 0xf000, 0x2000, 0xfff},
|
---|
2993 | {d68000_movea_16 , 0xf1c0, 0x3040, 0xfff},
|
---|
2994 | {d68000_movea_32 , 0xf1c0, 0x2040, 0xfff},
|
---|
2995 | {d68000_move_to_ccr , 0xffc0, 0x44c0, 0xbff},
|
---|
2996 | {d68010_move_fr_ccr , 0xffc0, 0x42c0, 0xbf8},
|
---|
2997 | {d68000_move_to_sr , 0xffc0, 0x46c0, 0xbff},
|
---|
2998 | {d68000_move_fr_sr , 0xffc0, 0x40c0, 0xbf8},
|
---|
2999 | {d68000_move_to_usp , 0xfff8, 0x4e60, 0x000},
|
---|
3000 | {d68000_move_fr_usp , 0xfff8, 0x4e68, 0x000},
|
---|
3001 | {d68010_movec , 0xfffe, 0x4e7a, 0x000},
|
---|
3002 | {d68000_movem_pd_16 , 0xfff8, 0x48a0, 0x000},
|
---|
3003 | {d68000_movem_pd_32 , 0xfff8, 0x48e0, 0x000},
|
---|
3004 | {d68000_movem_re_16 , 0xffc0, 0x4880, 0x2f8},
|
---|
3005 | {d68000_movem_re_32 , 0xffc0, 0x48c0, 0x2f8},
|
---|
3006 | {d68000_movem_er_16 , 0xffc0, 0x4c80, 0x37b},
|
---|
3007 | {d68000_movem_er_32 , 0xffc0, 0x4cc0, 0x37b},
|
---|
3008 | {d68000_movep_er_16 , 0xf1f8, 0x0108, 0x000},
|
---|
3009 | {d68000_movep_er_32 , 0xf1f8, 0x0148, 0x000},
|
---|
3010 | {d68000_movep_re_16 , 0xf1f8, 0x0188, 0x000},
|
---|
3011 | {d68000_movep_re_32 , 0xf1f8, 0x01c8, 0x000},
|
---|
3012 | {d68010_moves_8 , 0xffc0, 0x0e00, 0x3f8},
|
---|
3013 | {d68010_moves_16 , 0xffc0, 0x0e40, 0x3f8},
|
---|
3014 | {d68010_moves_32 , 0xffc0, 0x0e80, 0x3f8},
|
---|
3015 | {d68000_moveq , 0xf100, 0x7000, 0x000},
|
---|
3016 | {d68040_move16_pi_pi , 0xfff8, 0xf620, 0x000},
|
---|
3017 | {d68040_move16_pi_al , 0xfff8, 0xf600, 0x000},
|
---|
3018 | {d68040_move16_al_pi , 0xfff8, 0xf608, 0x000},
|
---|
3019 | {d68040_move16_ai_al , 0xfff8, 0xf610, 0x000},
|
---|
3020 | {d68040_move16_al_ai , 0xfff8, 0xf618, 0x000},
|
---|
3021 | {d68000_muls , 0xf1c0, 0xc1c0, 0xbff},
|
---|
3022 | {d68000_mulu , 0xf1c0, 0xc0c0, 0xbff},
|
---|
3023 | {d68020_mull , 0xffc0, 0x4c00, 0xbff},
|
---|
3024 | {d68000_nbcd , 0xffc0, 0x4800, 0xbf8},
|
---|
3025 | {d68000_neg_8 , 0xffc0, 0x4400, 0xbf8},
|
---|
3026 | {d68000_neg_16 , 0xffc0, 0x4440, 0xbf8},
|
---|
3027 | {d68000_neg_32 , 0xffc0, 0x4480, 0xbf8},
|
---|
3028 | {d68000_negx_8 , 0xffc0, 0x4000, 0xbf8},
|
---|
3029 | {d68000_negx_16 , 0xffc0, 0x4040, 0xbf8},
|
---|
3030 | {d68000_negx_32 , 0xffc0, 0x4080, 0xbf8},
|
---|
3031 | {d68000_nop , 0xffff, 0x4e71, 0x000},
|
---|
3032 | {d68000_not_8 , 0xffc0, 0x4600, 0xbf8},
|
---|
3033 | {d68000_not_16 , 0xffc0, 0x4640, 0xbf8},
|
---|
3034 | {d68000_not_32 , 0xffc0, 0x4680, 0xbf8},
|
---|
3035 | {d68000_or_er_8 , 0xf1c0, 0x8000, 0xbff},
|
---|
3036 | {d68000_or_er_16 , 0xf1c0, 0x8040, 0xbff},
|
---|
3037 | {d68000_or_er_32 , 0xf1c0, 0x8080, 0xbff},
|
---|
3038 | {d68000_or_re_8 , 0xf1c0, 0x8100, 0x3f8},
|
---|
3039 | {d68000_or_re_16 , 0xf1c0, 0x8140, 0x3f8},
|
---|
3040 | {d68000_or_re_32 , 0xf1c0, 0x8180, 0x3f8},
|
---|
3041 | {d68000_ori_to_ccr , 0xffff, 0x003c, 0x000},
|
---|
3042 | {d68000_ori_to_sr , 0xffff, 0x007c, 0x000},
|
---|
3043 | {d68000_ori_8 , 0xffc0, 0x0000, 0xbf8},
|
---|
3044 | {d68000_ori_16 , 0xffc0, 0x0040, 0xbf8},
|
---|
3045 | {d68000_ori_32 , 0xffc0, 0x0080, 0xbf8},
|
---|
3046 | {d68020_pack_rr , 0xf1f8, 0x8140, 0x000},
|
---|
3047 | {d68020_pack_mm , 0xf1f8, 0x8148, 0x000},
|
---|
3048 | {d68000_pea , 0xffc0, 0x4840, 0x27b},
|
---|
3049 | {d68000_reset , 0xffff, 0x4e70, 0x000},
|
---|
3050 | {d68000_ror_s_8 , 0xf1f8, 0xe018, 0x000},
|
---|
3051 | {d68000_ror_s_16 , 0xf1f8, 0xe058, 0x000},
|
---|
3052 | {d68000_ror_s_32 , 0xf1f8, 0xe098, 0x000},
|
---|
3053 | {d68000_ror_r_8 , 0xf1f8, 0xe038, 0x000},
|
---|
3054 | {d68000_ror_r_16 , 0xf1f8, 0xe078, 0x000},
|
---|
3055 | {d68000_ror_r_32 , 0xf1f8, 0xe0b8, 0x000},
|
---|
3056 | {d68000_ror_ea , 0xffc0, 0xe6c0, 0x3f8},
|
---|
3057 | {d68000_rol_s_8 , 0xf1f8, 0xe118, 0x000},
|
---|
3058 | {d68000_rol_s_16 , 0xf1f8, 0xe158, 0x000},
|
---|
3059 | {d68000_rol_s_32 , 0xf1f8, 0xe198, 0x000},
|
---|
3060 | {d68000_rol_r_8 , 0xf1f8, 0xe138, 0x000},
|
---|
3061 | {d68000_rol_r_16 , 0xf1f8, 0xe178, 0x000},
|
---|
3062 | {d68000_rol_r_32 , 0xf1f8, 0xe1b8, 0x000},
|
---|
3063 | {d68000_rol_ea , 0xffc0, 0xe7c0, 0x3f8},
|
---|
3064 | {d68000_roxr_s_8 , 0xf1f8, 0xe010, 0x000},
|
---|
3065 | {d68000_roxr_s_16 , 0xf1f8, 0xe050, 0x000},
|
---|
3066 | {d68000_roxr_s_32 , 0xf1f8, 0xe090, 0x000},
|
---|
3067 | {d68000_roxr_r_8 , 0xf1f8, 0xe030, 0x000},
|
---|
3068 | {d68000_roxr_r_16 , 0xf1f8, 0xe070, 0x000},
|
---|
3069 | {d68000_roxr_r_32 , 0xf1f8, 0xe0b0, 0x000},
|
---|
3070 | {d68000_roxr_ea , 0xffc0, 0xe4c0, 0x3f8},
|
---|
3071 | {d68000_roxl_s_8 , 0xf1f8, 0xe110, 0x000},
|
---|
3072 | {d68000_roxl_s_16 , 0xf1f8, 0xe150, 0x000},
|
---|
3073 | {d68000_roxl_s_32 , 0xf1f8, 0xe190, 0x000},
|
---|
3074 | {d68000_roxl_r_8 , 0xf1f8, 0xe130, 0x000},
|
---|
3075 | {d68000_roxl_r_16 , 0xf1f8, 0xe170, 0x000},
|
---|
3076 | {d68000_roxl_r_32 , 0xf1f8, 0xe1b0, 0x000},
|
---|
3077 | {d68000_roxl_ea , 0xffc0, 0xe5c0, 0x3f8},
|
---|
3078 | {d68010_rtd , 0xffff, 0x4e74, 0x000},
|
---|
3079 | {d68000_rte , 0xffff, 0x4e73, 0x000},
|
---|
3080 | {d68020_rtm , 0xfff0, 0x06c0, 0x000},
|
---|
3081 | {d68000_rtr , 0xffff, 0x4e77, 0x000},
|
---|
3082 | {d68000_rts , 0xffff, 0x4e75, 0x000},
|
---|
3083 | {d68000_sbcd_rr , 0xf1f8, 0x8100, 0x000},
|
---|
3084 | {d68000_sbcd_mm , 0xf1f8, 0x8108, 0x000},
|
---|
3085 | {d68000_scc , 0xf0c0, 0x50c0, 0xbf8},
|
---|
3086 | {d68000_stop , 0xffff, 0x4e72, 0x000},
|
---|
3087 | {d68000_sub_er_8 , 0xf1c0, 0x9000, 0xbff},
|
---|
3088 | {d68000_sub_er_16 , 0xf1c0, 0x9040, 0xfff},
|
---|
3089 | {d68000_sub_er_32 , 0xf1c0, 0x9080, 0xfff},
|
---|
3090 | {d68000_sub_re_8 , 0xf1c0, 0x9100, 0x3f8},
|
---|
3091 | {d68000_sub_re_16 , 0xf1c0, 0x9140, 0x3f8},
|
---|
3092 | {d68000_sub_re_32 , 0xf1c0, 0x9180, 0x3f8},
|
---|
3093 | {d68000_suba_16 , 0xf1c0, 0x90c0, 0xfff},
|
---|
3094 | {d68000_suba_32 , 0xf1c0, 0x91c0, 0xfff},
|
---|
3095 | {d68000_subi_8 , 0xffc0, 0x0400, 0xbf8},
|
---|
3096 | {d68000_subi_16 , 0xffc0, 0x0440, 0xbf8},
|
---|
3097 | {d68000_subi_32 , 0xffc0, 0x0480, 0xbf8},
|
---|
3098 | {d68000_subq_8 , 0xf1c0, 0x5100, 0xbf8},
|
---|
3099 | {d68000_subq_16 , 0xf1c0, 0x5140, 0xff8},
|
---|
3100 | {d68000_subq_32 , 0xf1c0, 0x5180, 0xff8},
|
---|
3101 | {d68000_subx_rr_8 , 0xf1f8, 0x9100, 0x000},
|
---|
3102 | {d68000_subx_rr_16 , 0xf1f8, 0x9140, 0x000},
|
---|
3103 | {d68000_subx_rr_32 , 0xf1f8, 0x9180, 0x000},
|
---|
3104 | {d68000_subx_mm_8 , 0xf1f8, 0x9108, 0x000},
|
---|
3105 | {d68000_subx_mm_16 , 0xf1f8, 0x9148, 0x000},
|
---|
3106 | {d68000_subx_mm_32 , 0xf1f8, 0x9188, 0x000},
|
---|
3107 | {d68000_swap , 0xfff8, 0x4840, 0x000},
|
---|
3108 | {d68000_tas , 0xffc0, 0x4ac0, 0xbf8},
|
---|
3109 | {d68000_trap , 0xfff0, 0x4e40, 0x000},
|
---|
3110 | {d68020_trapcc_0 , 0xf0ff, 0x50fc, 0x000},
|
---|
3111 | {d68020_trapcc_16 , 0xf0ff, 0x50fa, 0x000},
|
---|
3112 | {d68020_trapcc_32 , 0xf0ff, 0x50fb, 0x000},
|
---|
3113 | {d68000_trapv , 0xffff, 0x4e76, 0x000},
|
---|
3114 | {d68000_tst_8 , 0xffc0, 0x4a00, 0xbf8},
|
---|
3115 | {d68020_tst_pcdi_8 , 0xffff, 0x4a3a, 0x000},
|
---|
3116 | {d68020_tst_pcix_8 , 0xffff, 0x4a3b, 0x000},
|
---|
3117 | {d68020_tst_i_8 , 0xffff, 0x4a3c, 0x000},
|
---|
3118 | {d68000_tst_16 , 0xffc0, 0x4a40, 0xbf8},
|
---|
3119 | {d68020_tst_a_16 , 0xfff8, 0x4a48, 0x000},
|
---|
3120 | {d68020_tst_pcdi_16 , 0xffff, 0x4a7a, 0x000},
|
---|
3121 | {d68020_tst_pcix_16 , 0xffff, 0x4a7b, 0x000},
|
---|
3122 | {d68020_tst_i_16 , 0xffff, 0x4a7c, 0x000},
|
---|
3123 | {d68000_tst_32 , 0xffc0, 0x4a80, 0xbf8},
|
---|
3124 | {d68020_tst_a_32 , 0xfff8, 0x4a88, 0x000},
|
---|
3125 | {d68020_tst_pcdi_32 , 0xffff, 0x4aba, 0x000},
|
---|
3126 | {d68020_tst_pcix_32 , 0xffff, 0x4abb, 0x000},
|
---|
3127 | {d68020_tst_i_32 , 0xffff, 0x4abc, 0x000},
|
---|
3128 | {d68000_unlk , 0xfff8, 0x4e58, 0x000},
|
---|
3129 | {d68020_unpk_rr , 0xf1f8, 0x8180, 0x000},
|
---|
3130 | {d68020_unpk_mm , 0xf1f8, 0x8188, 0x000},
|
---|
3131 | {0, 0, 0, 0}
|
---|
3132 | };
|
---|
3133 |
|
---|
3134 | /* Check if opcode is using a valid ea mode */
|
---|
3135 | static int valid_ea(uint opcode, uint mask)
|
---|
3136 | {
|
---|
3137 | if(mask == 0)
|
---|
3138 | return 1;
|
---|
3139 |
|
---|
3140 | switch(opcode & 0x3f)
|
---|
3141 | {
|
---|
3142 | case 0x00: case 0x01: case 0x02: case 0x03:
|
---|
3143 | case 0x04: case 0x05: case 0x06: case 0x07:
|
---|
3144 | return (mask & 0x800) != 0;
|
---|
3145 | case 0x08: case 0x09: case 0x0a: case 0x0b:
|
---|
3146 | case 0x0c: case 0x0d: case 0x0e: case 0x0f:
|
---|
3147 | return (mask & 0x400) != 0;
|
---|
3148 | case 0x10: case 0x11: case 0x12: case 0x13:
|
---|
3149 | case 0x14: case 0x15: case 0x16: case 0x17:
|
---|
3150 | return (mask & 0x200) != 0;
|
---|
3151 | case 0x18: case 0x19: case 0x1a: case 0x1b:
|
---|
3152 | case 0x1c: case 0x1d: case 0x1e: case 0x1f:
|
---|
3153 | return (mask & 0x100) != 0;
|
---|
3154 | case 0x20: case 0x21: case 0x22: case 0x23:
|
---|
3155 | case 0x24: case 0x25: case 0x26: case 0x27:
|
---|
3156 | return (mask & 0x080) != 0;
|
---|
3157 | case 0x28: case 0x29: case 0x2a: case 0x2b:
|
---|
3158 | case 0x2c: case 0x2d: case 0x2e: case 0x2f:
|
---|
3159 | return (mask & 0x040) != 0;
|
---|
3160 | case 0x30: case 0x31: case 0x32: case 0x33:
|
---|
3161 | case 0x34: case 0x35: case 0x36: case 0x37:
|
---|
3162 | return (mask & 0x020) != 0;
|
---|
3163 | case 0x38:
|
---|
3164 | return (mask & 0x010) != 0;
|
---|
3165 | case 0x39:
|
---|
3166 | return (mask & 0x008) != 0;
|
---|
3167 | case 0x3a:
|
---|
3168 | return (mask & 0x002) != 0;
|
---|
3169 | case 0x3b:
|
---|
3170 | return (mask & 0x001) != 0;
|
---|
3171 | case 0x3c:
|
---|
3172 | return (mask & 0x004) != 0;
|
---|
3173 | }
|
---|
3174 | return 0;
|
---|
3175 |
|
---|
3176 | }
|
---|
3177 |
|
---|
3178 | /* Used by qsort */
|
---|
3179 | static int DECL_SPEC compare_nof_true_bits(const void *aptr, const void *bptr)
|
---|
3180 | {
|
---|
3181 | uint a = ((const opcode_struct*)aptr)->mask;
|
---|
3182 | uint b = ((const opcode_struct*)bptr)->mask;
|
---|
3183 |
|
---|
3184 | a = ((a & 0xAAAA) >> 1) + (a & 0x5555);
|
---|
3185 | a = ((a & 0xCCCC) >> 2) + (a & 0x3333);
|
---|
3186 | a = ((a & 0xF0F0) >> 4) + (a & 0x0F0F);
|
---|
3187 | a = ((a & 0xFF00) >> 8) + (a & 0x00FF);
|
---|
3188 |
|
---|
3189 | b = ((b & 0xAAAA) >> 1) + (b & 0x5555);
|
---|
3190 | b = ((b & 0xCCCC) >> 2) + (b & 0x3333);
|
---|
3191 | b = ((b & 0xF0F0) >> 4) + (b & 0x0F0F);
|
---|
3192 | b = ((b & 0xFF00) >> 8) + (b & 0x00FF);
|
---|
3193 |
|
---|
3194 | return b - a; /* reversed to get greatest to least sorting */
|
---|
3195 | }
|
---|
3196 |
|
---|
3197 | /* build the opcode handler jump table */
|
---|
3198 | static void build_opcode_table(void)
|
---|
3199 | {
|
---|
3200 | uint i;
|
---|
3201 | uint opcode;
|
---|
3202 | opcode_struct* ostruct;
|
---|
3203 | uint opcode_info_length = 0;
|
---|
3204 |
|
---|
3205 | for(ostruct = g_opcode_info;ostruct->opcode_handler != 0;ostruct++)
|
---|
3206 | opcode_info_length++;
|
---|
3207 |
|
---|
3208 | qsort((void *)g_opcode_info, opcode_info_length, sizeof(g_opcode_info[0]), compare_nof_true_bits);
|
---|
3209 |
|
---|
3210 | for(i=0;i<0x10000;i++)
|
---|
3211 | {
|
---|
3212 | g_instruction_table[i] = d68000_illegal; /* default to illegal */
|
---|
3213 | opcode = i;
|
---|
3214 | /* search through opcode info for a match */
|
---|
3215 | for(ostruct = g_opcode_info;ostruct->opcode_handler != 0;ostruct++)
|
---|
3216 | {
|
---|
3217 | /* match opcode mask and allowed ea modes */
|
---|
3218 | if((opcode & ostruct->mask) == ostruct->match)
|
---|
3219 | {
|
---|
3220 | /* Handle destination ea for move instructions */
|
---|
3221 | if((ostruct->opcode_handler == d68000_move_8 ||
|
---|
3222 | ostruct->opcode_handler == d68000_move_16 ||
|
---|
3223 | ostruct->opcode_handler == d68000_move_32) &&
|
---|
3224 | !valid_ea(((opcode>>9)&7) | ((opcode>>3)&0x38), 0xbf8))
|
---|
3225 | continue;
|
---|
3226 | if(valid_ea(opcode, ostruct->ea_mask))
|
---|
3227 | {
|
---|
3228 | g_instruction_table[i] = ostruct->opcode_handler;
|
---|
3229 | break;
|
---|
3230 | }
|
---|
3231 | }
|
---|
3232 | }
|
---|
3233 | }
|
---|
3234 | }
|
---|
3235 |
|
---|
3236 |
|
---|
3237 |
|
---|
3238 | /* ======================================================================== */
|
---|
3239 | /* ================================= API ================================== */
|
---|
3240 | /* ======================================================================== */
|
---|
3241 |
|
---|
3242 | /* Disasemble one instruction at pc and store in str_buff */
|
---|
3243 | unsigned int m68k_disassemble(char* str_buff, unsigned int pc, unsigned int cpu_type)
|
---|
3244 | {
|
---|
3245 | if(!g_initialized)
|
---|
3246 | {
|
---|
3247 | build_opcode_table();
|
---|
3248 | g_initialized = 1;
|
---|
3249 | }
|
---|
3250 | switch(cpu_type)
|
---|
3251 | {
|
---|
3252 | case M68K_CPU_TYPE_68000:
|
---|
3253 | g_cpu_type = TYPE_68000;
|
---|
3254 | g_address_mask = 0x00ffffff;
|
---|
3255 | break;
|
---|
3256 | case M68K_CPU_TYPE_68010:
|
---|
3257 | g_cpu_type = TYPE_68010;
|
---|
3258 | g_address_mask = 0x00ffffff;
|
---|
3259 | break;
|
---|
3260 | case M68K_CPU_TYPE_68EC020:
|
---|
3261 | g_cpu_type = TYPE_68020;
|
---|
3262 | g_address_mask = 0x00ffffff;
|
---|
3263 | break;
|
---|
3264 | case M68K_CPU_TYPE_68020:
|
---|
3265 | g_cpu_type = TYPE_68020;
|
---|
3266 | g_address_mask = 0xffffffff;
|
---|
3267 | break;
|
---|
3268 | case M68K_CPU_TYPE_68030:
|
---|
3269 | g_cpu_type = TYPE_68030;
|
---|
3270 | g_address_mask = 0xffffffff;
|
---|
3271 | break;
|
---|
3272 | case M68K_CPU_TYPE_68040:
|
---|
3273 | g_cpu_type = TYPE_68040;
|
---|
3274 | g_address_mask = 0xffffffff;
|
---|
3275 | break;
|
---|
3276 | default:
|
---|
3277 | return 0;
|
---|
3278 | }
|
---|
3279 |
|
---|
3280 | g_cpu_pc = pc;
|
---|
3281 | g_helper_str[0] = 0;
|
---|
3282 | g_cpu_ir = read_imm_16();
|
---|
3283 | g_instruction_table[g_cpu_ir]();
|
---|
3284 | sprintf(str_buff, "%s%s", g_dasm_str, g_helper_str);
|
---|
3285 | return g_cpu_pc - pc;
|
---|
3286 | }
|
---|
3287 |
|
---|
3288 | char* m68ki_disassemble_quick(unsigned int pc, unsigned int cpu_type)
|
---|
3289 | {
|
---|
3290 | static char buff[100];
|
---|
3291 | buff[0] = 0;
|
---|
3292 | m68k_disassemble(buff, pc, cpu_type);
|
---|
3293 | return buff;
|
---|
3294 | }
|
---|
3295 |
|
---|
3296 | /* Check if the instruction is a valid one */
|
---|
3297 | unsigned int m68k_is_valid_instruction(unsigned int instruction, unsigned int cpu_type)
|
---|
3298 | {
|
---|
3299 | if(!g_initialized)
|
---|
3300 | {
|
---|
3301 | build_opcode_table();
|
---|
3302 | g_initialized = 1;
|
---|
3303 | }
|
---|
3304 |
|
---|
3305 | instruction &= 0xffff;
|
---|
3306 | if(g_instruction_table[instruction] == d68000_illegal)
|
---|
3307 | return 0;
|
---|
3308 |
|
---|
3309 | switch(cpu_type)
|
---|
3310 | {
|
---|
3311 | case M68K_CPU_TYPE_68000:
|
---|
3312 | if(g_instruction_table[instruction] == d68010_bkpt)
|
---|
3313 | return 0;
|
---|
3314 | if(g_instruction_table[instruction] == d68010_move_fr_ccr)
|
---|
3315 | return 0;
|
---|
3316 | if(g_instruction_table[instruction] == d68010_movec)
|
---|
3317 | return 0;
|
---|
3318 | if(g_instruction_table[instruction] == d68010_moves_8)
|
---|
3319 | return 0;
|
---|
3320 | if(g_instruction_table[instruction] == d68010_moves_16)
|
---|
3321 | return 0;
|
---|
3322 | if(g_instruction_table[instruction] == d68010_moves_32)
|
---|
3323 | return 0;
|
---|
3324 | if(g_instruction_table[instruction] == d68010_rtd)
|
---|
3325 | return 0;
|
---|
3326 | case M68K_CPU_TYPE_68010:
|
---|
3327 | if(g_instruction_table[instruction] == d68020_bcc_32)
|
---|
3328 | return 0;
|
---|
3329 | if(g_instruction_table[instruction] == d68020_bfchg)
|
---|
3330 | return 0;
|
---|
3331 | if(g_instruction_table[instruction] == d68020_bfclr)
|
---|
3332 | return 0;
|
---|
3333 | if(g_instruction_table[instruction] == d68020_bfexts)
|
---|
3334 | return 0;
|
---|
3335 | if(g_instruction_table[instruction] == d68020_bfextu)
|
---|
3336 | return 0;
|
---|
3337 | if(g_instruction_table[instruction] == d68020_bfffo)
|
---|
3338 | return 0;
|
---|
3339 | if(g_instruction_table[instruction] == d68020_bfins)
|
---|
3340 | return 0;
|
---|
3341 | if(g_instruction_table[instruction] == d68020_bfset)
|
---|
3342 | return 0;
|
---|
3343 | if(g_instruction_table[instruction] == d68020_bftst)
|
---|
3344 | return 0;
|
---|
3345 | if(g_instruction_table[instruction] == d68020_bra_32)
|
---|
3346 | return 0;
|
---|
3347 | if(g_instruction_table[instruction] == d68020_bsr_32)
|
---|
3348 | return 0;
|
---|
3349 | if(g_instruction_table[instruction] == d68020_callm)
|
---|
3350 | return 0;
|
---|
3351 | if(g_instruction_table[instruction] == d68020_cas_8)
|
---|
3352 | return 0;
|
---|
3353 | if(g_instruction_table[instruction] == d68020_cas_16)
|
---|
3354 | return 0;
|
---|
3355 | if(g_instruction_table[instruction] == d68020_cas_32)
|
---|
3356 | return 0;
|
---|
3357 | if(g_instruction_table[instruction] == d68020_cas2_16)
|
---|
3358 | return 0;
|
---|
3359 | if(g_instruction_table[instruction] == d68020_cas2_32)
|
---|
3360 | return 0;
|
---|
3361 | if(g_instruction_table[instruction] == d68020_chk_32)
|
---|
3362 | return 0;
|
---|
3363 | if(g_instruction_table[instruction] == d68020_chk2_cmp2_8)
|
---|
3364 | return 0;
|
---|
3365 | if(g_instruction_table[instruction] == d68020_chk2_cmp2_16)
|
---|
3366 | return 0;
|
---|
3367 | if(g_instruction_table[instruction] == d68020_chk2_cmp2_32)
|
---|
3368 | return 0;
|
---|
3369 | if(g_instruction_table[instruction] == d68020_cmpi_pcdi_8)
|
---|
3370 | return 0;
|
---|
3371 | if(g_instruction_table[instruction] == d68020_cmpi_pcix_8)
|
---|
3372 | return 0;
|
---|
3373 | if(g_instruction_table[instruction] == d68020_cmpi_pcdi_16)
|
---|
3374 | return 0;
|
---|
3375 | if(g_instruction_table[instruction] == d68020_cmpi_pcix_16)
|
---|
3376 | return 0;
|
---|
3377 | if(g_instruction_table[instruction] == d68020_cmpi_pcdi_32)
|
---|
3378 | return 0;
|
---|
3379 | if(g_instruction_table[instruction] == d68020_cmpi_pcix_32)
|
---|
3380 | return 0;
|
---|
3381 | if(g_instruction_table[instruction] == d68020_cpbcc_16)
|
---|
3382 | return 0;
|
---|
3383 | if(g_instruction_table[instruction] == d68020_cpbcc_32)
|
---|
3384 | return 0;
|
---|
3385 | if(g_instruction_table[instruction] == d68020_cpdbcc)
|
---|
3386 | return 0;
|
---|
3387 | if(g_instruction_table[instruction] == d68020_cpgen)
|
---|
3388 | return 0;
|
---|
3389 | if(g_instruction_table[instruction] == d68020_cprestore)
|
---|
3390 | return 0;
|
---|
3391 | if(g_instruction_table[instruction] == d68020_cpsave)
|
---|
3392 | return 0;
|
---|
3393 | if(g_instruction_table[instruction] == d68020_cpscc)
|
---|
3394 | return 0;
|
---|
3395 | if(g_instruction_table[instruction] == d68020_cptrapcc_0)
|
---|
3396 | return 0;
|
---|
3397 | if(g_instruction_table[instruction] == d68020_cptrapcc_16)
|
---|
3398 | return 0;
|
---|
3399 | if(g_instruction_table[instruction] == d68020_cptrapcc_32)
|
---|
3400 | return 0;
|
---|
3401 | if(g_instruction_table[instruction] == d68020_divl)
|
---|
3402 | return 0;
|
---|
3403 | if(g_instruction_table[instruction] == d68020_extb_32)
|
---|
3404 | return 0;
|
---|
3405 | if(g_instruction_table[instruction] == d68020_link_32)
|
---|
3406 | return 0;
|
---|
3407 | if(g_instruction_table[instruction] == d68020_mull)
|
---|
3408 | return 0;
|
---|
3409 | if(g_instruction_table[instruction] == d68020_pack_rr)
|
---|
3410 | return 0;
|
---|
3411 | if(g_instruction_table[instruction] == d68020_pack_mm)
|
---|
3412 | return 0;
|
---|
3413 | if(g_instruction_table[instruction] == d68020_rtm)
|
---|
3414 | return 0;
|
---|
3415 | if(g_instruction_table[instruction] == d68020_trapcc_0)
|
---|
3416 | return 0;
|
---|
3417 | if(g_instruction_table[instruction] == d68020_trapcc_16)
|
---|
3418 | return 0;
|
---|
3419 | if(g_instruction_table[instruction] == d68020_trapcc_32)
|
---|
3420 | return 0;
|
---|
3421 | if(g_instruction_table[instruction] == d68020_tst_pcdi_8)
|
---|
3422 | return 0;
|
---|
3423 | if(g_instruction_table[instruction] == d68020_tst_pcix_8)
|
---|
3424 | return 0;
|
---|
3425 | if(g_instruction_table[instruction] == d68020_tst_i_8)
|
---|
3426 | return 0;
|
---|
3427 | if(g_instruction_table[instruction] == d68020_tst_a_16)
|
---|
3428 | return 0;
|
---|
3429 | if(g_instruction_table[instruction] == d68020_tst_pcdi_16)
|
---|
3430 | return 0;
|
---|
3431 | if(g_instruction_table[instruction] == d68020_tst_pcix_16)
|
---|
3432 | return 0;
|
---|
3433 | if(g_instruction_table[instruction] == d68020_tst_i_16)
|
---|
3434 | return 0;
|
---|
3435 | if(g_instruction_table[instruction] == d68020_tst_a_32)
|
---|
3436 | return 0;
|
---|
3437 | if(g_instruction_table[instruction] == d68020_tst_pcdi_32)
|
---|
3438 | return 0;
|
---|
3439 | if(g_instruction_table[instruction] == d68020_tst_pcix_32)
|
---|
3440 | return 0;
|
---|
3441 | if(g_instruction_table[instruction] == d68020_tst_i_32)
|
---|
3442 | return 0;
|
---|
3443 | if(g_instruction_table[instruction] == d68020_unpk_rr)
|
---|
3444 | return 0;
|
---|
3445 | if(g_instruction_table[instruction] == d68020_unpk_mm)
|
---|
3446 | return 0;
|
---|
3447 | case M68K_CPU_TYPE_68EC020:
|
---|
3448 | case M68K_CPU_TYPE_68020:
|
---|
3449 | case M68K_CPU_TYPE_68030:
|
---|
3450 | if(g_instruction_table[instruction] == d68040_cinv)
|
---|
3451 | return 0;
|
---|
3452 | if(g_instruction_table[instruction] == d68040_cpush)
|
---|
3453 | return 0;
|
---|
3454 | if(g_instruction_table[instruction] == d68040_move16_pi_pi)
|
---|
3455 | return 0;
|
---|
3456 | if(g_instruction_table[instruction] == d68040_move16_pi_al)
|
---|
3457 | return 0;
|
---|
3458 | if(g_instruction_table[instruction] == d68040_move16_al_pi)
|
---|
3459 | return 0;
|
---|
3460 | if(g_instruction_table[instruction] == d68040_move16_ai_al)
|
---|
3461 | return 0;
|
---|
3462 | if(g_instruction_table[instruction] == d68040_move16_al_ai)
|
---|
3463 | return 0;
|
---|
3464 | }
|
---|
3465 | if(cpu_type != M68K_CPU_TYPE_68020 && cpu_type != M68K_CPU_TYPE_68EC020 &&
|
---|
3466 | (g_instruction_table[instruction] == d68020_callm ||
|
---|
3467 | g_instruction_table[instruction] == d68020_rtm))
|
---|
3468 | return 0;
|
---|
3469 |
|
---|
3470 | return 1;
|
---|
3471 | }
|
---|
3472 |
|
---|
3473 |
|
---|
3474 |
|
---|
3475 | /* ======================================================================== */
|
---|
3476 | /* ============================== END OF FILE ============================= */
|
---|
3477 | /* ======================================================================== */
|
---|