aboutsummaryrefslogtreecommitdiff
path: root/binutils/m68k-pinsn.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1992-02-16 20:58:45 +0000
committerPer Bothner <per@bothner.com>1992-02-16 20:58:45 +0000
commit6f34472d9365ec039c9ca0a6676f07f7115c6e13 (patch)
tree205633876a1f9e3e07ec65bf2c875d0bf1db4869 /binutils/m68k-pinsn.c
parentc3d97ef66b8f31d1903af5c39a6bb19cd3c6a411 (diff)
downloadgdb-6f34472d9365ec039c9ca0a6676f07f7115c6e13.zip
gdb-6f34472d9365ec039c9ca0a6676f07f7115c6e13.tar.gz
gdb-6f34472d9365ec039c9ca0a6676f07f7115c6e13.tar.bz2
* Makefile.in: Bump version to 1.96, and remove -beta
suffix from distribution name. * m68k-pinsn.c: New macro COERCE_SIGNED_CHAR to extract the signed value of a character (even if chars are unsigned). * sparc-pinsn.c: Add new operand types.
Diffstat (limited to 'binutils/m68k-pinsn.c')
-rw-r--r--binutils/m68k-pinsn.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/binutils/m68k-pinsn.c b/binutils/m68k-pinsn.c
index 5e796f5..4d491b4 100644
--- a/binutils/m68k-pinsn.c
+++ b/binutils/m68k-pinsn.c
@@ -24,6 +24,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "opcode/m68k.h"
+/* Sign-extend an (unsigned char). */
+#if __STDC__ == 1
+#define COERCE_SIGNED_CHAR(ch) ((signed char)(ch))
+#else
+#define COERCE_SIGNED_CHAR(ch) ((int)(((ch) ^ 0x80) & 0xFF) - 128)
+#endif
+
extern void print_address();
/* 68k instructions are never longer than this many bytes. */
@@ -42,7 +49,7 @@ static unsigned char *print_indexed ();
static void print_base ();
static int fetch_arg ();
-#define NEXTBYTE(p) (p += 2, ((char *)p)[-1])
+#define NEXTBYTE(p) (p += 2, COERCE_SIGNED_CHAR(p[-1]))
#define NEXTWORD(p) \
(p += 2, ((((char *)p)[-2]) << 8) + p[-1])
@@ -307,7 +314,7 @@ print_insn_arg (d, buffer, p, addr, stream)
if (place == 'b')
val = NEXTBYTE (p);
else if (place == 'B')
- val = buffer[1] > 127 ? buffer[1] - 256 : buffer[1];
+ val = COERCE_SIGNED_CHAR(buffer[1]);
else if (place == 'w' || place == 'W')
val = NEXTWORD (p);
else if (place == 'l' || place == 'L')