some nofits are actually errors

This commit is contained in:
ceriel 1987-08-06 11:17:30 +00:00
parent ce6a1b9cfc
commit 7f7f9b36cd
3 changed files with 18 additions and 12 deletions

View file

@ -15,6 +15,9 @@
#define WORDS_REVERSED /* high order word has lowest address */
#define LISTING /* enable listing facilities */
#define RELOCATION /* generate relocatable code */
#define DEBUG 0
#define Xfit(f) if (!(f)) Xnofit();
#undef valu_t
#define valu_t long

View file

@ -23,7 +23,7 @@ operation
{ branch($1, $2);}
| DBR DREG ',' expr
{ $4.val -= (DOTVAL+2);
fit(fitw($4.val));
Xfit(fitw($4.val));
emit2($1 | $2);
#ifdef RELOCATION
newrelo($4.typ, RELPC|RELO2|RELBR|RELWR);
@ -102,7 +102,7 @@ operation
| UNLK AREG
{ emit2(047130 | $2);}
| TRAP '#' absexp
{ fit(fit4($3)); emit2(047100|low4($3));}
{ Xfit(fit4($3)); emit2(047100|low4($3));}
| RTD imm
{ test68010();
emit2(047164);

View file

@ -23,19 +23,17 @@ ea_1(sz, bits)
if (bits)
serror("bad addressing categorie");
if (flag & FITW)
if (
Xfit (
! fitw(exp_1.val)
&&
(mrg_1 != 074 || ! fit16(exp_1.val))
)
nofit();
) ;
if (flag & FITB) {
if (
Xfit (
! fitb(exp_1.val)
&&
(mrg_1 != 074 || ! fit8(exp_1.val))
)
nofit();
);
if (mrg_1 == 074)
exp_1.val &= 0xFF;
}
@ -60,7 +58,7 @@ ea_2(sz, bits)
index(hibyte)
{
fit(fitb(exp_2.val));
Xfit(fitb(exp_2.val));
exp_2.val = hibyte | lowb(exp_2.val);
}
@ -92,12 +90,12 @@ shift_op(opc, sz)
return;
}
if (mrg_2 < 010) {
fit(fit3(exp_1.val));
Xfit(fit3(exp_1.val));
emit2((opc&0170430) | sz | low3(exp_1.val)<<9 | mrg_2);
return;
}
checksize(sz, 2);
fit(exp_1.val == 1);
Xfit(exp_1.val == 1);
emit2((opc&0177700) | mrg_2);
ea_2(SIZE_W, MEM|ALT);
}
@ -359,7 +357,7 @@ expr_t exp;
else
emit2(opc | lowb(exp.val));
} else {
fit(fitw(exp.val));
Xfit(fitw(exp.val));
emit2(opc);
#ifdef RELOCATION
newrelo(exp.typ, RELPC|RELO2|RELBR|RELWR);
@ -455,3 +453,8 @@ ea73(ri, sz)
checksize(sz, 2|4);
index(ri<<12 | (sz&0200)<<4);
}
Xnofit()
{
if (pass == PASS_3) serror("too big");
}