diff options
author | Arnold Metselaar <arnold.metselaar@planet.nl> | 2006-01-18 13:48:46 +0000 |
---|---|---|
committer | Arnold Metselaar <arnold.metselaar@planet.nl> | 2006-01-18 13:48:46 +0000 |
commit | 9e919b5f1dc4218efeff61c948229559882bca11 (patch) | |
tree | 6f3eeac60fae19a7cb5956511e46ae96535f82ed /opcodes/z80-dis.c | |
parent | 6e2c86ac4d7527225b37dba354e534ed03af747a (diff) | |
download | gdb-9e919b5f1dc4218efeff61c948229559882bca11.zip gdb-9e919b5f1dc4218efeff61c948229559882bca11.tar.gz gdb-9e919b5f1dc4218efeff61c948229559882bca11.tar.bz2 |
fixes related to indexed operands
Diffstat (limited to 'opcodes/z80-dis.c')
-rw-r--r-- | opcodes/z80-dis.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/opcodes/z80-dis.c b/opcodes/z80-dis.c index a3d1247..27d898f 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" }, |