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 WORDS_REVERSED /* high order word has lowest address */
#define LISTING /* enable listing facilities */ #define LISTING /* enable listing facilities */
#define RELOCATION /* generate relocatable code */ #define RELOCATION /* generate relocatable code */
#define DEBUG 0
#define Xfit(f) if (!(f)) Xnofit();
#undef valu_t #undef valu_t
#define valu_t long #define valu_t long

View file

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

View file

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