| OLD | NEW |
| 1 /* Disassemble ADI Blackfin Instructions. | 1 /* Disassemble ADI Blackfin Instructions. |
| 2 Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011 | 2 Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
| 3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of libopcodes. | 5 This file is part of libopcodes. |
| 6 | 6 |
| 7 This library is free software; you can redistribute it and/or modify | 7 This library is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3, or (at your option) | 9 the Free Software Foundation; either version 3, or (at your option) |
| 10 any later version. | 10 any later version. |
| 11 | 11 |
| 12 It is distributed in the hope that it will be useful, but WITHOUT | 12 It is distributed in the hope that it will be useful, but WITHOUT |
| 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | 14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 15 License for more details. | 15 License for more details. |
| 16 | 16 |
| 17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
| 18 along with this program; if not, write to the Free Software | 18 along with this program; if not, write to the Free Software |
| 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 20 MA 02110-1301, USA. */ | 20 MA 02110-1301, USA. */ |
| 21 | 21 |
| 22 #include "sysdep.h" |
| 22 #include <stdio.h> | 23 #include <stdio.h> |
| 23 #include <stdlib.h> | |
| 24 #include <string.h> | |
| 25 | 24 |
| 26 #include "opcode/bfin.h" | 25 #include "opcode/bfin.h" |
| 27 | 26 |
| 28 #ifndef PRINTF | 27 #ifndef PRINTF |
| 29 #define PRINTF printf | 28 #define PRINTF printf |
| 30 #endif | 29 #endif |
| 31 | 30 |
| 32 #ifndef EXIT | 31 #ifndef EXIT |
| 33 #define EXIT exit | 32 #define EXIT exit |
| 34 #endif | 33 #endif |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 else | 154 else |
| 156 x = constant_formats[cf].issigned ? SIGNEXTEND (x, constant_formats[cf].nbit
s) : x; | 155 x = constant_formats[cf].issigned ? SIGNEXTEND (x, constant_formats[cf].nbit
s) : x; |
| 157 | 156 |
| 158 if (constant_formats[cf].offset) | 157 if (constant_formats[cf].offset) |
| 159 x += constant_formats[cf].offset; | 158 x += constant_formats[cf].offset; |
| 160 | 159 |
| 161 if (constant_formats[cf].scale) | 160 if (constant_formats[cf].scale) |
| 162 x <<= constant_formats[cf].scale; | 161 x <<= constant_formats[cf].scale; |
| 163 | 162 |
| 164 if (constant_formats[cf].decimal) | 163 if (constant_formats[cf].decimal) |
| 165 { | 164 sprintf (buf, "%*li", constant_formats[cf].leading, x); |
| 166 if (constant_formats[cf].leading) | |
| 167 » { | |
| 168 » char ps[10]; | |
| 169 » sprintf (ps, "%%%ii", constant_formats[cf].leading); | |
| 170 » sprintf (buf, ps, x); | |
| 171 » } | |
| 172 else | |
| 173 » sprintf (buf, "%li", x); | |
| 174 } | |
| 175 else | 165 else |
| 176 { | 166 { |
| 177 if (constant_formats[cf].issigned && x < 0) | 167 if (constant_formats[cf].issigned && x < 0) |
| 178 sprintf (buf, "-0x%x", abs (x)); | 168 sprintf (buf, "-0x%x", abs (x)); |
| 179 else | 169 else |
| 180 sprintf (buf, "0x%lx", (unsigned long) x); | 170 sprintf (buf, "0x%lx", (unsigned long) x); |
| 181 } | 171 } |
| 182 | 172 |
| 183 return buf; | 173 return buf; |
| 184 } | 174 } |
| (...skipping 4622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4807 if (!comment) | 4797 if (!comment) |
| 4808 OUTS (outf, ";"); | 4798 OUTS (outf, ";"); |
| 4809 | 4799 |
| 4810 if (count == 0) | 4800 if (count == 0) |
| 4811 return 2; | 4801 return 2; |
| 4812 | 4802 |
| 4813 comment = 0; | 4803 comment = 0; |
| 4814 | 4804 |
| 4815 return count; | 4805 return count; |
| 4816 } | 4806 } |
| OLD | NEW |