1 /* Disassemble MSP430 instructions.
2 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 Contributed by Dmitry Diky <diwil@mail.ru>
6 This file is part of the GNU opcodes library.
8 This library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 It is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
26 #include <sys/types.h>
31 #include "libiberty.h"
34 #include "opcode/msp430.h"
38 #define PS(x) (0xffff & (x))
41 msp430dis_read_two_bytes (bfd_vma addr
,
42 disassemble_info
* info
,
48 status
= info
->read_memory_func (addr
, buffer
, 2, info
);
52 /* PR 20150: A status of EIO means that there were no more bytes left
53 to read in the current section. This can happen when disassembling
54 interrupt vectors for example. Avoid cluttering the output with
55 unhelpful error messages in this case. */
59 sprintf (comm
, _("Warning: disassembly unreliable - not enough bytes available"));
63 info
->memory_error_func (status
, addr
, info
);
65 sprintf (comm
, _("Error: read from memory failed"));
72 msp430dis_opcode_unsigned (bfd_vma addr
,
73 disassemble_info
* info
,
74 unsigned short * return_val
,
79 if (msp430dis_read_two_bytes (addr
, info
, buffer
, comm
))
81 * return_val
= bfd_getl16 (buffer
);
92 msp430dis_opcode_signed (bfd_vma addr
,
93 disassemble_info
* info
,
94 signed int * return_val
,
99 if (msp430dis_read_two_bytes (addr
, info
, buffer
, comm
))
103 status
= bfd_getl_signed_16 (buffer
);
106 * return_val
= status
;
117 msp430_nooperands (struct msp430_opcode_s
*opcode
,
118 bfd_vma addr ATTRIBUTE_UNUSED
,
119 unsigned short insn ATTRIBUTE_UNUSED
,
123 /* Pop with constant. */
126 if (insn
== opcode
->bin_opcode
)
129 if (opcode
->fmt
== 0)
131 if ((insn
& 0x0f00) != 0x0300 || (insn
& 0x0f00) != 0x0200)
134 strcpy (comm
, "emulated...");
139 strcpy (comm
, "return from interupt");
147 print_as2_reg_name (int regno
, char * op1
, char * comm1
,
148 int c2
, int c3
, int cd
)
154 sprintf (comm1
, "r2 As==10");
159 sprintf (comm1
, "r3 As==10");
163 /* Indexed register mode @Rn. */
164 sprintf (op1
, "@r%d", regno
);
170 print_as3_reg_name (int regno
, char * op1
, char * comm1
,
171 int c2
, int c3
, int cd
)
177 sprintf (comm1
, "r2 As==11");
181 sprintf (op1
, "#-1");
182 sprintf (comm1
, "r3 As==11");
186 /* Post incremented @Rn+. */
187 sprintf (op1
, "@r%d+", regno
);
193 msp430_singleoperand (disassemble_info
*info
,
194 struct msp430_opcode_s
*opcode
,
199 unsigned short extension_word
,
202 int regs
= 0, regd
= 0;
208 int extended_dst
= extension_word
& 0xf;
211 regs
= (insn
& 0x0f00) >> 8;
212 as
= (insn
& 0x0030) >> 4;
213 ad
= (insn
& 0x0080) >> 7;
216 fmt
= (- opcode
->fmt
) - 1;
222 case 0: /* Emulated work with dst register. */
223 if (regs
!= 2 && regs
!= 3 && regs
!= 1)
226 /* Check if not clr insn. */
227 if (opcode
->bin_opcode
== 0x4300 && (ad
|| as
))
230 /* Check if really inc, incd insns. */
231 if ((opcode
->bin_opcode
& 0xff00) == 0x5300 && as
== 3)
251 sprintf (op
, "r%d", regd
);
253 else /* ad == 1 msp430dis_opcode. */
258 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
262 sprintf (op
, "0x%04x", dst
);
263 sprintf (comm
, "PC rel. abs addr 0x%04x",
264 PS ((short) (addr
+ 2) + dst
));
267 dst
|= extended_dst
<< 16;
268 sprintf (op
, "0x%05x", dst
);
269 sprintf (comm
, "PC rel. abs addr 0x%05lx",
270 (long)((addr
+ 2 + dst
) & 0xfffff));
277 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
281 sprintf (op
, "&0x%04x", PS (dst
));
284 dst
|= extended_dst
<< 16;
285 sprintf (op
, "&0x%05x", dst
& 0xfffff);
291 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
297 dst
|= extended_dst
<< 16;
301 sprintf (op
, "%d(r%d)", dst
, regd
);
307 case 2: /* rrc, push, call, swpb, rra, sxt, push, call, reti etc... */
314 sprintf (comm
, "r3 As==00");
319 sprintf (op
, "r%d", regd
);
325 * cycles
= print_as2_reg_name (regd
, op
, comm
, 1, 1, 3);
333 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
336 sprintf (op
, "#%d", dst
);
337 if (dst
> 9 || dst
< 0)
338 sprintf (comm
, "#0x%04x", PS (dst
));
341 dst
|= extended_dst
<< 16;
344 sprintf (op
, "#%d", dst
);
345 if (dst
> 9 || dst
< 0)
346 sprintf (comm
, "#0x%05x", dst
);
351 * cycles
= print_as3_reg_name (regd
, op
, comm
, 1, 1, 3);
359 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
362 sprintf (op
, "0x%04x", PS (dst
));
363 sprintf (comm
, "PC rel. 0x%04x",
364 PS ((short) addr
+ 2 + dst
));
367 dst
|= extended_dst
<< 16;
368 sprintf (op
, "0x%05x", dst
& 0xffff);
369 sprintf (comm
, "PC rel. 0x%05lx",
370 (long)((addr
+ 2 + dst
) & 0xfffff));
377 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
380 sprintf (op
, "&0x%04x", PS (dst
));
383 dst
|= extended_dst
<< 16;
384 sprintf (op
, "&0x%05x", dst
& 0xfffff);
392 sprintf (comm
, "r3 As==01");
397 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
402 dst
|= extended_dst
<< 16;
406 sprintf (op
, "%d(r%d)", dst
, regd
);
407 if (dst
> 9 || dst
< 0)
408 sprintf (comm
, "%05x", dst
);
415 where
= insn
& 0x03ff;
418 if (where
> 512 || where
< -511)
422 sprintf (op
, "$%+-8d", where
+ 2);
423 sprintf (comm
, "abs 0x%lx", (long) (addr
+ 2 + where
));
436 msp430_doubleoperand (disassemble_info
*info
,
437 struct msp430_opcode_s
*opcode
,
444 unsigned short extension_word
,
447 int regs
= 0, regd
= 0;
452 int extended_dst
= extension_word
& 0xf;
453 int extended_src
= (extension_word
>> 7) & 0xf;
456 regs
= (insn
& 0x0f00) >> 8;
457 as
= (insn
& 0x0030) >> 4;
458 ad
= (insn
& 0x0080) >> 7;
461 fmt
= (- opcode
->fmt
) - 1;
467 /* Special case: rla and rlc are the only 2 emulated instructions that
468 fall into two operand instructions. */
469 /* With dst, there are only:
475 basic_ins dst, dst. */
477 if (regd
!= regs
|| as
!= ad
)
478 return 0; /* May be 'data' section. */
485 strcpy (comm1
, _("Warning: illegal as emulation instr"));
489 sprintf (op1
, "r%d", regd
);
496 /* PC relative, Symbolic. */
497 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
501 sprintf (op1
, "0x%04x", PS (dst
));
502 sprintf (comm1
, "PC rel. 0x%04x",
503 PS ((short) addr
+ 2 + dst
));
506 dst
|= extended_dst
<< 16;
509 sprintf (op1
, "0x%05x", dst
& 0xfffff);
510 sprintf (comm1
, "PC rel. 0x%05lx",
511 (long)((addr
+ 2 + dst
) & 0xfffff));
518 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
522 /* If the 'src' field is not the same as the dst
523 then this is not an rla instruction. */
524 if (msp430dis_opcode_signed (addr
+ 4, info
, &src
, comm2
))
531 sprintf (op1
, "&0x%04x", PS (dst
));
534 dst
|= extended_dst
<< 16;
535 sprintf (op1
, "&0x%05x", dst
& 0xfffff);
542 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
546 dst
|= extended_dst
<< 16;
552 sprintf (op1
, "%d(r%d)", dst
, regd
);
553 if (dst
> 9 || dst
< -9)
554 sprintf (comm1
, "#0x%05x", dst
);
565 /* Two operands exactly. */
566 if (ad
== 0 && regd
== 3)
568 /* R2/R3 are illegal as dest: may be data section. */
569 strcpy (comm1
, _("Warning: illegal as 2-op instr"));
581 sprintf (comm1
, "r3 As==00");
586 sprintf (op1
, "r%d", regs
);
591 * cycles
= print_as2_reg_name (regs
, op1
, comm1
, 1, 1, regs
== 0 ? 3 : 2);
598 /* Absolute. @pc+. */
599 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
602 sprintf (op1
, "#%d", dst
);
603 if (dst
> 9 || dst
< 0)
604 sprintf (comm1
, "#0x%04x", PS (dst
));
608 dst
|= extended_src
<< 16;
611 sprintf (op1
, "#%d", dst
);
612 if (dst
> 9 || dst
< 0)
613 sprintf (comm1
, "0x%05x", dst
& 0xfffff);
618 * cycles
= print_as3_reg_name (regs
, op1
, comm1
, 1, 1, 2);
626 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
629 sprintf (op1
, "0x%04x", PS (dst
));
630 sprintf (comm1
, "PC rel. 0x%04x",
631 PS ((short) addr
+ 2 + dst
));
635 dst
|= extended_src
<< 16;
638 sprintf (op1
, "0x%05x", dst
& 0xfffff);
639 sprintf (comm1
, "PC rel. 0x%05lx",
640 (long) ((addr
+ 2 + dst
) & 0xfffff));
648 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
651 sprintf (op1
, "&0x%04x", PS (dst
));
652 sprintf (comm1
, "0x%04x", PS (dst
));
656 dst
|= extended_src
<< 16;
657 sprintf (op1
, "&0x%05x", dst
& 0xfffff);
666 sprintf (comm1
, "r3 As==01");
672 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
678 dst
|= extended_src
<< 16;
682 sprintf (op1
, "%d(r%d)", dst
, regs
);
683 if (dst
> 9 || dst
< -9)
684 sprintf (comm1
, "0x%05x", dst
);
689 /* Destination. Special care needed on addr + XXXX. */
706 sprintf (op2
, "r%d", regd
);
716 if (msp430dis_opcode_signed (addr
+ cmd_len
, info
, &dst
, comm2
))
718 sprintf (op2
, "0x%04x", PS (dst
));
719 sprintf (comm2
, "PC rel. 0x%04x",
720 PS ((short) addr
+ cmd_len
+ dst
));
723 dst
|= extended_dst
<< 16;
726 sprintf (op2
, "0x%05x", dst
& 0xfffff);
727 sprintf (comm2
, "PC rel. 0x%05lx",
728 (long)((addr
+ cmd_len
+ dst
) & 0xfffff));
736 if (msp430dis_opcode_signed (addr
+ cmd_len
, info
, &dst
, comm2
))
739 sprintf (op2
, "&0x%04x", PS (dst
));
742 dst
|= extended_dst
<< 16;
743 sprintf (op2
, "&0x%05x", dst
& 0xfffff);
749 if (msp430dis_opcode_signed (addr
+ cmd_len
, info
, &dst
, comm2
))
752 if (dst
> 9 || dst
< 0)
753 sprintf (comm2
, "0x%04x", PS (dst
));
756 dst
|= extended_dst
<< 16;
759 if (dst
> 9 || dst
< 0)
760 sprintf (comm2
, "0x%05x", dst
& 0xfffff);
762 sprintf (op2
, "%d(r%d)", dst
, regd
);
771 msp430_branchinstr (disassemble_info
*info
,
772 struct msp430_opcode_s
*opcode ATTRIBUTE_UNUSED
,
773 bfd_vma addr ATTRIBUTE_UNUSED
,
779 int regs
= 0, regd
= 0;
783 unsigned short udst
= 0;
786 regs
= (insn
& 0x0f00) >> 8;
787 as
= (insn
& 0x0030) >> 4;
789 if (regd
!= 0) /* Destination register is not a PC. */
792 /* dst is a source register. */
800 sprintf (comm1
, "r3 As==00");
806 sprintf (op1
, "r%d", regs
);
811 * cycles
= print_as2_reg_name (regs
, op1
, comm1
, 2, 1, 2);
819 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &udst
, comm1
))
822 sprintf (op1
, "#0x%04x", PS (udst
));
826 * cycles
= print_as3_reg_name (regs
, op1
, comm1
, 1, 1, 2);
835 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
839 sprintf (op1
, "0x%04x", PS (dst
));
840 sprintf (comm1
, "PC rel. 0x%04x",
841 PS ((short) addr
+ 2 + dst
));
847 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &udst
, comm1
))
850 sprintf (op1
, "&0x%04x", PS (udst
));
857 sprintf (comm1
, "r3 As==01");
862 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
865 sprintf (op1
, "%d(r%d)", dst
, regs
);
874 msp430x_calla_instr (disassemble_info
* info
,
881 unsigned int ureg
= insn
& 0xf;
882 int reg
= insn
& 0xf;
883 int am
= (insn
& 0xf0) >> 4;
885 unsigned short udst
= 0;
890 case 4: /* CALLA Rdst */
892 sprintf (op1
, "r%d", reg
);
895 case 5: /* CALLA x(Rdst) */
897 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
900 sprintf (op1
, "%d(r%d)", dst
, reg
);
902 sprintf (comm1
, "PC rel. 0x%05lx", (long) (addr
+ 2 + dst
));
904 sprintf (comm1
, "0x%05x", dst
);
908 case 6: /* CALLA @Rdst */
910 sprintf (op1
, "@r%d", reg
);
913 case 7: /* CALLA @Rdst+ */
915 sprintf (op1
, "@r%d+", reg
);
918 case 8: /* CALLA &abs20 */
919 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &udst
, comm1
))
923 sprintf (op1
, "&%d", (ureg
<< 16) + udst
);
924 sprintf (comm1
, "0x%05x", (ureg
<< 16) + udst
);
928 case 9: /* CALLA pcrel-sym */
929 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
933 sprintf (op1
, "%d(PC)", (reg
<< 16) + dst
);
934 sprintf (comm1
, "PC rel. 0x%05lx",
935 (long) (addr
+ 2 + dst
+ (reg
<< 16)));
939 case 11: /* CALLA #imm20 */
940 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &udst
, comm1
))
944 sprintf (op1
, "#%d", (ureg
<< 16) + udst
);
945 sprintf (comm1
, "0x%05x", (ureg
<< 16) + udst
);
950 strcpy (comm1
, _("Warning: unrecognised CALLA addressing mode"));
958 print_insn_msp430 (bfd_vma addr
, disassemble_info
*info
)
960 void *stream
= info
->stream
;
961 fprintf_ftype prin
= info
->fprintf_func
;
962 struct msp430_opcode_s
*opcode
;
963 char op1
[32], op2
[32], comm1
[64], comm2
[64];
968 unsigned short extension_word
= 0;
971 if (! msp430dis_opcode_unsigned (addr
, info
, &insn
, NULL
))
973 prin (stream
, ".word 0xffff; ????");
977 if (((int) addr
& 0xffff) > 0xffdf)
979 (*prin
) (stream
, "interrupt service routine at 0x%04x", 0xffff & insn
);
986 /* Check for an extension word. */
987 if ((insn
& 0xf800) == 0x1800)
989 extension_word
= insn
;
991 if (! msp430dis_opcode_unsigned (addr
, info
, &insn
, NULL
))
993 prin (stream
, ".word 0x%04x, 0xffff; ????",
999 for (opcode
= msp430_opcodes
; opcode
->name
; opcode
++)
1001 if ((insn
& opcode
->bin_mask
) == opcode
->bin_opcode
1002 && opcode
->bin_opcode
!= 0x9300)
1009 /* r0 as destination. Ad should be zero. */
1010 if (opcode
->insn_opnumb
== 3
1011 && (insn
& 0x000f) == 0
1012 && (insn
& 0x0080) == 0)
1015 msp430_branchinstr (info
, opcode
, addr
, insn
, op1
, comm1
,
1021 switch (opcode
->insn_opnumb
)
1027 cmd_len
+= msp430x_calla_instr (info
, addr
, insn
,
1028 op1
, comm1
, & cycles
);
1031 case 5: /* PUSHM/POPM */
1032 n
= (insn
& 0xf0) >> 4;
1035 sprintf (op1
, "#%d", n
+ 1);
1036 if (opcode
->bin_opcode
== 0x1400)
1038 sprintf (op2
, "r%d", reg
);
1041 sprintf (op2
, "r%d", reg
+ n
);
1043 sprintf (comm1
, "16-bit words");
1046 sprintf (comm1
, "20-bit words");
1050 cycles
= 2; /*FIXME*/
1054 case 6: /* RRAM, RRCM, RRUM, RLAM. */
1055 n
= ((insn
>> 10) & 0x3) + 1;
1057 if ((insn
& 0x10) == 0)
1059 sprintf (op1
, "#%d", n
);
1060 sprintf (op2
, "r%d", reg
);
1061 cycles
= 2; /*FIXME*/
1065 case 8: /* ADDA, CMPA, SUBA. */
1067 n
= (insn
>> 8) & 0xf;
1070 sprintf (op1
, "r%d", n
);
1076 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &bits
, comm1
))
1079 sprintf (op1
, "#%d", n
);
1081 sprintf (comm1
, "0x%05x", n
);
1085 sprintf (op2
, "r%d", reg
);
1086 cycles
= 2; /*FIXME*/
1091 n
= (insn
>> 8) & 0xf;
1092 switch ((insn
>> 4) & 0xf)
1094 case 0: /* MOVA @Rsrc, Rdst */
1096 sprintf (op1
, "@r%d", n
);
1097 if (strcmp (opcode
->name
, "bra") != 0)
1098 sprintf (op2
, "r%d", reg
);
1101 case 1: /* MOVA @Rsrc+, Rdst */
1103 if (strcmp (opcode
->name
, "reta") != 0)
1105 sprintf (op1
, "@r%d+", n
);
1106 if (strcmp (opcode
->name
, "bra") != 0)
1107 sprintf (op2
, "r%d", reg
);
1111 case 2: /* MOVA &abs20, Rdst */
1114 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &bits
, comm1
))
1117 sprintf (op1
, "&%d", n
);
1119 sprintf (comm1
, "0x%05x", n
);
1120 if (strcmp (opcode
->name
, "bra") != 0)
1121 sprintf (op2
, "r%d", reg
);
1125 case 3: /* MOVA x(Rsrc), Rdst */
1127 if (strcmp (opcode
->name
, "bra") != 0)
1128 sprintf (op2
, "r%d", reg
);
1130 if (msp430dis_opcode_signed (addr
+ 2, info
, &n
, comm1
))
1132 sprintf (op1
, "%d(r%d)", n
, reg
);
1136 sprintf (comm1
, "PC rel. 0x%05lx",
1137 (long) (addr
+ 2 + n
));
1139 sprintf (comm1
, "0x%05x", n
);
1144 case 6: /* MOVA Rsrc, &abs20 */
1147 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &bits
, comm2
))
1150 sprintf (op1
, "r%d", n
);
1151 sprintf (op2
, "&%d", reg
);
1152 if (reg
> 9 || reg
< 0)
1153 sprintf (comm2
, "0x%05x", reg
);
1157 case 7: /* MOVA Rsrc, x(Rdst) */
1159 sprintf (op1
, "r%d", n
);
1160 if (msp430dis_opcode_signed (addr
+ 2, info
, &n
, comm2
))
1162 sprintf (op2
, "%d(r%d)", n
, reg
);
1166 sprintf (comm2
, "PC rel. 0x%05lx",
1167 (long) (addr
+ 2 + n
));
1169 sprintf (comm2
, "0x%05x", n
);
1174 case 8: /* MOVA #imm20, Rdst */
1177 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &bits
, comm1
))
1182 sprintf (op1
, "#%d", n
);
1184 sprintf (comm1
, "0x%05x", n
);
1185 if (strcmp (opcode
->name
, "bra") != 0)
1186 sprintf (op2
, "r%d", reg
);
1190 case 12: /* MOVA Rsrc, Rdst */
1192 sprintf (op1
, "r%d", n
);
1193 if (strcmp (opcode
->name
, "bra") != 0)
1194 sprintf (op2
, "r%d", reg
);
1200 cycles
= 2; /* FIXME */
1207 switch (opcode
->insn_opnumb
)
1210 cmd_len
+= msp430_nooperands (opcode
, addr
, insn
, comm1
, &cycles
);
1214 msp430_doubleoperand (info
, opcode
, addr
, insn
, op1
, op2
,
1218 if (insn
& BYTE_OPERATION
)
1220 if (extension_word
!= 0 && ((extension_word
& BYTE_OPERATION
) == 0))
1225 else if (extension_word
)
1227 if (extension_word
& BYTE_OPERATION
)
1232 sprintf (comm2
, _("Warning: reserved use of A/L and B/W bits detected"));
1239 msp430_singleoperand (info
, opcode
, addr
, insn
, op1
, comm1
,
1243 && (strcmp (opcode
->name
, "swpb") == 0
1244 || strcmp (opcode
->name
, "sxt") == 0))
1246 if (insn
& BYTE_OPERATION
)
1249 sprintf (comm2
, _("Warning: reserved use of A/L and B/W bits detected"));
1251 else if (extension_word
& BYTE_OPERATION
)
1256 else if (insn
& BYTE_OPERATION
&& opcode
->fmt
!= 3)
1258 if (extension_word
!= 0 && ((extension_word
& BYTE_OPERATION
) == 0))
1263 else if (extension_word
)
1265 if (extension_word
& (1 << 6))
1270 sprintf (comm2
, _("Warning: reserved use of A/L and B/W bits detected"));
1285 /* Unknown opcode, or invalid combination of operands. */
1288 prin (stream
, ".word 0x%04x, 0x%04x; ????", extension_word
, PS (insn
));
1290 prin (stream
, "\t %s", comm1
);
1293 (*prin
) (stream
, ".word 0x%04x; ????", PS (insn
));
1297 /* Display the repeat count (if set) for extended register mode. */
1298 if (cmd_len
== 2 && ((extension_word
& 0xf) != 0))
1300 if (extension_word
& (1 << 7))
1301 prin (stream
, "rpt r%d { ", extension_word
& 0xf);
1303 prin (stream
, "rpt #%d { ", (extension_word
& 0xf) + 1);
1306 /* Special case: RRC with an extension word and the ZC bit set is actually RRU. */
1308 && (extension_word
& IGNORE_CARRY_BIT
)
1309 && strcmp (opcode
->name
, "rrc") == 0)
1310 (*prin
) (stream
, "rrux%s", bc
);
1311 else if (extension_word
&& opcode
->name
[strlen (opcode
->name
) - 1] != 'x')
1312 (*prin
) (stream
, "%sx%s", opcode
->name
, bc
);
1314 (*prin
) (stream
, "%s%s", opcode
->name
, bc
);
1317 (*prin
) (stream
, "\t%s", op1
);
1319 (*prin
) (stream
, ",");
1321 if (strlen (op1
) < 7)
1322 (*prin
) (stream
, "\t");
1324 (*prin
) (stream
, "\t");
1327 (*prin
) (stream
, "%s", op2
);
1328 if (strlen (op2
) < 8)
1329 (*prin
) (stream
, "\t");
1331 if (*comm1
|| *comm2
)
1332 (*prin
) (stream
, ";");
1336 (*prin
) (stream
, ";");
1339 if (strlen (op1
) < 7)
1340 (*prin
) (stream
, ";");
1342 (*prin
) (stream
, "\t;");
1346 (*prin
) (stream
, "%s", comm1
);
1347 if (*comm1
&& *comm2
)
1348 (*prin
) (stream
, ",");
1350 (*prin
) (stream
, " %s", comm2
);