/* tc-z8k.c -- Assemble code for the Zilog Z800n
- Copyright (C) 1992-2019 Free Software Foundation, Inc.
+ Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
const char FLT_CHARS[] = "rRsSfFdDxXpP";
/* Opcode mnemonics. */
-static struct hash_control *opcode_hash_control;
+static htab_t opcode_hash_control;
void
md_begin (void)
{
const opcode_entry_type *opcode;
- int idx = -1;
+ unsigned int idx = -1u;
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
for (opcode = z8k_table; opcode->name; opcode++)
{
/* Only enter unique codes into the table. */
if (idx != opcode->idx)
- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->name, opcode, 0);
idx = opcode->idx;
}
fake_opcode->name = md_pseudo_table[idx].poc_name;
fake_opcode->func = (void *) (md_pseudo_table + idx);
fake_opcode->opcode = 250;
- hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode);
+ str_hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode, 0);
}
}
int found = 0;
unsigned int noperands = opcode->noperands;
- int this_index = opcode->idx;
+ unsigned int this_index = opcode->idx;
while (this_index == opcode->idx && !found)
{
return 0;
}
-static char buffer[20];
+static unsigned char buffer[20];
static void
newfix (int ptr, bfd_reloc_code_real_type type, int size, expressionS *operand)
}
}
-static char *
-apply_fix (char *ptr, bfd_reloc_code_real_type type, expressionS *operand,
- int size)
+static unsigned char *
+apply_fix (unsigned char *ptr, bfd_reloc_code_real_type type,
+ expressionS *operand, int size)
{
long n = operand->X_add_number;
static void
build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSED)
{
- char *output_ptr = buffer;
+ unsigned char *output_ptr = buffer;
int c;
int nibble;
unsigned int *class_ptr;
/* Copy from the nibble buffer into the frag. */
{
int length = (output_ptr - buffer) / 2;
- char *src = buffer;
- char *fragp = frag_more (length);
+ unsigned char *src = buffer;
+ unsigned char *fragp = (unsigned char *) frag_more (length);
while (src < output_ptr)
{
- *fragp = (src[0] << 4) | src[1];
+ *fragp = ((src[0] & 0xf) << 4) | (src[1] & 0xf);
src += 2;
fragp++;
}
}
c = *op_end;
- *op_end = 0; /* Zero-terminate op code string for hash_find() call. */
+ *op_end = 0; /* Zero-terminate op code string for str_hash_find() call. */
- opcode = (opcode_entry_type *) hash_find (opcode_hash_control, op_start);
+ opcode = (opcode_entry_type *) str_hash_find (opcode_hash_control, op_start);
if (opcode == NULL)
{