Fix handling of DO; support unary + for floating-point numbers
Floating-point users generally expect to be able to use a unary plus. Fix support for the DO instruction in several places.
This commit is contained in:
parent
141d7cf68d
commit
cfbe7c3cc2
2 changed files with 20 additions and 11 deletions
13
assemble.c
13
assemble.c
|
@ -250,6 +250,9 @@ int32_t assemble(int32_t segment, int32_t offset, int bits, uint32_t cp,
|
||||||
case I_DT:
|
case I_DT:
|
||||||
wsize = 10;
|
wsize = 10;
|
||||||
break;
|
break;
|
||||||
|
case I_DO:
|
||||||
|
wsize = 16;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -564,10 +567,9 @@ int32_t insn_size(int32_t segment, int32_t offset, int bits, uint32_t cp,
|
||||||
if (instruction->opcode == -1)
|
if (instruction->opcode == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (instruction->opcode == I_DB ||
|
if (instruction->opcode == I_DB || instruction->opcode == I_DW ||
|
||||||
instruction->opcode == I_DW ||
|
instruction->opcode == I_DD || instruction->opcode == I_DQ ||
|
||||||
instruction->opcode == I_DD ||
|
instruction->opcode == I_DT || instruction->opcode == I_DO) {
|
||||||
instruction->opcode == I_DQ || instruction->opcode == I_DT) {
|
|
||||||
extop *e;
|
extop *e;
|
||||||
int32_t isize, osize, wsize = 0; /* placate gcc */
|
int32_t isize, osize, wsize = 0; /* placate gcc */
|
||||||
|
|
||||||
|
@ -588,6 +590,9 @@ int32_t insn_size(int32_t segment, int32_t offset, int bits, uint32_t cp,
|
||||||
case I_DT:
|
case I_DT:
|
||||||
wsize = 10;
|
wsize = 10;
|
||||||
break;
|
break;
|
||||||
|
case I_DO:
|
||||||
|
wsize = 16;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
18
parser.c
18
parser.c
|
@ -214,16 +214,18 @@ insn *parse_line(int pass, char *buffer, insn * result,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i == TOKEN_FLOAT && is_comma_next()) || i == '-') {
|
if ((i == TOKEN_FLOAT && is_comma_next())
|
||||||
int32_t sign = +1L;
|
|| i == '-' || i == '+') {
|
||||||
|
int32_t sign = +1;
|
||||||
|
|
||||||
if (i == '-') {
|
if (i == '+' || i == '-') {
|
||||||
char *save = stdscan_bufptr;
|
char *save = stdscan_bufptr;
|
||||||
|
int token = i;
|
||||||
|
sign = (i == '-') ? -1 : 1;
|
||||||
i = stdscan(NULL, &tokval);
|
i = stdscan(NULL, &tokval);
|
||||||
sign = -1L;
|
|
||||||
if (i != TOKEN_FLOAT || !is_comma_next()) {
|
if (i != TOKEN_FLOAT || !is_comma_next()) {
|
||||||
stdscan_bufptr = save;
|
stdscan_bufptr = save;
|
||||||
i = tokval.t_type = '-';
|
i = tokval.t_type = token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,10 +245,12 @@ insn *parse_line(int pass, char *buffer, insn * result,
|
||||||
case I_DT:
|
case I_DT:
|
||||||
eop->stringlen = 10;
|
eop->stringlen = 10;
|
||||||
break;
|
break;
|
||||||
|
case I_DO:
|
||||||
|
eop->stringlen = 16;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
error(ERR_NONFATAL, "floating-point constant"
|
error(ERR_NONFATAL, "floating-point constant"
|
||||||
" encountered in `d%c' instruction"
|
" encountered in `db' instruction");
|
||||||
? (result->opcode == I_DO) ? 'o' : 'b');
|
|
||||||
/*
|
/*
|
||||||
* fix suggested by Pedro Gimeno... original line
|
* fix suggested by Pedro Gimeno... original line
|
||||||
* was:
|
* was:
|
||||||
|
|
Loading…
Reference in a new issue