/* -*- c -*- */
-/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2020 Free Software Foundation, Inc.
Contributed by Red Hat.
Written by DJ Delorie.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "ansidecl.h"
+#include "bfd.h"
+#include "opintl.h"
#include "opcode/rl78.h"
static int trace = 0;
#define W() rl78->size = RL78_Word
#define AU ATTRIBUTE_UNUSED
-#define GETBYTE() (ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr))
+
+#define OP_BUF_LEN 20
+#define GETBYTE() (ld->rl78->n_bytes < (OP_BUF_LEN - 1) ? ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr): 0)
#define B ((unsigned long) GETBYTE())
#define SYNTAX(x) rl78->syntax = x
i -= 0x1000000;
break;
default:
- fprintf (stderr, "Programmer error: immediate() called with invalid byte count %d\n", bytes);
+ opcodes_error_handler
+ /* xgettext:c-format */
+ (_("internal error: immediate() called with invalid byte count %d"),
+ bytes);
abort();
}
return i;
RL78_Dis_Isa isa)
{
LocalData lds, * ld = &lds;
- unsigned char op_buf[20] = {0};
+ unsigned char op_buf[OP_BUF_LEN] = {0};
unsigned char *op = op_buf;
int op0, op1;
/** 1001 1001 mov %e0, %1 */
ID(mov); DM(DE, 0); SR(A);
-/** 1100 1010 mov %e0, #%1 */
+/** 1100 1010 mov %ea0, #%1 */
ID(mov); DM(DE, IMMU(1)); SC(IMMU(1));
-/** 1001 1010 mov %e0, %1 */
+/** 1001 1010 mov %ea0, %1 */
ID(mov); DM(DE, IMMU(1)); SR(A);
/** 1001 1011 mov %e0, %1 */
/** 1000 1001 mov %0, %e1 */
ID(mov); DR(A); SM(DE, 0);
-/** 1000 1010 mov %0, %e1 */
+/** 1000 1010 mov %0, %ea1 */
ID(mov); DR(A); SM(DE, IMMU(1));
/** 1000 1011 mov %0, %e1 */
/** 1011 1001 movw %e0, %1 */
ID(mov); W(); DM(DE, 0); SR(AX);
-/** 1011 1010 movw %e0, %1 */
+/** 1011 1010 movw %ea0, %1 */
ID(mov); W(); DM(DE, IMMU(1)); SR(AX);
/** 1011 1011 movw %e0, %1 */
/** 1010 1001 movw %0, %e1 */
ID(mov); W(); DR(AX); SM(DE, 0);
-/** 1010 1010 movw %0, %e1 */
+/** 1010 1010 movw %0, %ea1 */
ID(mov); W(); DR(AX); SM(DE, IMMU(1));
/** 1010 1011 movw %0, %e1 */
/** 1010 1110 movw %0, %s1 */
ID(mov); W(); DR(AX); SM(None, SFR);
-/** 11ra 1011 movw %0, %e!1 */
+/** 11ra 1011 movw %0, %es!1 */
ID(mov); W(); DRW(ra); SM(None, IMMU(2));
/** 11ra 1010 movw %0, %1 */
/*----------------------------------------------------------------------*/
/** 1101 0110 mulu x */
- if (isa == RL78_ISA_G14)
- ID(mulu);
+ ID(mulu);
/*----------------------------------------------------------------------*/
/** 0110 0001 1010 1110 xch %0, %e1 */
ID(xch); DR(A); SM(DE, 0);
-/** 0110 0001 1010 1111 xch %0, %e1 */
+/** 0110 0001 1010 1111 xch %0, %ea1 */
ID(xch); DR(A); SM(DE, IMMU(1));
/** 0110 0001 1010 1100 xch %0, %e1 */