#include file moved

This commit is contained in:
Steve Chamberlain 1992-08-31 22:53:15 +00:00
parent a4ef860176
commit cfb48ce52d
1 changed files with 34 additions and 23 deletions

View File

@ -25,7 +25,7 @@
#include <stdio.h> #include <stdio.h>
#define DEFINE_TABLE #define DEFINE_TABLE
#include "disasm/z8kopcode.h" #include "../opcodes/z8k-opc.h"
#include "as.h" #include "as.h"
#include "bfd.h" #include "bfd.h"
@ -475,10 +475,10 @@ DEFUN(get_operand,(ptr, mode, dst),
static static
char * char *
DEFUN(get_operands,(operand, op_end, operand), DEFUN(get_operands,(opcode, op_end, operand),
opcode_entry_type *opcode AND opcode_entry_type *opcode AND
char *op_end AND char *op_end AND
op_type *operand) op_type *operand)
{ {
char *ptr = op_end; char *ptr = op_end;
switch (opcode->noperands) switch (opcode->noperands)
@ -585,13 +585,13 @@ DEFUN(check_operand,(operand, width, string),
static void static void
DEFUN(newfix,(ptr, type, operand), DEFUN(newfix,(ptr, type, operand),
int byte AND int ptr AND
int type AND int type AND
op_type *operand) op_type *operand)
{ {
fix_new(frag_now, fix_new(frag_now,
byte, ptr,
1, 1,
operand->exp.X_add_symbol, operand->exp.X_add_symbol,
operand->exp.X_subtract_symbol, operand->exp.X_subtract_symbol,
@ -626,7 +626,7 @@ static void
mode */ mode */
length += 2; length += 2;
} }
output = frag_more(this_try->length); output = frag_more(length);
memset(buffer, 20, 0); memset(buffer, 20, 0);
class_ptr = this_try->byte_info; class_ptr = this_try->byte_info;
top: ; top: ;
@ -641,12 +641,12 @@ memset(buffer, 20, 0);
case CLASS_ADDRESS: case CLASS_ADDRESS:
/* Direct address, we don't cope with the SS mode right now */ /* Direct address, we don't cope with the SS mode right now */
if (segmented_mode) { if (segmented_mode) {
newfix(nibble/2, R_DA | R_SEG, da_address); newfix((output_ptr-buffer)/2, R_DA | R_SEG, da_address);
output_ptr += 4; output_ptr += 8;
} }
else { else {
newfix(nibble/2, R_DA, da_address); newfix((output_ptr-buffer)/2, R_DA, da_address);
output_ptr += 2; output_ptr += 4;
} }
da_address = 0; da_address = 0;
break; break;
@ -676,17 +676,17 @@ memset(buffer, 20, 0);
switch (c & ARG_MASK) switch (c & ARG_MASK)
{ {
case ARG_IMM4: case ARG_IMM4:
newfix(nibble/2, R_IMM4L, imm_operand); newfix((output_ptr-buffer)/2, R_IMM4L, imm_operand);
*output_ptr++ = 0; *output_ptr++ = 0;
break; break;
case ARG_IMM8: case ARG_IMM8:
newfix(nibble/2, R_IMM8, imm_operand); newfix((output_ptr-buffer)/2, R_IMM8, imm_operand);
*output_ptr++ = 0; *output_ptr++ = 0;
*output_ptr++ = 0; *output_ptr++ = 0;
case ARG_IMM16: case ARG_IMM16:
newfix(nibble/2, R_IMM16, imm_operand); newfix((output_ptr-buffer)/2, R_IMM16, imm_operand);
*output_ptr++ = 0; *output_ptr++ = 0;
*output_ptr++ = 0; *output_ptr++ = 0;
*output_ptr++ = 0; *output_ptr++ = 0;
@ -694,7 +694,7 @@ memset(buffer, 20, 0);
break; break;
case ARG_IMM32: case ARG_IMM32:
newfix(nibble/2, R_IMM32, imm_operand); newfix((output_ptr-buffer)/2, R_IMM32, imm_operand);
*output_ptr++ = 0; *output_ptr++ = 0;
*output_ptr++ = 0; *output_ptr++ = 0;
*output_ptr++ = 0; *output_ptr++ = 0;
@ -705,7 +705,6 @@ memset(buffer, 20, 0);
*output_ptr++ = 0; *output_ptr++ = 0;
*output_ptr++ = 0; *output_ptr++ = 0;
output_ptr +=8;
break; break;
default: default:
@ -799,7 +798,7 @@ void
where[0] = 0x0; where[0] = 0x0;
where[1] = 0x0; where[1] = 0x0;
as_bad("error"); as_bad("Can't find opcode to match operands");
return; return;
} }
@ -950,20 +949,32 @@ long val;
{ {
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
switch(fixP->fx_size) { switch(fixP->fx_r_type) {
case 1: case R_IMM4L:
*buf++=val; buf[0] = (buf[0] & 0xf0) | ((buf[0] + val) & 0xf);
break; break;
case 2:
case R_IMM8:
buf[0] += val;
break;
case R_DA:
case R_IMM16:
*buf++=(val>>8); *buf++=(val>>8);
*buf++=val; *buf++=val;
break; break;
case 4: case R_IMM32:
*buf++=(val>>24); *buf++=(val>>24);
*buf++=(val>>16); *buf++=(val>>16);
*buf++=(val>>8); *buf++=(val>>8);
*buf++=val; *buf++=val;
break; break;
case R_DA | R_SEG:
*buf++ = (val>>16);
*buf++ = 0x00;
*buf++ = (val>>8);
*buf++ = val;
break;
default: default:
abort(); abort();