import insight-2000-02-04 snapshot (2nd try)
[external/binutils.git] / opcodes / h8300-dis.c
index 7481019..57753a9 100644 (file)
@@ -1,5 +1,5 @@
 /* Disassemble h8300 instructions.
-   Copyright (C) 1993 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1998 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define h8_opcodes h8ops
 #include "opcode/h8300.h"
 #include "dis-asm.h"
+#include "opintl.h"
 
 
 /* Run through the opcodes and sort them into order to make them easy
@@ -209,8 +210,7 @@ bfd_h8_disassemble (addr, info, mode)
              else if (looking_for & L_24)
                {
                  int i = len >> 1;
-                 abs = (data[i] << 16) | (data[i + 1] << 8)|  (data[i+
-                                                                    2]);
+                 abs = (data[i] << 16) | (data[i + 1] << 8)|  (data[i+2]);
                  plen =24;
                }
              else if (looking_for & IGNORE)
@@ -252,6 +252,10 @@ bfd_h8_disassemble (addr, info, mode)
                  plen = 2;
                  abs = thisnib & 0x3;
                }
+             else if (looking_for & MACREG)
+               {
+                 abs = (thisnib == 3);
+               }
              else if (looking_for == E)
                {
 
@@ -268,6 +272,30 @@ bfd_h8_disassemble (addr, info, mode)
                      }
                  }
                  fprintf (stream, "%s\t", q->name);
+
+                 /* Gross.  Disgusting.  */
+                 if (strcmp (q->name, "ldm.l") == 0)
+                   {
+                     int count, high;
+
+                     count = (data[1] >> 4) & 0x3;
+                     high = data[3] & 0x7;
+
+                     fprintf (stream, "@sp+,er%d-er%d", high - count, high);
+                     return q->length;
+                   }
+
+                 if (strcmp (q->name, "stm.l") == 0)
+                   {
+                     int count, low;
+
+                     count = (data[1] >> 4) & 0x3;
+                     low = data[3] & 0x7;
+
+                     fprintf (stream, "er%d-er%d,@-sp", low, low + count);
+                     return q->length;
+                   }
+
                  /* Fill in the args */
                  {
                    op_type *args = q->args.nib;
@@ -287,6 +315,10 @@ bfd_h8_disassemble (addr, info, mode)
                          }
                        else if (x & (IMM|KBIT|DBIT))
                          {
+                           /* Bletch.  For shal #2,er0 and friends.  */
+                           if (*(args+1) & SRC_IN_DST)
+                             abs = 2;
+
                            fprintf (stream, "#0x%x", (unsigned) abs);
                          }
                        else if (x & REG)
@@ -307,7 +339,10 @@ bfd_h8_disassemble (addr, info, mode)
                    
                              }
                          }
-
+                       else if (x & MACREG)
+                         {
+                           fprintf (stream, "mac%c", abs ? 'l' : 'h');
+                         }
                        else if (x & INC)
                          {
                            fprintf (stream, "@%s+", pregnames[rs]);
@@ -364,9 +399,9 @@ bfd_h8_disassemble (addr, info, mode)
                          {
                            fprintf (stream, "exr");
                          }
-
                        else
-                         fprintf (stream, "Hmmmm %x", x);
+                         /* xgettext:c-format */
+                         fprintf (stream, _("Hmmmm %x"), x);
                        hadone = 1;
                        args++;
                      }
@@ -377,7 +412,8 @@ bfd_h8_disassemble (addr, info, mode)
       
              else
                {
-                 fprintf (stream, "Dont understand %x \n", looking_for);
+                 /* xgettext:c-format */
+                 fprintf (stream, _("Don't understand %x \n"), looking_for);
                }
            }