diff options
author | Fred Fish <fnf@specifix.com> | 1997-01-05 19:29:42 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1997-01-05 19:29:42 +0000 |
commit | 937fe722327e674b973b90e37bc4b03a99597805 (patch) | |
tree | a5dfc0cf7000ffb37e0ec0644f1dfbc101ab056c /opcodes/tic80-dis.c | |
parent | ad429fdd7f4a9a38c06ebb4c0c9f297395518ce3 (diff) | |
download | gdb-937fe722327e674b973b90e37bc4b03a99597805.zip gdb-937fe722327e674b973b90e37bc4b03a99597805.tar.gz gdb-937fe722327e674b973b90e37bc4b03a99597805.tar.bz2 |
* tic80-dis.c (M_SI, M_LI): Add macros to test for ":m" modifier bit
in an instruction.
* tic80-dis.c (print_insn_tic80): Change comma and paren handling.
Use M_SI and M_LI macros to check for ":m" modifier for GPR operands.
* tic80-opc.c (tic80_operands): Add REGM_SI and REGM_LI operands.
(F, M_REG, M_LI, M_SI, SZ_REG, SZ_LI, SZ_SI, D, S): New bit-twiddlers.
(MASK_LI_M, MASK_SI_M, MASK_REG_M): Remove and replace in opcode
masks with "MASK_* & ~M_*" to get the M bit reset.
(tic80_opcodes): Add bsr, bsr.a, cmnd, cmp, dcachec, and dcachef.
Diffstat (limited to 'opcodes/tic80-dis.c')
-rw-r--r-- | opcodes/tic80-dis.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/opcodes/tic80-dis.c b/opcodes/tic80-dis.c index 2cb0753..c615e9b 100644 --- a/opcodes/tic80-dis.c +++ b/opcodes/tic80-dis.c @@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "opcode/tic80.h" #include "dis-asm.h" +#define M_SI(insn,op) ((((op) -> flags & TIC80_OPERAND_M_SI) != 0) && ((insn) & (1 << 17))) +#define M_LI(insn,op) ((((op) -> flags & TIC80_OPERAND_M_LI) != 0) && ((insn) & (1 << 15))) + int print_insn_tic80 (memaddr, info) bfd_vma memaddr; @@ -33,8 +36,7 @@ print_insn_tic80 (memaddr, info) const struct tic80_opcode *opcode_end; const unsigned char *opindex; const struct tic80_operand *operand; - int need_comma; - int need_paren; + int close_paren; int length = 4; status = (*info->read_memory_func) (memaddr, buffer, 4, info); @@ -82,8 +84,6 @@ print_insn_tic80 (memaddr, info) (*info -> fprintf_func) (info -> stream, "%s", opcode -> name); /* Now extract and print the operands. */ - need_comma = 0; - need_paren = 0; if (opcode -> operands[0] != 0) { (*info -> fprintf_func) (info -> stream, "\t"); @@ -127,16 +127,33 @@ print_insn_tic80 (memaddr, info) value -= 1 << operand -> bits; } - if (need_comma) + /* If this operand is enclosed in parenthesis, then print + the open paren, otherwise just print the regular comma + separator, except for the first operand. */ + + if ((operand -> flags & TIC80_OPERAND_PARENS) == 0) { - (*info -> fprintf_func) (info -> stream, ","); - need_comma = 0; + close_paren = 0; + if (opindex != opcode -> operands) + { + (*info -> fprintf_func) (info -> stream, ","); + } + } + else + { + close_paren = 1; + (*info -> fprintf_func) (info -> stream, "("); } /* Print the operand as directed by the flags. */ + if ((operand -> flags & TIC80_OPERAND_GPR) != 0) { (*info -> fprintf_func) (info -> stream, "r%ld", value); + if (M_SI (insn[0], operand) || M_LI (insn[0], operand)) + { + (*info -> fprintf_func) (info -> stream, ":m"); + } } else if ((operand -> flags & TIC80_OPERAND_FPA) != 0) { @@ -275,20 +292,12 @@ print_insn_tic80 (memaddr, info) } } - if (need_paren) - { - (*info -> fprintf_func) (info -> stream, ")"); - need_paren = 0; - } + /* If we printed an open paren before printing this operand, close + it now. The flag gets reset on each loop. */ - if ((operand -> flags & TIC80_OPERAND_PARENS) == 0) + if (close_paren) { - need_comma = 1; - } - else - { - (*info -> fprintf_func) (info -> stream, "("); - need_paren = 1; + (*info -> fprintf_func) (info -> stream, ")"); } } } |