diff options
Diffstat (limited to 'opcodes/avr-dis.c')
-rw-r--r-- | opcodes/avr-dis.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c index 976c371..85d7ab3 100644 --- a/opcodes/avr-dis.c +++ b/opcodes/avr-dis.c @@ -50,7 +50,7 @@ static const char * comment_start = "0x"; static int avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constraint, - char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr) + char *opcode_str, char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr) { int ok = 1; *sym = 0; @@ -118,8 +118,18 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra case 'z': *buf++ = 'Z'; - if (insn & 0x1) + + /* Check for post-increment. */ + char *s; + for (s = opcode_str; *s; ++s) + { + if (*s == '+') + { *buf++ = '+'; + break; + } + } + *buf = '\0'; if (AVR_UNDEF_P (insn)) sprintf (comment, _("undefined")); @@ -227,6 +237,10 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra } break; + case 'E': + sprintf (buf, "%d", (insn >> 4) & 15); + break; + case '?': *buf = '\0'; break; @@ -331,7 +345,8 @@ print_insn_avr (bfd_vma addr, disassemble_info *info) if (opcode->name) { - char *op = opcode->constraints; + char *constraints = opcode->constraints; + char *opcode_str = opcode->opcode; insn2 = 0; ok = 1; @@ -342,14 +357,14 @@ print_insn_avr (bfd_vma addr, disassemble_info *info) cmd_len = 4; } - if (*op && *op != '?') + if (*constraints && *constraints != '?') { - int regs = REGISTER_P (*op); + int regs = REGISTER_P (*constraints); - ok = avr_operand (insn, insn2, addr, *op, op1, comment1, 0, &sym_op1, &sym_addr1); + ok = avr_operand (insn, insn2, addr, *constraints, opcode_str, op1, comment1, 0, &sym_op1, &sym_addr1); - if (ok && *(++op) == ',') - ok = avr_operand (insn, insn2, addr, *(++op), op2, + if (ok && *(++constraints) == ',') + ok = avr_operand (insn, insn2, addr, *(++constraints), opcode_str, op2, *comment1 ? comment2 : comment1, regs, &sym_op2, &sym_addr2); } } |