From dfab97edd018b8904568bce77536037dd76b7507 Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Sat, 7 Oct 2000 15:35:09 +0200 Subject: Import Dev86src-0.15.3.tar.gz --- as/as.c | 6 ++++-- as/assemble.c | 19 ++----------------- as/error.c | 2 +- as/globvar.h | 2 ++ as/mops.c | 11 +++++++---- as/pops.c | 19 +++++++++++++++++++ as/readsrc.c | 4 ++-- 7 files changed, 37 insertions(+), 26 deletions(-) (limited to 'as') diff --git a/as/as.c b/as/as.c index d86d917..64f1e42 100644 --- a/as/as.c +++ b/as/as.c @@ -221,7 +221,9 @@ char **argv; #ifdef I80386 case 'j': jumps_long = flag_state; - if( jumps_long ) ++last_pass; + break; + case 'O': + if( flag_state ) last_pass = 2; else last_pass = 1; break; #endif @@ -328,7 +330,7 @@ PRIVATE void usage() { as_abort( #ifdef I80386 -"usage: as [-03agjuw] [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s sym] src"); +"usage: as [-03agjuwO] [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s sym] src"); #else "usage: as [-guw] [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s sym] src"); #endif diff --git a/as/assemble.c b/as/assemble.c index 2b92c76..062ec6d 100644 --- a/as/assemble.c +++ b/as/assemble.c @@ -9,7 +9,6 @@ #include "scan.h" PRIVATE bool_t nocolonlabel; /* set for labels not followed by ':' */ -PRIVATE offset_t oldlabel = 0; PRIVATE void (*routine) P((void)); PRIVATE pfv rout_table[] = { @@ -164,7 +163,7 @@ PUBLIC void assemble() if (nocolonlabel) error(NEEDENDLABEL); #endif - if( label->value_reg_or_op.value != oldlabel) + if(pass && label->value_reg_or_op.value != oldlabel) { dirty_pass = TRUE; if( pass == last_pass ) @@ -246,21 +245,7 @@ PRIVATE void asline() labelerror(RELAB); label = symptr; -#if 0 -if(pass==last_pass) -{ - if( ((label->data^lcdata)&~FORBIT) || label->value_reg_or_op.value != lc) - { - printf("Movement %x:%d -> %x:%d\n", - label->data, - label->value_reg_or_op.value, - lcdata, - lc); - } -} -#endif - /* This is a bit dodgy, I think it's ok but ... */ - if (pass && (label->data & RELBIT)) + if (pass /* && last_pass>1 */) { label->data = (label->data & FORBIT) | lcdata; label->value_reg_or_op.value = lc; diff --git a/as/error.c b/as/error.c index 683177f..3088ec4 100644 --- a/as/error.c +++ b/as/error.c @@ -84,7 +84,7 @@ PRIVATE char *errormessage[] = "illegal FP register pair", "junk after operands", "already defined", - "label moved in last pass, add -j?", + "label moved in last pass, add -O?", "instruction illegal for current cpu", "short branch would do", "unknown error", diff --git a/as/globvar.h b/as/globvar.h index d22f6a5..1ea385e 100644 --- a/as/globvar.h +++ b/as/globvar.h @@ -65,6 +65,8 @@ EXTERN unsigned char lcdata; /* shows how lc is bound */ /* FORBIT is set if lc is forward referenced */ /* RELBIT is is if lc is relocat. (not ASEG) */ EXTERN offset_t lcjump; /* lc jump between lines */ + +EXTERN offset_t oldlabel; /* Used for checking for moving labels */ #ifdef LOW_BYTE #define mcount (((unsigned char *) &lcjump)[LOW_BYTE]) /* low byte of lcjump */ diff --git a/as/mops.c b/as/mops.c index 2ccf0c7..f711708 100644 --- a/as/mops.c +++ b/as/mops.c @@ -1068,7 +1068,8 @@ int backamount; if (!(lastexp.data & (RELBIT | UNDBIT))) { lastexp.offset = lastexp.offset - lc - lcjump; - if (backamount != 0x0 && !(lastexp.data & IMPBIT) && + if ( last_pass<2 && backamount != 0x0 && + !(lastexp.data & IMPBIT) && lastexp.offset + backamount < 0x80 + backamount) error(SHORTB); /* -0x8? to 0x7F, warning */ } @@ -1206,7 +1207,8 @@ PUBLIC void mcall() else if (opcode == JMP_SHORT_OPCODE) { if (jumps_long && - (pass!=0 && !is8bitsignedoffset(lastexp.offset - lc - 2))) + ((pass!=0 && !is8bitsignedoffset(lastexp.offset - lc - 2)) || + (last_pass==1))) { opcode = JMP_OPCODE; lbranch(0x83); @@ -1945,7 +1947,8 @@ PUBLIC void mjcc() getea(&target); lastexp = target.displ; - if (pass!=0 && !is8bitsignedoffset(lastexp.offset - lc - 2)) + if ( (pass!=0 && !is8bitsignedoffset(lastexp.offset - lc - 2)) || + last_pass==1) { if (target.indcount >= 0x2 || target.base != NOREG) kgerror(REL_REQ); @@ -2749,7 +2752,7 @@ PUBLIC void mlong() if (!(lastexp.data & (RELBIT | UNDBIT))) { lastexp.offset = lastexp.offset - lc - lcjump; - if (!(lastexp.data & IMPBIT) && + if ( last_pass<2 && !(lastexp.data & IMPBIT) && lastexp.offset + 0x81 < 0x101) error(SHORTB); /* -0x81 to 0x7F, warning */ } diff --git a/as/pops.c b/as/pops.c index 70efaf5..eb617f2 100644 --- a/as/pops.c +++ b/as/pops.c @@ -175,6 +175,12 @@ pfv func; elseflag = FALSE; } } + else + { + /* Skip to EOL */ + while (sym != EOLSYM) + getsym(); + } } } @@ -213,6 +219,13 @@ unsigned char labits; labptr->data = lastexp.data; labptr->value_reg_or_op.value = lastexp.offset; showlabel(); + + if(pass && !(labits & VARBIT) && labptr->value_reg_or_op.value != oldlabel) + { + dirty_pass = TRUE; + if( pass == last_pass ) + error(UNSTABLE_LABEL); + } } /* common routine for ENTRY/EXPORT */ @@ -398,6 +411,12 @@ pfv func; elseflag = TRUE;/* but ELSE will change that */ } } + else + { + /* Skip to EOL */ + while (sym != EOLSYM) + getsym(); + } } } diff --git a/as/readsrc.c b/as/readsrc.c index 6cfbaf5..819efb8 100644 --- a/as/readsrc.c +++ b/as/readsrc.c @@ -15,7 +15,7 @@ /* * Ok, lots of hack & slash here. * 1) Added BIG buffer to load entire _primary_ file into memory. - * 2) This means primay file can be standard input. + * 2) This means the primary file can be standard input. * 3) Fixed so 'get/include' processing now works. * 4) Altered for a 'normal' style buffer otherwise (MINIBUF) * 5) Have the option of completely unbuffered if you need the last Kb. @@ -244,7 +244,7 @@ PUBLIC void pproceof() else if (pass!=last_pass) { pass++; - if( last_pass>2 && last_pass<30 && dirty_pass && pass==last_pass ) + if( last_pass>1 && last_pass<30 && dirty_pass && pass==last_pass ) last_pass++; if( pass==last_pass ) -- cgit v1.2.1