fixed bug in translation of BR instruction

This commit is contained in:
ceriel 1990-01-15 11:44:43 +00:00
parent 53096cbf0c
commit dd22ea4caf

View file

@ -213,7 +213,7 @@ branch(opc, exp)
exp.val -= DOTGAIN; exp.val -= DOTGAIN;
} }
if (pass >= PASS_2 && if (pass >= PASS_2 &&
((exp.typ & ~S_DOT) != DOTTYP || ! fitw(exp.val))) { ((exp.typ & ~S_DOT) != DOTTYP || ! fitw(exp.val-1))) {
serror("label too far"); serror("label too far");
} }
if (small(fitb(exp.val) && ((exp.typ & ~S_DOT) == DOTTYP), 1)) { if (small(fitb(exp.val) && ((exp.typ & ~S_DOT) == DOTTYP), 1)) {
@ -222,7 +222,7 @@ branch(opc, exp)
} }
else { else {
emit1(opc|0x20); emit1(opc|0x20);
emit2((int) exp.val); emit2((int) (exp.val - 1));
} }
} }