ack/mach/6500/as/mach5.c

42 lines
926 B
C
Raw Permalink Normal View History

1987-03-09 16:02:32 +00:00
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
1994-06-24 14:02:31 +00:00
#define RCSID5 "$Id$"
1985-06-10 13:50:36 +00:00
/*
* Mostek 6500 special routines.
*/
2019-03-24 16:10:10 +00:00
void branch(register int opc, expr_t exp)
1985-06-10 13:50:36 +00:00
{
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);
}
}
2019-03-24 16:10:10 +00:00
void code(expr_t exp, register int opc1, register int opc2)
1985-06-10 13:50:36 +00:00
{
if (small((exp.typ & S_TYP) == S_ABS && fits_zeropage(exp.val), 1)) {
emit1(opc1); emit1(exp.val);
} else {
emit1(opc2);
#ifdef RELOCATION
newrelo(exp.typ, RELO2);
#endif
emit2(exp.val);
}
}