const char comment_chars[] =
{';', 0};
const char line_separator_chars[] =
-{'$', 0};
+{0};
const char line_comment_chars[] = "#";
/* This table describes all the machine specific pseudo-ops the assembler
int bsize = L_8; /* default branch displacement */
-void
+void
h8300hmode ()
{
Hmode = 1;
}
-void
+void
sbranch (size)
int size;
{
bsize = size;
}
+static void pint ()
+{
+ cons (Hmode ? 4 : 2);
+}
+
const pseudo_typeS md_pseudo_table[] =
{
{"sbranch", sbranch, L_8},
{"lbranch", sbranch, L_16},
- {"int", cons, 2},
+ {"int", pint, 0},
{"data.b", cons, 1},
{"data.w", cons, 2},
{"data.l", cons, 4},
}
*dst++ = *src++;
}
- *dst++ = 0;
+ *dst++ = 0;
if (strcmp (buffer, prev_buffer))
{
hash_insert (opcode_hash_control, buffer, (char *) opcode);
}
char *
-DEFUN (parse_exp, (s, op),
- char *s AND
- expressionS * op)
+parse_exp (s, op)
+ char *s;
+ expressionS * op;
{
char *save = input_line_pointer;
char *new;
input_line_pointer = s;
- if (expression (op) == O_absent)
+ expression (op);
+ if (op->X_op == O_absent)
as_bad ("missing operand");
new = input_line_pointer;
input_line_pointer = save;
{
ptr++;
/* ff fill any 8 bit quantity */
- exp->X_add_number |= 0xff00;
+ /* exp->X_add_number -= 0x100;*/
}
else
{
{
if (Hmode)
mode = L_24;
- else
+ else
mode = L_16;
- }
+ }
else if (op->exp.X_add_symbol
|| op->exp.X_op_symbol)
mode = DSYMMODE;
}
op->mode |= mode;
return src;
-
+
}
*ptr = src + len;
return;
}
- if (*src == '(' )
+ if (*src == '(')
{
/* Disp */
src++;
if (*src == ')')
{
src++;
- op->mode = DISP | direction;
+ op->mode |= ABS | direction;
*ptr = src;
return;
}
static
char *
-DEFUN (get_operands, (noperands, op_end, operand),
- unsigned int noperands AND
- char *op_end AND
- struct h8_op *operand)
+get_operands (noperands, op_end, operand)
+ unsigned int noperands;
+ char *op_end;
+ struct h8_op *operand;
{
char *ptr = op_end;
&& (op & (DISP | IMM | ABS)) == (x & (DISP | IMM | ABS)))
{
/* Got a diplacement,will fit if no size or same size as try */
+ if (op & ABS && op & L_8)
+ {
+ /* We want an 8 bit abs here, but one which looks like 16 bits will do fine */
+ if (x & L_16)
+ found= 1;
+ }
+ else
if ((x & SIZE) != 0
&& ((op & SIZE) != (x & SIZE)))
found = 0;
}
+#if 0
else if ((op & ABSMOV) && (x & ABS))
{
+ /* An absmov is only
/* Ok */
}
+#endif
else if ((op & MODE) != (x & MODE))
{
found = 0;
}
static void
-DEFUN (check_operand, (operand, width, string),
- struct h8_op *operand AND
- unsigned int width AND
- char *string)
+check_operand (operand, width, string)
+ struct h8_op *operand;
+ unsigned int width;
+ char *string;
{
if (operand->exp.X_add_symbol == 0
&& operand->exp.X_op_symbol == 0)
{
/* No symbol involved, let's look at offset, it's dangerous if any of
- the high bits are not 0 or ff's, find out by oring or anding with
- the width and seeing if the answer is 0 or all fs*/
+ the high bits are not 0 or ff's, find out by oring or anding with
+ the width and seeing if the answer is 0 or all fs*/
+
if ((operand->exp.X_add_number & ~width) != 0 &&
(operand->exp.X_add_number | width) != (~0))
{
+ if (width == 255
+ && (operand->exp.X_add_number & 0xff00) == 0xff00)
+ {
+ /* Just ignore this one - which happens when trying to
+ fit a 16 bit address truncated into an 8 bit address of something like bset */
+ }
+ else
+ {
as_warn ("operand %s0x%x out of range.", string, operand->exp.X_add_number);
}
+ }
}
}
char *bytes = frag_now->fr_literal + offset;
switch (operand->mode & SIZE)
{
+ case L_2:
+ check_operand (operand, 0x3, t);
+ bytes[0] |= (operand->exp.X_add_number) << 4;
+ break;
case L_3:
check_operand (operand, 0x7, t);
bytes[0] |= (operand->exp.X_add_number) << 4;
{
switch (operand->mode & SIZE)
{
- default:
- abort ();
+
case L_24:
size = 4;
where = -1;
idx = relaxing ? R_MOVLB1 : R_RELLONG;
break;
-
+ default:
+ as_bad("Can't work out size of operand.\n");
case L_32:
size = 4;
where = 0;
idx = R_RELBYTE;
}
-
- operand->exp.X_add_number = (short) operand->exp.X_add_number;
+ /* Sign extend any expression */
+ operand->exp.X_add_number = (short)operand->exp.X_add_number;
fix_new_exp (frag_now,
offset + where,
size,
op_type c;
char high;
unsigned int nibble_count = 0;
-
+ int absat;
int immat;
int nib;
char asnibbles[30];
nib = dispreg;
}
- else if (c & ABSMOV)
+ else if (c & ABSMOV)
{
operand[d].mode &= ~ABS;
operand[d].mode |= ABSMOV;
immat = nibble_count / 2;
nib = 0;
}
- else if (c & (IMM | PCREL | ABS | ABSJMP | DISP ))
+ else if (c & ABS )
+ {
+ operand[d].mode = c;
+ absat = nibble_count / 2;
+ nib = 0;
+ }
+ else if (c & (IMM | PCREL | ABS | ABSJMP | DISP))
{
operand[d].mode = c;
immat = nibble_count / 2;
{
int x = operand[i].mode;
- if (x & (IMM | ABS | DISP))
+ if (x & (IMM | DISP))
+ {
+ do_a_fix_imm (output - frag_now->fr_literal + immat, operand + i, 0);
+ }
+ else if (x & ABS)
{
- do_a_fix_imm (output - frag_now->fr_literal + immat, operand + i,0);
+ do_a_fix_imm (output - frag_now->fr_literal + absat, operand + i, 0);
}
else if (x & PCREL)
{
else if (x & ABSMOV)
{
/* This mov is either absolute long or thru a memory loc */
- do_a_fix_imm (output - frag_now->fr_literal + immat, operand + i,1);
+ do_a_fix_imm (output - frag_now->fr_literal + immat, operand + i, 1);
}
else if (x & ABSJMP)
{
/* This jmp may be a jump or a branch */
- check_operand (operand + i, Hmode ? 0xfffff : 0xffff, "@");
+ check_operand (operand + i, Hmode ? 0xffffff : 0xffff, "@");
if (operand[i].exp.X_add_number & 1)
{
as_warn ("branch operand has odd offset (%x)\n",
operand->exp.X_add_number);
}
- operand[i].exp.X_add_number = (short) operand[i].exp.X_add_number;
+ if (!Hmode)
+ operand[i].exp.X_add_number = (short) operand[i].exp.X_add_number;
fix_new_exp (frag_now,
output - frag_now->fr_literal,
4,
*/
static void
-DEFUN (clever_message, (opcode, operand),
- struct h8_opcode *opcode AND
- struct h8_op *operand)
+clever_message (opcode, operand)
+ struct h8_opcode *opcode;
+ struct h8_op *operand;
{
struct h8_opcode *scan = opcode;
void
-DEFUN (md_assemble, (str),
- char *str)
+md_assemble (str)
+ char *str;
{
char *op_start;
char *op_end;
return;
}
+ /* We use to set input_line_pointer to the result of get_operands,
+ but that is wrong. Our caller assumes we don't change it. */
- input_line_pointer = get_operands (opcode->noperands, op_end,
- operand);
+ (void) get_operands (opcode->noperands, op_end, operand);
*op_end = c;
prev_opcode = opcode;
}
void
-DEFUN (tc_crawl_symbol_chain, (headers),
- object_headers * headers)
+tc_crawl_symbol_chain (headers)
+ object_headers * headers;
{
printf ("call to tc_crawl_symbol_chain \n");
}
symbolS *
-DEFUN (md_undefined_symbol, (name),
- char *name)
+md_undefined_symbol (name)
+ char *name;
{
return 0;
}
void
-DEFUN (tc_headers_hook, (headers),
- object_headers * headers)
+tc_headers_hook (headers)
+ object_headers * headers;
{
printf ("call to tc_headers_hook \n");
}
-void
-DEFUN_VOID (md_end)
-{
-}
-
/* Various routines to kill one day */
/* Equal to MAX_PRECISION in atof-ieee.c */
#define MAX_LITTLENUMS 6
md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
- return "";
+ return 0;
}
+\f
+CONST char *md_shortopts = "";
+struct option md_longopts[] = {
+ {NULL, no_argument, NULL, 0}
+};
+size_t md_longopts_size = sizeof(md_longopts);
int
-md_parse_option (argP, cntP, vecP)
- char **argP;
- int *cntP;
- char ***vecP;
-
+md_parse_option (c, arg)
+ int c;
+ char *arg;
{
return 0;
-
}
+void
+md_show_usage (stream)
+ FILE *stream;
+{
+}
+\f
int md_short_jump_size;
void
abort ();
}
-valueT md_section_align (seg, size)
+valueT
+md_section_align (seg, size)
segT seg;
valueT size;
{
}
void
-DEFUN (md_operand, (expressionP), expressionS * expressionP)
+md_operand (expressionP)
+ expressionS * expressionP;
{
}
int md_long_jump_size;
+
int
md_estimate_size_before_relax (fragP, segment_type)
register fragS *fragP;
/* Put number into target byte order */
void
-DEFUN (md_number_to_chars, (ptr, use, nbytes),
- char *ptr AND
- valueT use AND
- int nbytes)
+md_number_to_chars (ptr, use, nbytes)
+ char *ptr;
+ valueT use;
+ int nbytes;
{
switch (nbytes)
{
abort ();
}
-void
-tc_coff_symbol_emit_hook ()
-{
-}
-
void
tc_reloc_mangle (fix_ptr, intr, base)