diff options
author | Fred Fish <fnf@specifix.com> | 1997-01-30 21:16:46 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1997-01-30 21:16:46 +0000 |
commit | 6cb5b585c554607e8425dff6f70686f69d08a837 (patch) | |
tree | bfb3d2815348b6264ccbb46e75032ce9e60d4f4b /opcodes/tic80-dis.c | |
parent | c2717a801fc15ec6c37b68fb84b7091c4f747be6 (diff) | |
download | gdb-6cb5b585c554607e8425dff6f70686f69d08a837.zip gdb-6cb5b585c554607e8425dff6f70686f69d08a837.tar.gz gdb-6cb5b585c554607e8425dff6f70686f69d08a837.tar.bz2 |
* tic80-opc.c (tic80_predefined_symbols): Table of name/value
pairs for all predefined symbols recognized by the assembler.
Also used by the disassembling routines.
(tic80_symbol_to_value): New function.
(tic80_value_to_symbol): New function.
* tic80-dis.c (print_operand_control_register,
print_operand_condition_code, print_operand_bitnum):
Remove private tables and use tic80_value_to_symbol function.
Diffstat (limited to 'opcodes/tic80-dis.c')
-rw-r--r-- | opcodes/tic80-dis.c | 95 |
1 files changed, 10 insertions, 85 deletions
diff --git a/opcodes/tic80-dis.c b/opcodes/tic80-dis.c index e698437..24fb930 100644 --- a/opcodes/tic80-dis.c +++ b/opcodes/tic80-dis.c @@ -81,72 +81,9 @@ print_operand_control_register (info, value) struct disassemble_info *info; long value; { - char *tmp; + const char *tmp; - switch (value) - { - case 0: tmp = "EPC"; break; - case 1: tmp = "EIP"; break; - case 2: tmp = "CONFIG"; break; - case 4: tmp = "INTPEN"; break; - case 6: tmp = "IE"; break; - case 8: tmp = "FPST"; break; - case 0xA: tmp = "PPERROR"; break; - case 0xD: tmp = "PKTREQ"; break; - case 0xE: tmp = "TCOUNT"; break; - case 0xF: tmp = "TSCALE"; break; - case 0x10: tmp = "FLTOP"; break; - case 0x11: tmp = "FLTADR"; break; - case 0x12: tmp = "FLTTAG"; break; - case 0x13: tmp = "FLTDTL"; break; - case 0x14: tmp = "FLTDTH"; break; - case 0x20: tmp = "SYSSTK"; break; - case 0x21: tmp = "SYSTMP"; break; - case 0x30: tmp = "MPC"; break; - case 0x31: tmp = "MIP"; break; - case 0x33: tmp = "ECOMCNTL"; break; - case 0x34: tmp = "ANASTAT"; break; - case 0x39: tmp = "BRK1"; break; - case 0x3A: tmp = "BRK2"; break; - case 0x200: tmp = "ITAG0"; break; - case 0x201: tmp = "ITAG1"; break; - case 0x202: tmp = "ITAG2"; break; - case 0x203: tmp = "ITAG3"; break; - case 0x204: tmp = "ITAG4"; break; - case 0x205: tmp = "ITAG5"; break; - case 0x206: tmp = "ITAG6"; break; - case 0x207: tmp = "ITAG7"; break; - case 0x208: tmp = "ITAG8"; break; - case 0x209: tmp = "ITAG9"; break; - case 0x20A: tmp = "ITAG10"; break; - case 0x20B: tmp = "ITAG11"; break; - case 0x20C: tmp = "ITAG12"; break; - case 0x20D: tmp = "ITAG13"; break; - case 0x20E: tmp = "ITAG14"; break; - case 0x20F: tmp = "ITAG15"; break; - case 0x300: tmp = "ILRU"; break; - case 0x400: tmp = "DTAG0"; break; - case 0x401: tmp = "DTAG1"; break; - case 0x402: tmp = "DTAG2"; break; - case 0x403: tmp = "DTAG3"; break; - case 0x404: tmp = "DTAG4"; break; - case 0x405: tmp = "DTAG5"; break; - case 0x406: tmp = "DTAG6"; break; - case 0x407: tmp = "DTAG7"; break; - case 0x408: tmp = "DTAG8"; break; - case 0x409: tmp = "DTAG9"; break; - case 0x40A: tmp = "DTAG10"; break; - case 0x40B: tmp = "DTAG11"; break; - case 0x40C: tmp = "DTAG12"; break; - case 0x40D: tmp = "DTAG13"; break; - case 0x40E: tmp = "DTAG14"; break; - case 0x40F: tmp = "DTAG15"; break; - case 0x500: tmp = "DLRU"; break; - case 0x4000: tmp = "IN0P"; break; - case 0x4001: tmp = "IN1P"; break; - case 0x4002: tmp = "OUTP"; break; - default: tmp = NULL; break; - } + tmp = tic80_value_to_symbol (value, TIC80_OPERAND_CR); if (tmp != NULL) { (*info -> fprintf_func) (info -> stream, "%s", tmp); @@ -163,20 +100,15 @@ print_operand_condition_code (info, value) struct disassemble_info *info; long value; { - const char *syms[] = { - "nev.b", "gt0.b", "eq0.b", "ge0.b", "lt0.b", "ne0.b", "le0.b", "alw.b", - "nev.h", "gt0.h", "eq0.h", "ge0.h", "lt0.h", "ne0.h", "le0.h", "alw.h", - "nev.w", "gt0.w", "eq0.w", "ge0.w", "lt0.w", "ne0.w", "le0.w", "alw.w" - }; + const char *tmp; - if (value < (sizeof (syms) / sizeof (syms[0]))) + tmp = tic80_value_to_symbol (value, TIC80_OPERAND_CC); + if (tmp != NULL) { - /* Found a value within range */ - (*info -> fprintf_func) (info -> stream, "%s", syms[value]); + (*info -> fprintf_func) (info -> stream, "%s", tmp); } else { - /* Not in range, just print as decimal digit. */ (*info -> fprintf_func) (info -> stream, "%ld", value); } } @@ -188,23 +120,16 @@ print_operand_bitnum (info, value) long value; { int bitnum; - const char *syms[] = { - "eq.b", "ne.b", "gt.b", "le.b", "lt.b", "ge.b", - "hi.b", "ls.b", "lo.b", "hs.b", "eq.h", "ne.h", - "gt.h", "le.h", "lt.h", "ge.h", "hi.h", "ls.h", - "lo.h", "hs.h", "eq.w", "ne.w", "gt.w", "le.w", - "lt.w", "ge.w", "hi.w", "ls.w", "lo.w", "hs.w" - }; + const char *tmp; bitnum = ~value & 0x1F; - if (bitnum < (sizeof (syms) / sizeof (syms[0]))) + tmp = tic80_value_to_symbol (bitnum, TIC80_OPERAND_BITNUM); + if (tmp != NULL) { - /* Found a value within range */ - (*info -> fprintf_func) (info -> stream, "%s", syms[bitnum]); + (*info -> fprintf_func) (info -> stream, "%s", tmp); } else { - /* Not in range, just print as bit number */ (*info -> fprintf_func) (info -> stream, "%ld", bitnum); } } |