/* srcdest.c --- decoding M32C addressing modes.
-Copyright (C) 2005 Free Software Foundation, Inc.
+Copyright (C) 2005-2017 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of the GNU simulators.
-The GNU simulators are free software; you can redistribute them and/or
-modify them under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+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
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
-The GNU simulators are distributed in the hope that they will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with the GNU simulators; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA */
+along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <stdlib.h>
+#include "libiberty.h"
#include "cpu.h"
#include "mem.h"
static int dest_addend = 0;
static int
-disp8 ()
+disp8 (void)
{
int rv;
int tsave = trace;
}
static int
-disp16 ()
+disp16 (void)
{
int rv;
int tsave = trace;
}
static int
-disp24 ()
+disp24 (void)
{
int rv;
int tsave = trace;
}
static int
-disp20 ()
+disp20 (void)
{
return disp24 () & 0x000fffff;
}
decode_srcdest4 (int destcode, int bw)
{
srcdest sd;
- sd.bytes = bw ? 2 : 1;
- sd.mem = (destcode >= 6) ? 1 : 0;
static const char *dc_wnames[16] = { "r0", "r1", "r2", "r3",
"a0", "a1", "[a0]", "[a1]",
"disp8[a0]", "disp8[a1]", "disp8[sb]", "disp8[fb]",
};
static const char *dc_bnames[4] = { "r0l", "r0h", "r1l", "r1h" };;
+ sd.bytes = bw ? 2 : 1;
+ sd.mem = (destcode >= 6) ? 1 : 0;
+
if (trace)
{
const char *n = dc_wnames[destcode];
decode_jumpdest (int destcode, int w)
{
srcdest sd;
- sd.bytes = w ? 2 : 3;
- sd.mem = (destcode >= 6) ? 1 : 0;
static const char *dc_wnames[16] = { "r0", "r1", "r2", "r3",
"a0", "a1", "[a0]", "[a1]",
"disp8[a0]", "disp8[a1]", "disp8[sb]", "disp8[fb]",
};
static const char *dc_anames[4] = { "r0l", "r0h", "r1l", "r1h" };
+ sd.bytes = w ? 2 : 3;
+ sd.mem = (destcode >= 6) ? 1 : 0;
+
if (trace)
{
const char *n = dc_wnames[destcode];
srcdest sd;
int code = (bbb << 2) | bb;
- if (code >= sizeof (modes23) / sizeof (modes23[0]))
+ if (code >= ARRAY_SIZE (modes23))
abort ();
if (trace)