16 |
|
along with this program; if not, write to the Free Software |
17 |
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
18 |
|
|
19 |
+ |
#include <stdlib.h> |
20 |
|
#include "dis-asm.h" |
21 |
|
#include "floatformat.h" |
22 |
|
#include "opintl.h" |
23 |
|
|
24 |
|
#include "m68k.h" |
25 |
|
|
25 |
– |
#include "../mon_atraps.h" |
26 |
– |
|
26 |
|
/* Local function prototypes */ |
27 |
|
|
28 |
|
static int |
200 |
|
/* Then create a sorted table of pointers that point into the |
201 |
|
unsorted table. */ |
202 |
|
opc_pointer[0] = ((const struct m68k_opcode **) |
203 |
< |
xmalloc (sizeof (struct m68k_opcode *) |
203 |
> |
malloc (sizeof (struct m68k_opcode *) |
204 |
|
* m68k_numopcodes)); |
205 |
|
opcodes[0] = opc_pointer[0]; |
206 |
|
for (i = 1; i < 16; i++) |
435 |
|
return p - buffer; |
436 |
|
|
437 |
|
invalid: { |
438 |
< |
unsigned long opcode = (buffer[0] << 8) | buffer[1]; |
440 |
< |
const struct atrap_info *p = atraps; |
438 |
> |
extern void print_68k_invalid_opcode(unsigned long, struct disassemble_info *); |
439 |
|
|
440 |
|
/* Handle undefined instructions. */ |
441 |
|
info->fprintf_func = save_printer; |
442 |
|
info->print_address_func = save_print_address; |
443 |
< |
|
446 |
< |
/* Look for MacOS A-Trap */ |
447 |
< |
while (p->word) { |
448 |
< |
if (p->word == opcode) { |
449 |
< |
(*info->fprintf_func) (info->stream, p->name); |
450 |
< |
return 2; |
451 |
< |
} |
452 |
< |
p++; |
453 |
< |
} |
454 |
< |
|
455 |
< |
(*info->fprintf_func) (info->stream, "?"); |
443 |
> |
print_68k_invalid_opcode((buffer[0] << 8) | buffer[1], info); |
444 |
|
return 2; |
445 |
|
} |
446 |
|
} |
674 |
|
else |
675 |
|
return -2; |
676 |
|
|
677 |
+ |
#if 1 |
678 |
+ |
(*info->fprintf_func) (info->stream, "$%08x", addr + disp); |
679 |
+ |
#else |
680 |
|
(*info->print_address_func) (addr + disp, info); |
681 |
+ |
#endif |
682 |
|
break; |
683 |
|
|
684 |
|
case 'd': |
778 |
|
|
779 |
|
case 2: |
780 |
|
val = NEXTWORD (p); |
781 |
< |
(*info->fprintf_func) (info->stream, "("); |
790 |
< |
(*info->print_address_func) (addr + val, info); |
791 |
< |
(*info->fprintf_func) (info->stream, ",pc)"); |
781 |
> |
(*info->fprintf_func) (info->stream, "($%08x,pc)", addr + val); |
782 |
|
break; |
783 |
|
|
784 |
|
case 3: |
1233 |
|
bfd_vma disp; |
1234 |
|
disassemble_info *info; |
1235 |
|
{ |
1236 |
< |
if (regno == -1) |
1237 |
< |
{ |
1238 |
< |
(*info->print_address_func) (disp, info); |
1239 |
< |
(*info->fprintf_func) (info->stream, ",pc"); |
1240 |
< |
} |
1241 |
< |
else |
1242 |
< |
{ |
1243 |
< |
(*info->fprintf_func) (info->stream, "$%08x", disp); |
1244 |
< |
if (regno == -3) |
1245 |
< |
(*info->fprintf_func) (info->stream, ",zpc"); |
1256 |
< |
else if (regno != -2) |
1257 |
< |
(*info->fprintf_func) (info->stream, ",%s", reg_names[regno]); |
1258 |
< |
} |
1236 |
> |
if (regno == -1) |
1237 |
> |
(*info->fprintf_func) (info->stream, "$%08x,pc", disp); |
1238 |
> |
else { |
1239 |
> |
if (regno == -3) |
1240 |
> |
(*info->fprintf_func) (info->stream, "$%08x,zpc", disp); |
1241 |
> |
else if (regno == -2) |
1242 |
> |
(*info->print_address_func) (disp, info); |
1243 |
> |
else |
1244 |
> |
(*info->fprintf_func) (info->stream, "$%08x,%s", disp, reg_names[regno]); |
1245 |
> |
} |
1246 |
|
} |