aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2001-11-01 09:48:57 +0000
committerStephane Carrez <stcarrez@nerim.fr>2001-11-01 09:48:57 +0000
commit64e38312bcfb31f46f3d2b81e90b9a53ac8ad1c4 (patch)
tree5663fe7c49878706f1a35bd7d4c9704cbeec48b2 /opcodes
parent86c76c7be013a7d3910c507f235afd3a2d7b9d2f (diff)
downloadgdb-64e38312bcfb31f46f3d2b81e90b9a53ac8ad1c4.zip
gdb-64e38312bcfb31f46f3d2b81e90b9a53ac8ad1c4.tar.gz
gdb-64e38312bcfb31f46f3d2b81e90b9a53ac8ad1c4.tar.bz2
* m68hc11-dis.c (print_insn): Fix disassembly of movb with a
constant as source.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/m68hc11-dis.c42
2 files changed, 38 insertions, 9 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 7023644..39c807c 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2001-11-01 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+
+ * m68hc11-dis.c (print_insn): Fix disassembly of movb with a
+ constant as source.
+
2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
* Makefile.am (CFILES): Add mmix-dis.c and mmix-opc.c. Regenerate
diff --git a/opcodes/m68hc11-dis.c b/opcodes/m68hc11-dis.c
index 31fbf27..bb0cc20 100644
--- a/opcodes/m68hc11-dis.c
+++ b/opcodes/m68hc11-dis.c
@@ -366,14 +366,35 @@ print_insn (memaddr, info, arch)
(*info->fprintf_func) (info->stream, "\t");
}
- /* The movb and movw must be handled in a special way... */
- offset = 0;
- if (format & (M6812_OP_IDX_P2 | M6812_OP_IND16_P2))
- {
- if ((format & M6812_OP_IDX_P2)
- && (format & (M6811_OP_IMM8 | M6811_OP_IMM16 | M6811_OP_IND16)))
- offset = 1;
- }
+ /* The movb and movw must be handled in a special way...
+ The source constant 'ii' is not always at the same place.
+ This is the same for the destination for the post-indexed byte.
+ The 'offset' is used to do the appropriate correction.
+
+ offset offset
+ for constant for destination
+ movb 18 OB ii hh ll 0 0
+ 18 08 xb ii 1 -1
+ 18 0C hh ll hh ll 0 0
+ 18 09 xb hh ll 1 -1
+ 18 0D xb hh ll 0 0
+ 18 0A xb xb 0 0
+
+ movw 18 03 jj kk hh ll 0 0
+ 18 00 xb jj kk 1 -1
+ 18 04 hh ll hh ll 0 0
+ 18 01 xb hh ll 1 -1
+ 18 05 xb hh ll 0 0
+ 18 02 xb xb 0 0
+
+ After the source operand is read, the position 'pos' is incremented
+ this explains the negative offset for destination.
+
+ movb/movw above are the only instructions with this matching
+ format. */
+ offset = ((format & M6812_OP_IDX_P2)
+ && (format & (M6811_OP_IMM8 | M6811_OP_IMM16 |
+ M6811_OP_IND16)));
/* Operand with one more byte: - immediate, offset,
direct-low address. */
@@ -387,7 +408,10 @@ print_insn (memaddr, info, arch)
}
pos++;
- offset = -1;
+
+ /* This movb/movw is special (see above). */
+ offset = -offset;
+
if (format & M6811_OP_IMM8)
{
(*info->fprintf_func) (info->stream, "#%d", (int) buffer[0]);