43 lines
672 B
C
43 lines
672 B
C
|
|
void
|
|
encode_imm(int opc, int sz, expr_t exp)
|
|
{
|
|
emit1(opc);
|
|
emit1(sz);
|
|
switch(sz)
|
|
{
|
|
case 4:
|
|
case 0:
|
|
emit1(exp.val);
|
|
break;
|
|
|
|
case 5:
|
|
case 1:
|
|
emit2(exp.val);
|
|
break;
|
|
|
|
default:
|
|
emit4(exp.val);
|
|
break;
|
|
}
|
|
}
|
|
|
|
void branch(register int opc, expr_t exp)
|
|
{
|
|
register int dist;
|
|
|
|
dist = exp.val - (DOTVAL + 2);
|
|
if (pass == PASS_2 && dist > 0 && !(exp.typ & S_DOT))
|
|
dist -= DOTGAIN;
|
|
if (small(fitb(dist) && (exp.typ & ~S_DOT) == DOTTYP, 3)) {
|
|
emit1(opc); emit1(dist);
|
|
} else {
|
|
emit1(opc^0x20); emit1(0x03); /* Skip over ... */
|
|
emit1(0x4C); /* ... far jump. */
|
|
#ifdef RELOCATION
|
|
newrelo(exp.typ, RELO2);
|
|
#endif
|
|
emit2(exp.val);
|
|
}
|
|
}
|