2001-11-04 Chris Demetriou <cgd@broadcom.com>
[deliverable/binutils-gdb.git] / opcodes / m10200-dis.c
index 9572f9ea85e9d70f5f38de5b5168beedc93ff2d1..bd9a258442a80d38dc17600069c705dca9099e26 100644 (file)
@@ -1,5 +1,5 @@
 /* Disassemble MN10200 instructions.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include <stdio.h>
 
-#include "ansidecl.h"
+#include "sysdep.h"
 #include "opcode/mn10200.h" 
 #include "dis-asm.h"
 #include "opintl.h"
@@ -45,6 +45,7 @@ print_insn_mn10200 (memaddr, info)
       (*info->memory_error_func) (status, memaddr, info);
       return -1;
     }
+
   insn = *(unsigned char *) buffer;
 
   /* These are one byte insns.  */
@@ -174,7 +175,7 @@ print_insn_mn10200 (memaddr, info)
          (*info->memory_error_func) (status, memaddr, info);
          return -1;
        }
-      insn |= *(unsigned char *)buffer << 8;
+      insn |= (*(unsigned char *)buffer << 8) & 0xff00;
 
       status = (*info->read_memory_func) (memaddr + 3, buffer, 1, info);
       if (status != 0)
@@ -182,7 +183,7 @@ print_insn_mn10200 (memaddr, info)
          (*info->memory_error_func) (status, memaddr, info);
          return -1;
        }
-      insn |= *(unsigned char *)buffer;
+      insn |= (*(unsigned char *)buffer) & 0xff;
 
       status = (*info->read_memory_func) (memaddr + 2, buffer, 1, info);
       if (status != 0)
@@ -190,7 +191,7 @@ print_insn_mn10200 (memaddr, info)
          (*info->memory_error_func) (status, memaddr, info);
          return -1;
        }
-      extension = *(unsigned char *)buffer;
+      extension = (*(unsigned char *)buffer) & 0xff;
       consume = 5;
     }
   else
@@ -272,7 +273,7 @@ disassemble (memaddr, info, insn, extension, size)
              else
                {
                  value = ((insn >> (operand->shift))
-                          & ((1 << operand->bits) - 1));
+                          & ((1L << operand->bits) - 1L));
                }
 
              if ((operand->flags & MN10200_OPERAND_SIGNED) != 0)
@@ -325,7 +326,7 @@ disassemble (memaddr, info, insn, extension, size)
                (*info->print_address_func) (value, info);
 
              else 
-               (*info->fprintf_func) (info->stream, "%d", value);
+               (*info->fprintf_func) (info->stream, "%ld", value);
            }
          /* All done. */
          break;
@@ -335,6 +336,6 @@ disassemble (memaddr, info, insn, extension, size)
 
   if (!match)
     {
-       (*info->fprintf_func) (info->stream, _("unknown\t0x%04x"), insn);
+       (*info->fprintf_func) (info->stream, _("unknown\t0x%04lx"), insn);
     }
 }
This page took 0.024886 seconds and 4 git commands to generate.