Apply H>J's patch to propogate changes made by Thomas de Lellis to arm.h
[deliverable/binutils-gdb.git] / opcodes / tic80-dis.c
index e698437268dc56e78e8d2ab8ff58899fea5bb13a..726bc12e881e95feda922fc7c883d26d8b3962e1 100644 (file)
@@ -1,5 +1,5 @@
 /* Print TI TMS320C80 (MVP) instructions
-   Copyright 1996, 1997 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
 This file is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -81,72 +81,9 @@ print_operand_control_register (info, value)
      struct disassemble_info *info;
      long value;
 {
-  char *tmp;
+  const char *tmp;
 
-  switch (value)
-    {
-    case 0:            tmp = "EPC";            break;
-    case 1:            tmp = "EIP";            break;
-    case 2:            tmp = "CONFIG";         break;
-    case 4:            tmp = "INTPEN";         break;
-    case 6:            tmp = "IE";             break;
-    case 8:            tmp = "FPST";           break;
-    case 0xA:          tmp = "PPERROR";        break;
-    case 0xD:          tmp = "PKTREQ";         break;
-    case 0xE:          tmp = "TCOUNT";         break;
-    case 0xF:          tmp = "TSCALE";         break;
-    case 0x10:         tmp = "FLTOP";          break;
-    case 0x11:         tmp = "FLTADR";         break;
-    case 0x12:         tmp = "FLTTAG";         break;
-    case 0x13:         tmp = "FLTDTL";         break;
-    case 0x14:         tmp = "FLTDTH";         break;
-    case 0x20:         tmp = "SYSSTK";         break;
-    case 0x21:         tmp = "SYSTMP";         break;
-    case 0x30:         tmp = "MPC";            break;
-    case 0x31:         tmp = "MIP";            break;
-    case 0x33:         tmp = "ECOMCNTL";       break;
-    case 0x34:         tmp = "ANASTAT";        break;
-    case 0x39:         tmp = "BRK1";           break;
-    case 0x3A:         tmp = "BRK2";           break;
-    case 0x200:                tmp = "ITAG0";          break;
-    case 0x201:                tmp = "ITAG1";          break;
-    case 0x202:                tmp = "ITAG2";          break;
-    case 0x203:                tmp = "ITAG3";          break;
-    case 0x204:                tmp = "ITAG4";          break;
-    case 0x205:                tmp = "ITAG5";          break;
-    case 0x206:                tmp = "ITAG6";          break;
-    case 0x207:                tmp = "ITAG7";          break;
-    case 0x208:                tmp = "ITAG8";          break;
-    case 0x209:                tmp = "ITAG9";          break;
-    case 0x20A:                tmp = "ITAG10";         break;
-    case 0x20B:                tmp = "ITAG11";         break;
-    case 0x20C:                tmp = "ITAG12";         break;
-    case 0x20D:                tmp = "ITAG13";         break;
-    case 0x20E:                tmp = "ITAG14";         break;
-    case 0x20F:                tmp = "ITAG15";         break;
-    case 0x300:                tmp = "ILRU";           break;
-    case 0x400:                tmp = "DTAG0";          break;
-    case 0x401:                tmp = "DTAG1";          break;
-    case 0x402:                tmp = "DTAG2";          break;
-    case 0x403:                tmp = "DTAG3";          break;
-    case 0x404:                tmp = "DTAG4";          break;
-    case 0x405:                tmp = "DTAG5";          break;
-    case 0x406:                tmp = "DTAG6";          break;
-    case 0x407:                tmp = "DTAG7";          break;
-    case 0x408:                tmp = "DTAG8";          break;
-    case 0x409:                tmp = "DTAG9";          break;
-    case 0x40A:                tmp = "DTAG10";         break;
-    case 0x40B:                tmp = "DTAG11";         break;
-    case 0x40C:                tmp = "DTAG12";         break;
-    case 0x40D:                tmp = "DTAG13";         break;
-    case 0x40E:                tmp = "DTAG14";         break;
-    case 0x40F:                tmp = "DTAG15";         break;
-    case 0x500:                tmp = "DLRU";           break;
-    case 0x4000:       tmp = "IN0P";           break;
-    case 0x4001:       tmp = "IN1P";           break;
-    case 0x4002:       tmp = "OUTP";           break;
-    default:           tmp = NULL;             break;
-    }
+  tmp = tic80_value_to_symbol (value, TIC80_OPERAND_CR);
   if (tmp != NULL)
     {
       (*info -> fprintf_func) (info -> stream, "%s", tmp);
@@ -163,20 +100,15 @@ print_operand_condition_code (info, value)
      struct disassemble_info *info;
      long value;
 {
-  const char *syms[] = {
-    "nev.b", "gt0.b", "eq0.b", "ge0.b", "lt0.b", "ne0.b", "le0.b", "alw.b",
-    "nev.h", "gt0.h", "eq0.h", "ge0.h", "lt0.h", "ne0.h", "le0.h", "alw.h",
-    "nev.w", "gt0.w", "eq0.w", "ge0.w", "lt0.w", "ne0.w", "le0.w", "alw.w"
-  };
+  const char *tmp;
 
-  if (value < (sizeof (syms) / sizeof (syms[0])))
+  tmp = tic80_value_to_symbol (value, TIC80_OPERAND_CC);
+  if (tmp != NULL)
     {
-      /* Found a value within range */
-      (*info -> fprintf_func) (info -> stream, "%s", syms[value]);
+      (*info -> fprintf_func) (info -> stream, "%s", tmp);
     }
   else
     {
-      /* Not in range, just print as decimal digit. */
       (*info -> fprintf_func) (info -> stream, "%ld", value);
     }
 }
@@ -188,23 +120,16 @@ print_operand_bitnum (info, value)
      long value;
 {
   int bitnum;
-  const char *syms[] = {
-    "eq.b", "ne.b", "gt.b", "le.b", "lt.b", "ge.b",
-    "hi.b", "ls.b", "lo.b", "hs.b", "eq.h", "ne.h",
-    "gt.h", "le.h", "lt.h", "ge.h", "hi.h", "ls.h",
-    "lo.h", "hs.h", "eq.w", "ne.w", "gt.w", "le.w",
-    "lt.w", "ge.w", "hi.w", "ls.w", "lo.w", "hs.w"
-  };
+  const char *tmp;
 
   bitnum = ~value & 0x1F;
-  if (bitnum < (sizeof (syms) / sizeof (syms[0])))
+  tmp = tic80_value_to_symbol (bitnum, TIC80_OPERAND_BITNUM);
+  if (tmp != NULL)
     {
-      /* Found a value within range */
-      (*info -> fprintf_func) (info -> stream, "%s", syms[bitnum]);
+      (*info -> fprintf_func) (info -> stream, "%s", tmp);
     }
   else
     {
-      /* Not in range, just print as bit number */
       (*info -> fprintf_func) (info -> stream, "%ld", bitnum);
     }
 }
@@ -291,7 +216,6 @@ print_one_instruction (info, memaddr, insn, opcode)
   long value;
   int status;
   const unsigned char *opindex;
-  bfd_byte buffer[4];
   int close_paren;
 
   (*info -> fprintf_func) (info -> stream, "%-10s", opcode -> name);
@@ -463,6 +387,7 @@ print_insn_tic80 (memaddr, info)
   int status;
 
   length = 0;
+  info->bytes_per_line = 8;
   status = fill_instruction (info, memaddr, &insn);
   if (status != -1)
     {
This page took 0.025476 seconds and 4 git commands to generate.