* z8k-dis.c (intr_names): Removed.

(print_intr, print_flags): New functions.
	(unparse_instr): Use new functions.
This commit is contained in:
Christian Groessler 2003-12-15 22:01:43 +00:00
parent 6a9756ed29
commit a0bd404eac
2 changed files with 61 additions and 14 deletions

View file

@ -1,3 +1,9 @@
2003-12-15 Christian Groessler <chris@groessler.org>
* z8k-dis.c (intr_names): Removed.
(print_intr, print_flags): New functions.
(unparse_instr): Use new functions.
2003-12-15 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> 2003-12-15 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
* m32r-opc.c: Regenerate. * m32r-opc.c: Regenerate.

View file

@ -26,7 +26,7 @@
#include "z8k-opc.h" #include "z8k-opc.h"
#include <setjmp.h> #include <setjmp.h>
typedef struct typedef struct
{ {
/* These are all indexed by nibble number (i.e only every other entry /* These are all indexed by nibble number (i.e only every other entry
@ -472,12 +472,53 @@ unpack_instr (instr_data_s *instr_data, int is_segmented, disassemble_info *info
} }
} }
static char *intr_names[] = { static void
"all", /* 0 */ print_intr(char *tmp_str, unsigned long interrupts)
"vi", /* 1 */ {
"nvi", /* 2 */ int comma = 0;
"none" /* 3 */
}; *tmp_str = 0;
if (! (interrupts & 2))
{
strcat (tmp_str, "vi");
comma = 1;
}
if (! (interrupts & 1))
{
if (comma) strcat (tmp_str, ",");
strcat (tmp_str, "nvi");
}
}
static void
print_flags(char *tmp_str, unsigned long flags)
{
int comma = 0;
*tmp_str = 0;
if (flags & 8)
{
strcat (tmp_str, "c");
comma = 1;
}
if (flags & 4)
{
if (comma) strcat (tmp_str, ",");
strcat (tmp_str, "z");
comma = 1;
}
if (flags & 2)
{
if (comma) strcat (tmp_str, ",");
strcat (tmp_str, "s");
comma = 1;
}
if (flags & 1)
{
if (comma) strcat (tmp_str, ",");
strcat (tmp_str, "p");
}
}
static void static void
unparse_instr (instr_data_s *instr_data, int is_segmented) unparse_instr (instr_data_s *instr_data, int is_segmented)
@ -529,12 +570,12 @@ unparse_instr (instr_data_s *instr_data, int is_segmented)
strcat (out_str, tmp_str); strcat (out_str, tmp_str);
break; break;
case CLASS_IMM: case CLASS_IMM:
if (datum_value == ARG_IMM2) /* True with EI/DI instructions only. */ if (datum_value == ARG_IMM2) /* True with EI/DI instructions only. */
{ {
sprintf (tmp_str, "%s", intr_names[instr_data->interrupts]); print_intr (tmp_str, instr_data->interrupts);
strcat (out_str, tmp_str); strcat (out_str, tmp_str);
break; break;
} }
sprintf (tmp_str, "#0x%0lx", instr_data->immediate); sprintf (tmp_str, "#0x%0lx", instr_data->immediate);
strcat (out_str, tmp_str); strcat (out_str, tmp_str);
break; break;
@ -563,7 +604,7 @@ unparse_instr (instr_data_s *instr_data, int is_segmented)
strcat (out_str, tmp_str); strcat (out_str, tmp_str);
break; break;
case CLASS_FLAGS: case CLASS_FLAGS:
sprintf (tmp_str, "0x%0lx", instr_data->flags); print_flags(tmp_str, instr_data->flags);
strcat (out_str, tmp_str); strcat (out_str, tmp_str);
break; break;
case CLASS_REG_BYTE: case CLASS_REG_BYTE: