1 /* Disassemble MSP430 instructions.
2 Copyright (C) 2002-2019 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>
29 #include "disassemble.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));
279 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
283 sprintf (op
, "&0x%04x", PS (dst
));
286 dst
|= extended_dst
<< 16;
287 sprintf (op
, "&0x%05x", dst
& 0xfffff);
295 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
301 dst
|= extended_dst
<< 16;
305 sprintf (op
, "%d(r%d)", dst
, regd
);
313 case 2: /* rrc, push, call, swpb, rra, sxt, push, call, reti etc... */
320 sprintf (comm
, "r3 As==00");
325 sprintf (op
, "r%d", regd
);
331 * cycles
= print_as2_reg_name (regd
, op
, comm
, 1, 1, 3);
339 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
342 sprintf (op
, "#%d", dst
);
343 if (dst
> 9 || dst
< 0)
344 sprintf (comm
, "#0x%04x", PS (dst
));
347 dst
|= extended_dst
<< 16;
350 sprintf (op
, "#%d", dst
);
351 if (dst
> 9 || dst
< 0)
352 sprintf (comm
, "#0x%05x", dst
);
359 * cycles
= print_as3_reg_name (regd
, op
, comm
, 1, 1, 3);
367 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
370 sprintf (op
, "0x%04x", PS (dst
));
371 sprintf (comm
, "PC rel. 0x%04x",
372 PS ((short) addr
+ 2 + dst
));
375 dst
|= extended_dst
<< 16;
376 sprintf (op
, "0x%05x", dst
& 0xffff);
377 sprintf (comm
, "PC rel. 0x%05lx",
378 (long)((addr
+ 2 + dst
) & 0xfffff));
387 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
390 sprintf (op
, "&0x%04x", PS (dst
));
393 dst
|= extended_dst
<< 16;
394 sprintf (op
, "&0x%05x", dst
& 0xfffff);
404 sprintf (comm
, "r3 As==01");
409 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm
))
414 dst
|= extended_dst
<< 16;
418 sprintf (op
, "%d(r%d)", dst
, regd
);
419 if (dst
> 9 || dst
< 0)
420 sprintf (comm
, "%05x", dst
);
429 where
= insn
& 0x03ff;
432 if (where
> 512 || where
< -511)
436 sprintf (op
, "$%+-8d", where
+ 2);
437 sprintf (comm
, "abs 0x%lx", (long) (addr
+ 2 + where
));
450 msp430_doubleoperand (disassemble_info
*info
,
451 struct msp430_opcode_s
*opcode
,
458 unsigned short extension_word
,
461 int regs
= 0, regd
= 0;
466 int extended_dst
= extension_word
& 0xf;
467 int extended_src
= (extension_word
>> 7) & 0xf;
470 regs
= (insn
& 0x0f00) >> 8;
471 as
= (insn
& 0x0030) >> 4;
472 ad
= (insn
& 0x0080) >> 7;
475 fmt
= (- opcode
->fmt
) - 1;
481 /* Special case: rla and rlc are the only 2 emulated instructions that
482 fall into two operand instructions. */
483 /* With dst, there are only:
489 basic_ins dst, dst. */
491 if (regd
!= regs
|| as
!= ad
)
492 return 0; /* May be 'data' section. */
499 strcpy (comm1
, _("Warning: illegal as emulation instr"));
503 sprintf (op1
, "r%d", regd
);
510 /* PC relative, Symbolic. */
511 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
515 sprintf (op1
, "0x%04x", PS (dst
));
516 sprintf (comm1
, "PC rel. 0x%04x",
517 PS ((short) addr
+ 2 + dst
));
520 dst
|= extended_dst
<< 16;
523 sprintf (op1
, "0x%05x", dst
& 0xfffff);
524 sprintf (comm1
, "PC rel. 0x%05lx",
525 (long)((addr
+ 2 + dst
) & 0xfffff));
534 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
538 /* If the 'src' field is not the same as the dst
539 then this is not an rla instruction. */
540 if (msp430dis_opcode_signed (addr
+ 4, info
, &src
, comm2
))
549 sprintf (op1
, "&0x%04x", PS (dst
));
552 dst
|= extended_dst
<< 16;
553 sprintf (op1
, "&0x%05x", dst
& 0xfffff);
562 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
566 dst
|= extended_dst
<< 16;
572 sprintf (op1
, "%d(r%d)", dst
, regd
);
573 if (dst
> 9 || dst
< -9)
574 sprintf (comm1
, "#0x%05x", dst
);
587 /* Two operands exactly. */
588 if (ad
== 0 && regd
== 3)
590 /* R2/R3 are illegal as dest: may be data section. */
591 strcpy (comm1
, _("Warning: illegal as 2-op instr"));
603 sprintf (comm1
, "r3 As==00");
608 sprintf (op1
, "r%d", regs
);
613 * cycles
= print_as2_reg_name (regs
, op1
, comm1
, 1, 1, regs
== 0 ? 3 : 2);
620 /* Absolute. @pc+. */
621 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
624 sprintf (op1
, "#%d", dst
);
625 if (dst
> 9 || dst
< 0)
626 sprintf (comm1
, "#0x%04x", PS (dst
));
630 dst
|= extended_src
<< 16;
633 sprintf (op1
, "#%d", dst
);
634 if (dst
> 9 || dst
< 0)
635 sprintf (comm1
, "0x%05x", dst
& 0xfffff);
642 * cycles
= print_as3_reg_name (regs
, op1
, comm1
, 1, 1, 2);
650 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
653 sprintf (op1
, "0x%04x", PS (dst
));
654 sprintf (comm1
, "PC rel. 0x%04x",
655 PS ((short) addr
+ 2 + dst
));
659 dst
|= extended_src
<< 16;
662 sprintf (op1
, "0x%05x", dst
& 0xfffff);
663 sprintf (comm1
, "PC rel. 0x%05lx",
664 (long) ((addr
+ 2 + dst
) & 0xfffff));
674 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
677 sprintf (op1
, "&0x%04x", PS (dst
));
678 sprintf (comm1
, "0x%04x", PS (dst
));
682 dst
|= extended_src
<< 16;
683 sprintf (op1
, "&0x%05x", dst
& 0xfffff);
694 sprintf (comm1
, "r3 As==01");
700 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
706 dst
|= extended_src
<< 16;
710 sprintf (op1
, "%d(r%d)", dst
, regs
);
711 if (dst
> 9 || dst
< -9)
712 sprintf (comm1
, "0x%05x", dst
);
719 /* Destination. Special care needed on addr + XXXX. */
736 sprintf (op2
, "r%d", regd
);
746 if (msp430dis_opcode_signed (addr
+ cmd_len
, info
, &dst
, comm2
))
748 sprintf (op2
, "0x%04x", PS (dst
));
749 sprintf (comm2
, "PC rel. 0x%04x",
750 PS ((short) addr
+ cmd_len
+ dst
));
753 dst
|= extended_dst
<< 16;
756 sprintf (op2
, "0x%05x", dst
& 0xfffff);
757 sprintf (comm2
, "PC rel. 0x%05lx",
758 (long)((addr
+ cmd_len
+ dst
) & 0xfffff));
768 if (msp430dis_opcode_signed (addr
+ cmd_len
, info
, &dst
, comm2
))
771 sprintf (op2
, "&0x%04x", PS (dst
));
774 dst
|= extended_dst
<< 16;
775 sprintf (op2
, "&0x%05x", dst
& 0xfffff);
783 if (msp430dis_opcode_signed (addr
+ cmd_len
, info
, &dst
, comm2
))
786 if (dst
> 9 || dst
< 0)
787 sprintf (comm2
, "0x%04x", PS (dst
));
790 dst
|= extended_dst
<< 16;
793 if (dst
> 9 || dst
< 0)
794 sprintf (comm2
, "0x%05x", dst
& 0xfffff);
796 sprintf (op2
, "%d(r%d)", dst
, regd
);
807 msp430_branchinstr (disassemble_info
*info
,
808 struct msp430_opcode_s
*opcode ATTRIBUTE_UNUSED
,
809 bfd_vma addr ATTRIBUTE_UNUSED
,
815 int regs
= 0, regd
= 0;
819 unsigned short udst
= 0;
822 regs
= (insn
& 0x0f00) >> 8;
823 as
= (insn
& 0x0030) >> 4;
825 if (regd
!= 0) /* Destination register is not a PC. */
828 /* dst is a source register. */
836 sprintf (comm1
, "r3 As==00");
842 sprintf (op1
, "r%d", regs
);
847 * cycles
= print_as2_reg_name (regs
, op1
, comm1
, 2, 1, 2);
855 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &udst
, comm1
))
858 sprintf (op1
, "#0x%04x", PS (udst
));
864 * cycles
= print_as3_reg_name (regs
, op1
, comm1
, 1, 1, 2);
873 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
877 sprintf (op1
, "0x%04x", PS (dst
));
878 sprintf (comm1
, "PC rel. 0x%04x",
879 PS ((short) addr
+ 2 + dst
));
887 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &udst
, comm1
))
890 sprintf (op1
, "&0x%04x", PS (udst
));
899 sprintf (comm1
, "r3 As==01");
904 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
907 sprintf (op1
, "%d(r%d)", dst
, regs
);
918 msp430x_calla_instr (disassemble_info
* info
,
925 unsigned int ureg
= insn
& 0xf;
926 int reg
= insn
& 0xf;
927 int am
= (insn
& 0xf0) >> 4;
929 unsigned short udst
= 0;
934 case 4: /* CALLA Rdst */
936 sprintf (op1
, "r%d", reg
);
939 case 5: /* CALLA x(Rdst) */
941 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
944 sprintf (op1
, "%d(r%d)", dst
, reg
);
946 sprintf (comm1
, "PC rel. 0x%05lx", (long) (addr
+ 2 + dst
));
948 sprintf (comm1
, "0x%05x", dst
);
954 case 6: /* CALLA @Rdst */
956 sprintf (op1
, "@r%d", reg
);
959 case 7: /* CALLA @Rdst+ */
961 sprintf (op1
, "@r%d+", reg
);
964 case 8: /* CALLA &abs20 */
965 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &udst
, comm1
))
969 sprintf (op1
, "&%d", (ureg
<< 16) + udst
);
970 sprintf (comm1
, "0x%05x", (ureg
<< 16) + udst
);
976 case 9: /* CALLA pcrel-sym */
977 if (msp430dis_opcode_signed (addr
+ 2, info
, &dst
, comm1
))
981 sprintf (op1
, "%d(PC)", (reg
<< 16) + dst
);
982 sprintf (comm1
, "PC rel. 0x%05lx",
983 (long) (addr
+ 2 + dst
+ (reg
<< 16)));
989 case 11: /* CALLA #imm20 */
990 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &udst
, comm1
))
994 sprintf (op1
, "#%d", (ureg
<< 16) + udst
);
995 sprintf (comm1
, "0x%05x", (ureg
<< 16) + udst
);
1002 strcpy (comm1
, _("Warning: unrecognised CALLA addressing mode"));
1010 print_insn_msp430 (bfd_vma addr
, disassemble_info
*info
)
1012 void *stream
= info
->stream
;
1013 fprintf_ftype prin
= info
->fprintf_func
;
1014 struct msp430_opcode_s
*opcode
;
1015 char op1
[32], op2
[32], comm1
[64], comm2
[64];
1017 unsigned short insn
;
1020 unsigned short extension_word
= 0;
1021 unsigned short bits
;
1023 if (! msp430dis_opcode_unsigned (addr
, info
, &insn
, NULL
))
1026 if (((int) addr
& 0xffff) > 0xffdf)
1028 (*prin
) (stream
, "interrupt service routine at 0x%04x", 0xffff & insn
);
1035 /* Check for an extension word. */
1036 if ((insn
& 0xf800) == 0x1800)
1038 extension_word
= insn
;
1040 if (! msp430dis_opcode_unsigned (addr
, info
, &insn
, NULL
))
1044 for (opcode
= msp430_opcodes
; opcode
->name
; opcode
++)
1046 if ((insn
& opcode
->bin_mask
) == opcode
->bin_opcode
1047 && opcode
->bin_opcode
!= 0x9300)
1054 /* r0 as destination. Ad should be zero. */
1055 if (opcode
->insn_opnumb
== 3
1056 && (insn
& 0x000f) == 0
1057 && (insn
& 0x0080) == 0)
1060 msp430_branchinstr (info
, opcode
, addr
, insn
, op1
, comm1
,
1070 switch (opcode
->insn_opnumb
)
1077 ret
= msp430x_calla_instr (info
, addr
, insn
,
1078 op1
, comm1
, & cycles
);
1084 case 5: /* PUSHM/POPM */
1085 n
= (insn
& 0xf0) >> 4;
1088 sprintf (op1
, "#%d", n
+ 1);
1089 if (opcode
->bin_opcode
== 0x1400)
1091 sprintf (op2
, "r%d", reg
);
1094 sprintf (op2
, "r%d", reg
+ n
);
1096 sprintf (comm1
, "16-bit words");
1099 sprintf (comm1
, "20-bit words");
1103 cycles
= 2; /*FIXME*/
1107 case 6: /* RRAM, RRCM, RRUM, RLAM. */
1108 n
= ((insn
>> 10) & 0x3) + 1;
1110 if ((insn
& 0x10) == 0)
1112 sprintf (op1
, "#%d", n
);
1113 sprintf (op2
, "r%d", reg
);
1114 cycles
= 2; /*FIXME*/
1118 case 8: /* ADDA, CMPA, SUBA. */
1120 n
= (insn
>> 8) & 0xf;
1123 sprintf (op1
, "r%d", n
);
1129 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &bits
, comm1
))
1132 sprintf (op1
, "#%d", n
);
1134 sprintf (comm1
, "0x%05x", n
);
1140 sprintf (op2
, "r%d", reg
);
1141 cycles
= 2; /*FIXME*/
1146 n
= (insn
>> 8) & 0xf;
1147 switch ((insn
>> 4) & 0xf)
1149 case 0: /* MOVA @Rsrc, Rdst */
1151 sprintf (op1
, "@r%d", n
);
1152 if (strcmp (opcode
->name
, "bra") != 0)
1153 sprintf (op2
, "r%d", reg
);
1156 case 1: /* MOVA @Rsrc+, Rdst */
1158 if (strcmp (opcode
->name
, "reta") != 0)
1160 sprintf (op1
, "@r%d+", n
);
1161 if (strcmp (opcode
->name
, "bra") != 0)
1162 sprintf (op2
, "r%d", reg
);
1166 case 2: /* MOVA &abs20, Rdst */
1169 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &bits
, comm1
))
1172 sprintf (op1
, "&%d", n
);
1174 sprintf (comm1
, "0x%05x", n
);
1175 if (strcmp (opcode
->name
, "bra") != 0)
1176 sprintf (op2
, "r%d", reg
);
1182 case 3: /* MOVA x(Rsrc), Rdst */
1184 if (strcmp (opcode
->name
, "bra") != 0)
1185 sprintf (op2
, "r%d", reg
);
1187 if (msp430dis_opcode_signed (addr
+ 2, info
, &n
, comm1
))
1189 sprintf (op1
, "%d(r%d)", n
, reg
);
1193 sprintf (comm1
, "PC rel. 0x%05lx",
1194 (long) (addr
+ 2 + n
));
1196 sprintf (comm1
, "0x%05x", n
);
1203 case 6: /* MOVA Rsrc, &abs20 */
1206 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &bits
, comm2
))
1209 sprintf (op1
, "r%d", n
);
1210 sprintf (op2
, "&%d", reg
);
1211 if (reg
> 9 || reg
< 0)
1212 sprintf (comm2
, "0x%05x", reg
);
1218 case 7: /* MOVA Rsrc, x(Rdst) */
1220 sprintf (op1
, "r%d", n
);
1221 if (msp430dis_opcode_signed (addr
+ 2, info
, &n
, comm2
))
1223 sprintf (op2
, "%d(r%d)", n
, reg
);
1227 sprintf (comm2
, "PC rel. 0x%05lx",
1228 (long) (addr
+ 2 + n
));
1230 sprintf (comm2
, "0x%05x", n
);
1237 case 8: /* MOVA #imm20, Rdst */
1240 if (msp430dis_opcode_unsigned (addr
+ 2, info
, &bits
, comm1
))
1245 sprintf (op1
, "#%d", n
);
1247 sprintf (comm1
, "0x%05x", n
);
1248 if (strcmp (opcode
->name
, "bra") != 0)
1249 sprintf (op2
, "r%d", reg
);
1255 case 12: /* MOVA Rsrc, Rdst */
1257 sprintf (op1
, "r%d", n
);
1258 if (strcmp (opcode
->name
, "bra") != 0)
1259 sprintf (op2
, "r%d", reg
);
1265 cycles
= 2; /* FIXME */
1272 switch (opcode
->insn_opnumb
)
1277 cmd_len
+= msp430_nooperands (opcode
, addr
, insn
, comm1
, &cycles
);
1281 msp430_doubleoperand (info
, opcode
, addr
, insn
, op1
, op2
,
1289 if (insn
& BYTE_OPERATION
)
1291 if (extension_word
!= 0 && ((extension_word
& BYTE_OPERATION
) == 0))
1296 else if (extension_word
)
1298 if (extension_word
& BYTE_OPERATION
)
1303 sprintf (comm2
, _("Warning: reserved use of A/L and B/W bits detected"));
1310 msp430_singleoperand (info
, opcode
, addr
, insn
, op1
, comm1
,
1318 && (strcmp (opcode
->name
, "swpb") == 0
1319 || strcmp (opcode
->name
, "sxt") == 0))
1321 if (insn
& BYTE_OPERATION
)
1324 sprintf (comm2
, _("Warning: reserved use of A/L and B/W bits detected"));
1326 else if (extension_word
& BYTE_OPERATION
)
1331 else if (insn
& BYTE_OPERATION
&& opcode
->fmt
!= 3)
1333 if (extension_word
!= 0 && ((extension_word
& BYTE_OPERATION
) == 0))
1338 else if (extension_word
)
1340 if (extension_word
& (1 << 6))
1345 sprintf (comm2
, _("Warning: reserved use of A/L and B/W bits detected"));
1360 /* Unknown opcode, or invalid combination of operands. */
1363 prin (stream
, ".word 0x%04x, 0x%04x; ????", extension_word
, PS (insn
));
1365 prin (stream
, "\t %s", comm1
);
1368 (*prin
) (stream
, ".word 0x%04x; ????", PS (insn
));
1372 /* Display the repeat count (if set) for extended register mode. */
1373 if (cmd_len
== 2 && ((extension_word
& 0xf) != 0))
1375 if (extension_word
& (1 << 7))
1376 prin (stream
, "rpt r%d { ", extension_word
& 0xf);
1378 prin (stream
, "rpt #%d { ", (extension_word
& 0xf) + 1);
1381 /* Special case: RRC with an extension word and the ZC bit set is actually RRU. */
1383 && (extension_word
& IGNORE_CARRY_BIT
)
1384 && strcmp (opcode
->name
, "rrc") == 0)
1385 (*prin
) (stream
, "rrux%s", bc
);
1386 else if (extension_word
&& opcode
->name
[strlen (opcode
->name
) - 1] != 'x')
1387 (*prin
) (stream
, "%sx%s", opcode
->name
, bc
);
1389 (*prin
) (stream
, "%s%s", opcode
->name
, bc
);
1392 (*prin
) (stream
, "\t%s", op1
);
1394 (*prin
) (stream
, ",");
1396 if (strlen (op1
) < 7)
1397 (*prin
) (stream
, "\t");
1399 (*prin
) (stream
, "\t");
1402 (*prin
) (stream
, "%s", op2
);
1403 if (strlen (op2
) < 8)
1404 (*prin
) (stream
, "\t");
1406 if (*comm1
|| *comm2
)
1407 (*prin
) (stream
, ";");
1411 (*prin
) (stream
, ";");
1414 if (strlen (op1
) < 7)
1415 (*prin
) (stream
, ";");
1417 (*prin
) (stream
, "\t;");
1421 (*prin
) (stream
, "%s", comm1
);
1422 if (*comm1
&& *comm2
)
1423 (*prin
) (stream
, ",");
1425 (*prin
) (stream
, " %s", comm2
);