const char comment_chars[] = "!";
const char line_separator_chars[] = ";";
-const char line_comment_chars[] = "!";
+const char line_comment_chars[] = "!#";
/* This table describes all the machine specific pseudo-ops the assembler
has to support. The fields are:
#define WORD_F 32767
#define WORD_B 32768
-relax_typeS md_relax_table[C (END, 0)];
+const relax_typeS md_relax_table[C (END, 0)];
static struct hash_control *opcode_hash_control; /* Opcode mnemonics */
h8500_opcode_info *opcode;
char prev_buffer[100];
int idx = 0;
+ register relax_typeS *table;
opcode_hash_control = hash_new ();
prev_buffer[0] = 0;
}
}
- /* Initialize the relax table */
- md_relax_table[C (BRANCH, BYTE_DISP)].rlx_forward = BYTE_F;
- md_relax_table[C (BRANCH, BYTE_DISP)].rlx_backward = BYTE_B;
- md_relax_table[C (BRANCH, BYTE_DISP)].rlx_length = 2;
- md_relax_table[C (BRANCH, BYTE_DISP)].rlx_more = C (BRANCH, WORD_DISP);
-
- md_relax_table[C (BRANCH, WORD_DISP)].rlx_forward = WORD_F;
- md_relax_table[C (BRANCH, WORD_DISP)].rlx_backward = WORD_B;
- md_relax_table[C (BRANCH, WORD_DISP)].rlx_length = 3;
- md_relax_table[C (BRANCH, WORD_DISP)].rlx_more = 0;
-
- md_relax_table[C (SCB_F, BYTE_DISP)].rlx_forward = BYTE_F;
- md_relax_table[C (SCB_F, BYTE_DISP)].rlx_backward = BYTE_B;
- md_relax_table[C (SCB_F, BYTE_DISP)].rlx_length = 3;
- md_relax_table[C (SCB_F, BYTE_DISP)].rlx_more = C (SCB_F, WORD_DISP);
-
- md_relax_table[C (SCB_F, WORD_DISP)].rlx_forward = WORD_F;
- md_relax_table[C (SCB_F, WORD_DISP)].rlx_backward = WORD_B;
- md_relax_table[C (SCB_F, WORD_DISP)].rlx_length = 8;
- md_relax_table[C (SCB_F, WORD_DISP)].rlx_more = 0;
-
- md_relax_table[C (SCB_TST, BYTE_DISP)].rlx_forward = BYTE_F;
- md_relax_table[C (SCB_TST, BYTE_DISP)].rlx_backward = BYTE_B;
- md_relax_table[C (SCB_TST, BYTE_DISP)].rlx_length = 3;
- md_relax_table[C (SCB_TST, BYTE_DISP)].rlx_more = C (SCB_TST, WORD_DISP);
-
- md_relax_table[C (SCB_TST, WORD_DISP)].rlx_forward = WORD_F;
- md_relax_table[C (SCB_TST, WORD_DISP)].rlx_backward = WORD_B;
- md_relax_table[C (SCB_TST, WORD_DISP)].rlx_length = 10;
- md_relax_table[C (SCB_TST, WORD_DISP)].rlx_more = 0;
+ /* Initialize the relax table. We use a local variable to avoid
+ warnings about modifying a supposedly const data structure. */
+ table = (relax_typeS *) md_relax_table;
+ table[C (BRANCH, BYTE_DISP)].rlx_forward = BYTE_F;
+ table[C (BRANCH, BYTE_DISP)].rlx_backward = BYTE_B;
+ table[C (BRANCH, BYTE_DISP)].rlx_length = 2;
+ table[C (BRANCH, BYTE_DISP)].rlx_more = C (BRANCH, WORD_DISP);
+
+ table[C (BRANCH, WORD_DISP)].rlx_forward = WORD_F;
+ table[C (BRANCH, WORD_DISP)].rlx_backward = WORD_B;
+ table[C (BRANCH, WORD_DISP)].rlx_length = 3;
+ table[C (BRANCH, WORD_DISP)].rlx_more = 0;
+
+ table[C (SCB_F, BYTE_DISP)].rlx_forward = BYTE_F;
+ table[C (SCB_F, BYTE_DISP)].rlx_backward = BYTE_B;
+ table[C (SCB_F, BYTE_DISP)].rlx_length = 3;
+ table[C (SCB_F, BYTE_DISP)].rlx_more = C (SCB_F, WORD_DISP);
+
+ table[C (SCB_F, WORD_DISP)].rlx_forward = WORD_F;
+ table[C (SCB_F, WORD_DISP)].rlx_backward = WORD_B;
+ table[C (SCB_F, WORD_DISP)].rlx_length = 8;
+ table[C (SCB_F, WORD_DISP)].rlx_more = 0;
+
+ table[C (SCB_TST, BYTE_DISP)].rlx_forward = BYTE_F;
+ table[C (SCB_TST, BYTE_DISP)].rlx_backward = BYTE_B;
+ table[C (SCB_TST, BYTE_DISP)].rlx_length = 3;
+ table[C (SCB_TST, BYTE_DISP)].rlx_more = C (SCB_TST, WORD_DISP);
+
+ table[C (SCB_TST, WORD_DISP)].rlx_forward = WORD_F;
+ table[C (SCB_TST, WORD_DISP)].rlx_backward = WORD_B;
+ table[C (SCB_TST, WORD_DISP)].rlx_length = 10;
+ table[C (SCB_TST, WORD_DISP)].rlx_more = 0;
}
{
char *save;
char *new;
- segT seg;
save = input_line_pointer;
if (s[1] == 'p' && s[2] == 'a' && s[3] == 'g' && s[4] == 'e')
{
s += 5;
-
*page = 'p';
}
+ if (s[1] == 'h' && s[2] == 'i' && s[3] == '1' && s[4] == '6')
+ {
+ s += 5;
+ *page = 'h';
+ }
else if (s[1] == 'o' && s[2] == 'f' && s[3] == 'f')
{
s += 4;
input_line_pointer = s;
- seg = expr (0, op);
+ if (expression (op) == O_absent)
+ as_bad ("missing operand");
new = input_line_pointer;
input_line_pointer = save;
- if (SEG_NORMAL (seg))
- return new;
- switch (seg)
- {
- case SEG_ABSOLUTE:
- case SEG_UNKNOWN:
- case SEG_DIFFERENCE:
- case SEG_BIG:
- case SEG_REGISTER:
- return new;
- case SEG_ABSENT:
- as_bad ("Missing operand");
- return new;
- default:
- as_bad ("Don't understand operand of type %s", segment_name (seg));
- return new;
- }
+ return new;
}
typedef enum
{
exp->type = IMM8;
}
+ else if (exp->page == 'h')
+ {
+ exp->type = IMM16;
+ }
else
{
/* Let's work out the size from the context */
int n = exp->exp.X_add_number;
if (size8
- && exp->exp.X_seg == SEG_ABSOLUTE
+ && exp->exp.X_op == O_constant
&& ((sign == exp_signed && (n >= -128 && n <= 127))
|| (sign == exp_unsigned && (n >= 0 && (n <= 255)))
|| (sign == exp_sandu && (n >= -128 && (n <= 255)))))
}
idx++;
op->exp.X_add_symbol = 0;
- op->exp.X_subtract_symbol = 0;
+ op->exp.X_op_symbol = 0;
op->exp.X_add_number = mask;
- op->exp.X_seg = SEG_ABSOLUTE;
+ op->exp.X_op = O_constant;
op->type = IMM8;
return idx;
break;
case QIM:
if (user->type == IMM8
- && user->exp.X_seg == SEG_ABSOLUTE
+ && user->exp.X_op == O_constant
&&
(user->exp.X_add_number == -2
|| user->exp.X_add_number == -1
int low;
int high;
{
- if (operand->X_seg != SEG_ABSOLUTE
+ if (operand->X_op != O_constant
|| operand->X_add_number < low
|| operand->X_add_number > high)
{
int reloc;
int pcrel;
{
- fix_new (frag_now,
- output - frag_now->fr_literal + index,
- 4, /* always say size is 4, but we know better */
- exp->X_add_symbol,
- exp->X_subtract_symbol,
- exp->X_add_number,
- pcrel,
- reloc);
+ fix_new_exp (frag_now,
+ output - frag_now->fr_literal + index,
+ 4, /* always say size is 4, but we know better */
+ exp,
+ pcrel,
+ reloc);
}
void
case FPIND_D8:
insert (output, index, &displacement, R_H8500_IMM8, 0);
break;
+
case IMM16:
- insert (output, index, &immediate, immediate_inpage ?
- R_H8500_LOW16 : R_H8500_IMM16, 0);
+ {
+ int p;
+ switch (immediate_inpage) {
+ case 'p':
+ p = R_H8500_LOW16;
+ break;
+ case 'h':
+ p = R_H8500_HIGH16;
+ break;
+ default:
+ p = R_H8500_IMM16;
+ break;
+ }
+
+ insert (output, index, &immediate,p, 0);
+ }
+
index++;
break;
case RLIST:
void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr;
- long from_addr;
- long to_addr;
+ addressT from_addr;
+ addressT to_addr;
fragS *frag;
symbolS *to_symbol;
{
void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr;
- long from_addr, to_addr;
+ addressT from_addr, to_addr;
fragS *frag;
symbolS *to_symbol;
{
fragP->fr_fix + inst_size,
4,
fragP->fr_symbol,
- 0,
fragP->fr_offset,
0,
R_H8500_PCREL16);
}
-long
-DEFUN (md_section_align, (seg, size),
- segT seg AND
- long size)
+valueT
+md_section_align (seg, size)
+ segT seg ;
+ valueT size;
{
return ((size + (1 << section_alignment[(int) seg]) - 1)
& (-1 << section_alignment[(int) seg]));
case R_H8500_HIGH8:
*buf++ = val >> 16;
break;
+ case R_H8500_HIGH16:
+ *buf++ = val >> 24;
+ *buf++ = val >> 16;
+ break;
case R_H8500_IMM24:
*buf++ = (val >> 16);
*buf++ = (val >> 8);
void
md_number_to_chars (ptr, use, nbytes)
char *ptr;
- long use;
+ valueT use;
int nbytes;
{
switch (nbytes)