Back to index

cell-binutils  2.17cvs20070401
h8300-dis.c
Go to the documentation of this file.
00001 /* Disassemble h8300 instructions.
00002    Copyright 1993, 1994, 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00003    Free Software Foundation, Inc.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
00018    MA 02110-1301, USA.  */
00019 
00020 #define DEFINE_TABLE
00021 
00022 #include "sysdep.h"
00023 #define h8_opcodes h8ops
00024 #include "opcode/h8300.h"
00025 #include "dis-asm.h"
00026 #include "opintl.h"
00027 #include "libiberty.h"
00028 
00029 struct h8_instruction
00030 {
00031   int length;
00032   const struct h8_opcode *opcode;
00033 };
00034 
00035 struct h8_instruction *h8_instructions;
00036 
00037 /* Run through the opcodes and sort them into order to make them easy
00038    to disassemble.  */
00039 
00040 static void
00041 bfd_h8_disassemble_init (void)
00042 {
00043   unsigned int i;
00044   unsigned int nopcodes;
00045   const struct h8_opcode *p;
00046   struct h8_instruction *pi;
00047 
00048   nopcodes = sizeof (h8_opcodes) / sizeof (struct h8_opcode);
00049 
00050   h8_instructions = xmalloc (nopcodes * sizeof (struct h8_instruction));
00051 
00052   for (p = h8_opcodes, pi = h8_instructions; p->name; p++, pi++)
00053     {
00054       int n1 = 0;
00055       int n2 = 0;
00056 
00057       if ((int) p->data.nib[0] < 16)
00058        n1 = (int) p->data.nib[0];
00059       else
00060        n1 = 0;
00061 
00062       if ((int) p->data.nib[1] < 16)
00063        n2 = (int) p->data.nib[1];
00064       else
00065        n2 = 0;
00066 
00067       /* Just make sure there are an even number of nibbles in it, and
00068         that the count is the same as the length.  */
00069       for (i = 0; p->data.nib[i] != (op_type) E; i++)
00070        ;
00071 
00072       if (i & 1)
00073        {
00074          fprintf (stderr, "Internal error, h8_disassemble_init.\n");
00075          abort ();
00076        }
00077 
00078       pi->length = i / 2;
00079       pi->opcode = p;
00080     }
00081 
00082   /* Add entry for the NULL vector terminator.  */
00083   pi->length = 0;
00084   pi->opcode = p;
00085 }
00086 
00087 static void
00088 extract_immediate (FILE *stream,
00089                  op_type looking_for,
00090                  int thisnib,
00091                  unsigned char *data,
00092                  int *cst,
00093                  int *len,
00094                  const struct h8_opcode *q)
00095 {
00096   switch (looking_for & SIZE)
00097     {
00098     case L_2:
00099       *len = 2;
00100       *cst = thisnib & 3;
00101 
00102       /* DISP2 special treatment.  */
00103       if ((looking_for & MODE) == DISP)
00104        {
00105          if (OP_KIND (q->how) == O_MOVAB
00106              || OP_KIND (q->how) == O_MOVAW
00107              || OP_KIND (q->how) == O_MOVAL)
00108            {
00109              /* Handling for mova insn.  */
00110              switch (q->args.nib[0] & MODE)
00111               {
00112               case INDEXB:
00113               default:
00114                 break;
00115               case INDEXW:
00116                 *cst *= 2;
00117                 break;
00118               case INDEXL:
00119                 *cst *= 4;
00120                 break;
00121               }
00122            }
00123          else
00124            {
00125              /* Handling for non-mova insn.  */
00126              switch (OP_SIZE (q->how))
00127               {
00128               default: break;
00129               case SW:
00130                 *cst *= 2;
00131                 break;
00132               case SL:
00133                 *cst *= 4;
00134                 break;
00135               }
00136            }
00137        }
00138       break;
00139     case L_8:
00140       *len = 8;
00141       *cst = data[0];
00142       break;
00143     case L_16:
00144     case L_16U:
00145       *len = 16;
00146       *cst = (data[0] << 8) + data [1];
00147 #if 0
00148       if ((looking_for & SIZE) == L_16)
00149        *cst = (short) *cst; /* Sign extend.  */
00150 #endif
00151       break;
00152     case L_32:
00153       *len = 32;
00154       *cst = (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3];
00155       break;
00156     default:
00157       *len = 0;
00158       *cst = 0;
00159       fprintf (stream, "DISP bad size\n");
00160       break;
00161     }
00162 }
00163 
00164 static const char *regnames[] =
00165 {
00166   "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
00167   "r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l"
00168 };
00169 static const char *wregnames[] =
00170 {
00171   "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
00172   "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7"
00173 };
00174 static const char *lregnames[] =
00175 {
00176   "er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7",
00177   "er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7"
00178 };
00179 static const char *cregnames[] =
00180 {
00181   "ccr", "exr", "mach", "macl", "", "", "vbr", "sbr"
00182 };
00183 
00184 static void
00185 print_one_arg (disassemble_info *info,
00186               bfd_vma addr,
00187               op_type x,
00188               int cst,
00189               int cstlen,
00190               int rdisp_n,
00191               int rn,
00192               const char **pregnames,
00193               int len)
00194 {
00195   void * stream = info->stream;
00196   fprintf_ftype outfn = info->fprintf_func;
00197 
00198   if ((x & SIZE) == L_3 || (x & SIZE) == L_3NZ)
00199     outfn (stream, "#0x%x", (unsigned) cst);
00200   else if ((x & MODE) == IMM)
00201     outfn (stream, "#0x%x", (unsigned) cst);
00202   else if ((x & MODE) == DBIT || (x & MODE) == KBIT)
00203     outfn (stream, "#%d", (unsigned) cst);
00204   else if ((x & MODE) == CONST_2)
00205     outfn (stream, "#2");
00206   else if ((x & MODE) == CONST_4)
00207     outfn (stream, "#4");
00208   else if ((x & MODE) == CONST_8)
00209     outfn (stream, "#8");
00210   else if ((x & MODE) == CONST_16)
00211     outfn (stream, "#16");
00212   else if ((x & MODE) == REG)
00213     {
00214       switch (x & SIZE)
00215        {
00216        case L_8:
00217          outfn (stream, "%s", regnames[rn]);
00218          break;
00219        case L_16:
00220        case L_16U:
00221          outfn (stream, "%s", wregnames[rn]);
00222          break;
00223        case L_P:
00224        case L_32:
00225          outfn (stream, "%s", lregnames[rn]);
00226          break;
00227        }
00228     }
00229   else if ((x & MODE) == LOWREG)
00230     {
00231       switch (x & SIZE)
00232        {
00233        case L_8:
00234          /* Always take low half of reg.  */
00235          outfn (stream, "%s.b", regnames[rn < 8 ? rn + 8 : rn]);
00236          break;
00237        case L_16:
00238        case L_16U:
00239          /* Always take low half of reg.  */
00240          outfn (stream, "%s.w", wregnames[rn < 8 ? rn : rn - 8]);
00241          break;
00242        case L_P:
00243        case L_32:
00244          outfn (stream, "%s.l", lregnames[rn]);
00245          break;
00246        }
00247     }
00248   else if ((x & MODE) == POSTINC)
00249     outfn (stream, "@%s+", pregnames[rn]);
00250 
00251   else if ((x & MODE) == POSTDEC)
00252     outfn (stream, "@%s-", pregnames[rn]);
00253 
00254   else if ((x & MODE) == PREINC)
00255     outfn (stream, "@+%s", pregnames[rn]);
00256 
00257   else if ((x & MODE) == PREDEC)
00258     outfn (stream, "@-%s", pregnames[rn]);
00259 
00260   else if ((x & MODE) == IND)
00261     outfn (stream, "@%s", pregnames[rn]);
00262 
00263   else if ((x & MODE) == ABS || (x & ABSJMP))
00264     outfn (stream, "@0x%x:%d", (unsigned) cst, cstlen);
00265 
00266   else if ((x & MODE) == MEMIND)
00267     outfn (stream, "@@%d (0x%x)", cst, cst);
00268 
00269   else if ((x & MODE) == VECIND)
00270     {
00271       /* FIXME Multiplier should be 2 or 4, depending on processor mode,
00272         by which is meant "normal" vs. "middle", "advanced", "maximum".  */
00273 
00274       int offset = (cst + 0x80) * 4;
00275       outfn (stream, "@@%d (0x%x)", offset, offset);
00276     }
00277   else if ((x & MODE) == PCREL)
00278     {
00279       if ((x & SIZE) == L_16 ||
00280          (x & SIZE) == L_16U)
00281        {
00282          outfn (stream, ".%s%d (0x%lx)",
00283                  (short) cst > 0 ? "+" : "",
00284                  (short) cst, 
00285                  (long)(addr + (short) cst + len));
00286        }
00287       else
00288        {
00289          outfn (stream, ".%s%d (0x%lx)",
00290                  (char) cst > 0 ? "+" : "",
00291                  (char) cst, 
00292                  (long)(addr + (char) cst + len));
00293        }
00294     }
00295   else if ((x & MODE) == DISP)
00296     outfn (stream, "@(0x%x:%d,%s)", cst, cstlen, pregnames[rdisp_n]);
00297 
00298   else if ((x & MODE) == INDEXB)
00299     /* Always take low half of reg.  */
00300     outfn (stream, "@(0x%x:%d,%s.b)", cst, cstlen, 
00301           regnames[rdisp_n < 8 ? rdisp_n + 8 : rdisp_n]);
00302 
00303   else if ((x & MODE) == INDEXW)
00304     /* Always take low half of reg.  */
00305     outfn (stream, "@(0x%x:%d,%s.w)", cst, cstlen, 
00306           wregnames[rdisp_n < 8 ? rdisp_n : rdisp_n - 8]);
00307 
00308   else if ((x & MODE) == INDEXL)
00309     outfn (stream, "@(0x%x:%d,%s.l)", cst, cstlen, lregnames[rdisp_n]);
00310 
00311   else if (x & CTRL)
00312     outfn (stream, cregnames[rn]);
00313 
00314   else if ((x & MODE) == CCR)
00315     outfn (stream, "ccr");
00316 
00317   else if ((x & MODE) == EXR)
00318     outfn (stream, "exr");
00319 
00320   else if ((x & MODE) == MACREG)
00321     outfn (stream, "mac%c", cst ? 'l' : 'h');
00322 
00323   else
00324     /* xgettext:c-format */
00325     outfn (stream, _("Hmmmm 0x%x"), x);
00326 }
00327 
00328 static unsigned int
00329 bfd_h8_disassemble (bfd_vma addr, disassemble_info *info, int mach)
00330 {
00331   /* Find the first entry in the table for this opcode.  */
00332   int regno[3] = { 0, 0, 0 };
00333   int dispregno[3] = { 0, 0, 0 };
00334   int cst[3] = { 0, 0, 0 };
00335   int cstlen[3] = { 0, 0, 0 };
00336   static bfd_boolean init = 0;
00337   const struct h8_instruction *qi;
00338   char const **pregnames = mach != 0 ? lregnames : wregnames;
00339   int status;
00340   unsigned int l;
00341   unsigned char data[MAX_CODE_NIBBLES];
00342   void *stream = info->stream;
00343   fprintf_ftype outfn = info->fprintf_func;
00344 
00345   if (!init)
00346     {
00347       bfd_h8_disassemble_init ();
00348       init = 1;
00349     }
00350 
00351   status = info->read_memory_func (addr, data, 2, info);
00352   if (status != 0)
00353     {
00354       info->memory_error_func (status, addr, info);
00355       return -1;
00356     }
00357 
00358   for (l = 2; status == 0 && l < sizeof (data) / 2; l += 2)
00359     status = info->read_memory_func (addr + l, data + l, 2, info);
00360 
00361   /* Find the exact opcode/arg combo.  */
00362   for (qi = h8_instructions; qi->opcode->name; qi++)
00363     {
00364       const struct h8_opcode *q = qi->opcode;
00365       const op_type *nib = q->data.nib;
00366       unsigned int len = 0;
00367 
00368       while (1)
00369        {
00370          op_type looking_for = *nib;
00371          int thisnib = data[len / 2];
00372          int opnr;
00373 
00374          thisnib = (len & 1) ? (thisnib & 0xf) : ((thisnib / 16) & 0xf);
00375          opnr = ((looking_for & OP3) == OP3 ? 2
00376                 : (looking_for & DST) == DST ? 1 : 0);
00377 
00378          if (looking_for < 16 && looking_for >= 0)
00379            {
00380              if (looking_for != thisnib)
00381               goto fail;
00382            }
00383          else
00384            {
00385              if ((int) looking_for & (int) B31)
00386               {
00387                 if (!((thisnib & 0x8) != 0))
00388                   goto fail;
00389 
00390                 looking_for = (op_type) ((int) looking_for & ~(int) B31);
00391                 thisnib &= 0x7;
00392               }
00393              else if ((int) looking_for & (int) B30)
00394               {
00395                 if (!((thisnib & 0x8) == 0))
00396                   goto fail;
00397 
00398                 looking_for = (op_type) ((int) looking_for & ~(int) B30);
00399               }
00400 
00401              if ((int) looking_for & (int) B21)
00402               {
00403                 if (!((thisnib & 0x4) != 0))
00404                   goto fail;
00405 
00406                 looking_for = (op_type) ((int) looking_for & ~(int) B21);
00407                 thisnib &= 0xb;
00408               }
00409              else if ((int) looking_for & (int) B20)
00410               {
00411                 if (!((thisnib & 0x4) == 0))
00412                   goto fail;
00413 
00414                 looking_for = (op_type) ((int) looking_for & ~(int) B20);
00415               }
00416              if ((int) looking_for & (int) B11)
00417               {
00418                 if (!((thisnib & 0x2) != 0))
00419                   goto fail;
00420 
00421                 looking_for = (op_type) ((int) looking_for & ~(int) B11);
00422                 thisnib &= 0xd;
00423               }
00424              else if ((int) looking_for & (int) B10)
00425               {
00426                 if (!((thisnib & 0x2) == 0))
00427                   goto fail;
00428 
00429                 looking_for = (op_type) ((int) looking_for & ~(int) B10);
00430               }
00431 
00432              if ((int) looking_for & (int) B01)
00433               {
00434                 if (!((thisnib & 0x1) != 0))
00435                   goto fail;
00436 
00437                 looking_for = (op_type) ((int) looking_for & ~(int) B01);
00438                 thisnib &= 0xe;
00439               }
00440              else if ((int) looking_for & (int) B00)
00441               {
00442                 if (!((thisnib & 0x1) == 0))
00443                   goto fail;
00444 
00445                 looking_for = (op_type) ((int) looking_for & ~(int) B00);
00446               }
00447 
00448              if (looking_for & IGNORE)
00449               {
00450                 /* Hitachi has declared that IGNORE must be zero.  */
00451                 if (thisnib != 0)
00452                   goto fail;
00453               }
00454              else if ((looking_for & MODE) == DATA)
00455               {
00456                 ;                  /* Skip embedded data.  */
00457               }
00458              else if ((looking_for & MODE) == DBIT)
00459               {
00460                 /* Exclude adds/subs by looking at bit 0 and 2, and
00461                      make sure the operand size, either w or l,
00462                      matches by looking at bit 1.  */
00463                 if ((looking_for & 7) != (thisnib & 7))
00464                   goto fail;
00465 
00466                 cst[opnr] = (thisnib & 0x8) ? 2 : 1;
00467               }
00468              else if ((looking_for & MODE) == DISP
00469                      || (looking_for & MODE) == ABS
00470                      || (looking_for & MODE) == PCREL
00471                      || (looking_for & MODE) == INDEXB
00472                      || (looking_for & MODE) == INDEXW
00473                      || (looking_for & MODE) == INDEXL)
00474               {
00475                 extract_immediate (stream, looking_for, thisnib, 
00476                                  data + len / 2, cst + opnr, 
00477                                  cstlen + opnr, q);
00478                 /* Even address == bra, odd == bra/s.  */
00479                 if (q->how == O (O_BRAS, SB))
00480                   cst[opnr] -= 1;
00481               }
00482              else if ((looking_for & MODE) == REG
00483                      || (looking_for & MODE) == LOWREG
00484                      || (looking_for & MODE) == IND
00485                      || (looking_for & MODE) == PREINC
00486                      || (looking_for & MODE) == POSTINC
00487                      || (looking_for & MODE) == PREDEC
00488                      || (looking_for & MODE) == POSTDEC)
00489               {
00490                 regno[opnr] = thisnib;
00491               }
00492              else if (looking_for & CTRL) /* Control Register.  */
00493               {
00494                 thisnib &= 7;
00495                 if (((looking_for & MODE) == CCR  && (thisnib != C_CCR))
00496                     || ((looking_for & MODE) == EXR  && (thisnib != C_EXR))
00497                     || ((looking_for & MODE) == MACH && (thisnib != C_MACH))
00498                     || ((looking_for & MODE) == MACL && (thisnib != C_MACL))
00499                     || ((looking_for & MODE) == VBR  && (thisnib != C_VBR))
00500                     || ((looking_for & MODE) == SBR  && (thisnib != C_SBR)))
00501                   goto fail;
00502                 if (((looking_for & MODE) == CCR_EXR
00503                      && (thisnib != C_CCR && thisnib != C_EXR))
00504                     || ((looking_for & MODE) == VBR_SBR
00505                        && (thisnib != C_VBR && thisnib != C_SBR))
00506                     || ((looking_for & MODE) == MACREG
00507                        && (thisnib != C_MACH && thisnib != C_MACL)))
00508                   goto fail;
00509                 if (((looking_for & MODE) == CC_EX_VB_SB
00510                      && (thisnib != C_CCR && thisnib != C_EXR
00511                         && thisnib != C_VBR && thisnib != C_SBR)))
00512                   goto fail;
00513 
00514                 regno[opnr] = thisnib;
00515               }
00516              else if ((looking_for & SIZE) == L_5)
00517               {
00518                 cst[opnr] = data[len / 2] & 31;
00519                 cstlen[opnr] = 5;
00520               }
00521              else if ((looking_for & SIZE) == L_4)
00522               {
00523                 cst[opnr] = thisnib;
00524                 cstlen[opnr] = 4;
00525               }
00526              else if ((looking_for & SIZE) == L_16
00527                      || (looking_for & SIZE) == L_16U)
00528               {
00529                 cst[opnr] = (data[len / 2]) * 256 + data[(len + 2) / 2];
00530                 cstlen[opnr] = 16;
00531               }
00532              else if ((looking_for & MODE) == MEMIND)
00533               {
00534                 cst[opnr] = data[1];
00535               }
00536              else if ((looking_for & MODE) == VECIND)
00537               {
00538                 cst[opnr] = data[1] & 0x7f;
00539               }
00540              else if ((looking_for & SIZE) == L_32)
00541               {
00542                 int i = len / 2;
00543 
00544                 cst[opnr] = ((data[i] << 24) 
00545                             | (data[i + 1] << 16) 
00546                             | (data[i + 2] << 8)
00547                             | (data[i + 3]));
00548 
00549                 cstlen[opnr] = 32;
00550               }
00551              else if ((looking_for & SIZE) == L_24)
00552               {
00553                 int i = len / 2;
00554 
00555                 cst[opnr] = 
00556                   (data[i] << 16) | (data[i + 1] << 8) | (data[i + 2]);
00557                 cstlen[opnr] = 24;
00558               }
00559              else if (looking_for & IGNORE)
00560               {
00561                 ;
00562               }
00563              else if (looking_for & DISPREG)
00564               {
00565                 dispregno[opnr] = thisnib & 7;
00566               }
00567              else if ((looking_for & MODE) == KBIT)
00568               {
00569                 switch (thisnib)
00570                   {
00571                   case 9:
00572                     cst[opnr] = 4;
00573                     break;
00574                   case 8:
00575                     cst[opnr] = 2;
00576                     break;
00577                   case 0:
00578                     cst[opnr] = 1;
00579                     break;
00580                   default:
00581                     goto fail;
00582                   }
00583               }
00584              else if ((looking_for & SIZE) == L_8)
00585               {
00586                 cstlen[opnr] = 8;
00587                 cst[opnr] = data[len / 2];
00588               }
00589              else if ((looking_for & SIZE) == L_3
00590                      || (looking_for & SIZE) == L_3NZ)
00591               {
00592                 cst[opnr] = thisnib & 0x7;
00593                 if (cst[opnr] == 0 && (looking_for & SIZE) == L_3NZ)
00594                   goto fail;
00595               }
00596              else if ((looking_for & SIZE) == L_2)
00597               {
00598                 cstlen[opnr] = 2;
00599                 cst[opnr] = thisnib & 0x3;
00600               }
00601              else if ((looking_for & MODE) == MACREG)
00602               {
00603                 cst[opnr] = (thisnib == 3);
00604               }
00605              else if (looking_for == (op_type) E)
00606               {
00607                 outfn (stream, "%s\t", q->name);
00608 
00609                 /* Gross.  Disgusting.  */
00610                 if (strcmp (q->name, "ldm.l") == 0)
00611                   {
00612                     int count, high;
00613 
00614                     count = (data[1] / 16) & 0x3;
00615                     high = regno[1];
00616 
00617                     outfn (stream, "@sp+,er%d-er%d", high - count, high);
00618                     return qi->length;
00619                   }
00620 
00621                 if (strcmp (q->name, "stm.l") == 0)
00622                   {
00623                     int count, low;
00624 
00625                     count = (data[1] / 16) & 0x3;
00626                     low = regno[0];
00627 
00628                     outfn (stream, "er%d-er%d,@-sp", low, low + count);
00629                     return qi->length;
00630                   }
00631                 if (strcmp (q->name, "rte/l") == 0
00632                     || strcmp (q->name, "rts/l") == 0)
00633                   {
00634                     if (regno[0] == 0)
00635                      outfn (stream, "er%d", regno[1]);
00636                     else
00637                      outfn (stream, "er%d-er%d", regno[1] - regno[0],
00638                             regno[1]);
00639                     return qi->length;
00640                   }
00641                 if (CONST_STRNEQ (q->name, "mova"))
00642                   {
00643                     const op_type *args = q->args.nib;
00644 
00645                     if (args[1] == (op_type) E)
00646                      {
00647                        /* Short form.  */
00648                        print_one_arg (info, addr, args[0], cst[0], 
00649                                     cstlen[0], dispregno[0], regno[0], 
00650                                     pregnames, qi->length);
00651                        outfn (stream, ",er%d", dispregno[0]);
00652                      }
00653                     else
00654                      {
00655                        outfn (stream, "@(0x%x:%d,", cst[0], cstlen[0]);
00656                        print_one_arg (info, addr, args[1], cst[1], 
00657                                     cstlen[1], dispregno[1], regno[1], 
00658                                     pregnames, qi->length);
00659                        outfn (stream, ".%c),",
00660                              (args[0] & MODE) == INDEXB ? 'b' : 'w');
00661                        print_one_arg (info, addr, args[2], cst[2], 
00662                                     cstlen[2], dispregno[2], regno[2], 
00663                                     pregnames, qi->length);
00664                      }
00665                     return qi->length;
00666                   }
00667                 /* Fill in the args.  */
00668                 {
00669                   const op_type *args = q->args.nib;
00670                   int hadone = 0;
00671                   int nargs;
00672 
00673                   /* Special case handling for the adds and subs instructions
00674                      since in H8 mode thay can only take the r0-r7 registers
00675                      but in other (higher) modes they can take the er0-er7
00676                      registers as well.  */
00677                   if (strcmp (qi->opcode->name, "adds") == 0
00678                      || strcmp (qi->opcode->name, "subs") == 0)
00679                     {
00680                      outfn (stream, "#%d,%s", cst[0], pregnames[regno[1] & 0x7]);
00681                      return qi->length;
00682                     }
00683 
00684                   for (nargs = 0; 
00685                       nargs < 3 && args[nargs] != (op_type) E;
00686                       nargs++)
00687                     {
00688                      int x = args[nargs];
00689 
00690                      if (hadone)
00691                        outfn (stream, ",");
00692 
00693                      print_one_arg (info, addr, x,
00694                                    cst[nargs], cstlen[nargs],
00695                                    dispregno[nargs], regno[nargs],
00696                                    pregnames, qi->length);
00697 
00698                      hadone = 1;
00699                     }
00700                 }
00701 
00702                 return qi->length;
00703               }
00704              else
00705               /* xgettext:c-format */
00706               outfn (stream, _("Don't understand 0x%x \n"), looking_for);
00707            }
00708 
00709          len++;
00710          nib++;
00711        }
00712 
00713     fail:
00714       ;
00715     }
00716 
00717   /* Fell off the end.  */
00718   outfn (stream, ".word\tH'%x,H'%x", data[0], data[1]);
00719   return 2;
00720 }
00721 
00722 int
00723 print_insn_h8300 (bfd_vma addr, disassemble_info *info)
00724 {
00725   return bfd_h8_disassemble (addr, info, 0);
00726 }
00727 
00728 int
00729 print_insn_h8300h (bfd_vma addr, disassemble_info *info)
00730 {
00731   return bfd_h8_disassemble (addr, info, 1);
00732 }
00733 
00734 int
00735 print_insn_h8300s (bfd_vma addr, disassemble_info *info)
00736 {
00737   return bfd_h8_disassemble (addr, info, 2);
00738 }