summaryrefslogtreecommitdiff
path: root/opcodes/z80-dis.c
diff options
context:
space:
mode:
authorArnold Metselaar <arnold.metselaar@planet.nl>2006-01-18 13:48:46 +0000
committerArnold Metselaar <arnold.metselaar@planet.nl>2006-01-18 13:48:46 +0000
commit9fbf73eb6931b10c46f82a91c2738e900675745d (patch)
tree6a0196d6f4635c27e2e2a0bb4d412bbe3c63254d /opcodes/z80-dis.c
parentf79a4c564c3618382ac25cf16a98a437f1b8d73d (diff)
downloadbinutils-redhat-9fbf73eb6931b10c46f82a91c2738e900675745d.tar.gz
fixes related to indexed operands
Diffstat (limited to 'opcodes/z80-dis.c')
-rw-r--r--opcodes/z80-dis.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/opcodes/z80-dis.c b/opcodes/z80-dis.c
index a3d1247706..27d898fed3 100644
--- a/opcodes/z80-dis.c
+++ b/opcodes/z80-dis.c
@@ -26,7 +26,7 @@ struct buffer
bfd_vma base;
int n_fetch;
int n_used;
- unsigned char data[4];
+ signed char data[4];
} ;
typedef int (*func)(struct buffer *, disassemble_info *, char *);
@@ -39,7 +39,7 @@ struct tab_elt
char * text;
} ;
-#define TXTSIZ 16
+#define TXTSIZ 24
/* Names of 16-bit registers. */
static char * rr_str[] = { "bc", "de", "hl", "sp" };
/* Names of 8-bit registers. */
@@ -61,7 +61,7 @@ fetch_data (struct buffer *buf, disassemble_info * info, int n)
abort ();
r = info->read_memory_func (buf->base + buf->n_fetch,
- buf->data + buf->n_fetch,
+ (unsigned char*) buf->data + buf->n_fetch,
n, info);
if (r == 0)
buf->n_fetch += n;
@@ -377,7 +377,7 @@ static int
prt_d (struct buffer *buf, disassemble_info * info, char *txt)
{
int d;
- unsigned char *p;
+ signed char *p;
p = buf->data + buf->n_fetch;
@@ -398,7 +398,7 @@ prt_d_n (struct buffer *buf, disassemble_info * info, char *txt)
{
char mytxt[TXTSIZ];
int d;
- unsigned char *p;
+ signed char *p;
p = buf->data + buf->n_fetch;
@@ -418,7 +418,7 @@ static int
arit_d (struct buffer *buf, disassemble_info * info, char *txt)
{
char mytxt[TXTSIZ];
- unsigned char c;
+ signed char c;
c = buf->data[buf->n_fetch - 1];
snprintf (mytxt, TXTSIZ, txt, arit_str[(c >> 3) & 7]);
@@ -429,7 +429,7 @@ static int
ld_r_d (struct buffer *buf, disassemble_info * info, char *txt)
{
char mytxt[TXTSIZ];
- unsigned char c;
+ signed char c;
c = buf->data[buf->n_fetch - 1];
snprintf (mytxt, TXTSIZ, txt, r_str[(c >> 3) & 7]);
@@ -440,7 +440,7 @@ static int
ld_d_r(struct buffer *buf, disassemble_info * info, char *txt)
{
char mytxt[TXTSIZ];
- unsigned char c;
+ signed char c;
c = buf->data[buf->n_fetch - 1];
snprintf (mytxt, TXTSIZ, txt, r_str[c & 7]);
@@ -454,16 +454,16 @@ pref_xd_cb (struct buffer * buf, disassemble_info * info, char* txt)
{
int d;
char arg[TXTSIZ];
- unsigned char *p;
+ signed char *p;
buf->n_used = 4;
p = buf->data;
d = p[2];
if (((p[3] & 0xC0) == 0x40) || ((p[3] & 7) == 0x06))
- snprintf (arg, TXTSIZ, "(%s+%d)", txt, d);
+ snprintf (arg, TXTSIZ, "(%s%+d)", txt, d);
else
- snprintf (arg, TXTSIZ, "(%s+%d),%s", txt, d, r_str[p[3] & 7]);
+ snprintf (arg, TXTSIZ, "(%s%+d),%s", txt, d, r_str[p[3] & 7]);
if ((p[3] & 0xc0) == 0)
info->fprintf_func (info->stream, "%s %s",
@@ -494,18 +494,18 @@ static struct tab_elt opc_ind[] =
{ 0x2B, 0xFF, prt, "dec %s" },
{ 0x29, 0xFF, addvv, "%s" },
{ 0x09, 0xCF, prt_rr, "add %s," },
- { 0x34, 0xFF, prt_d, "inc (%s+%%d)" },
- { 0x35, 0xFF, prt_d, "dec (%s+%%d)" },
- { 0x36, 0xFF, prt_d_n, "ld (%s+%%d),0x%%02x" },
+ { 0x34, 0xFF, prt_d, "inc (%s%%+d)" },
+ { 0x35, 0xFF, prt_d, "dec (%s%%+d)" },
+ { 0x36, 0xFF, prt_d_n, "ld (%s%%+d),0x%%%%02x" },
{ 0x76, 0xFF, dump, "h" },
- { 0x46, 0xC7, ld_r_d, "ld %%s,(%s+%%%%d)" },
- { 0x70, 0xF8, ld_d_r, "ld (%s+%%%%d),%%s" },
+ { 0x46, 0xC7, ld_r_d, "ld %%s,(%s%%%%+d)" },
+ { 0x70, 0xF8, ld_d_r, "ld (%s%%%%+d),%%s" },
{ 0x64, 0xF6, ld_v_v, "%s" },
{ 0x60, 0xF0, ld_r_r, "ld %s%%s,%%s" },
{ 0x44, 0xC6, ld_r_r, "ld %%s,%s%%s" },
- { 0x86, 0xC7, arit_d, "%%s(%s+%%%%d)" },
+ { 0x86, 0xC7, arit_d, "%%s(%s%%%%+d)" },
{ 0x84, 0xC6, arit_r, "%%s%s%%s" },
{ 0xE1, 0xFF, prt, "pop %s" },