summaryrefslogtreecommitdiff
path: root/as
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>2000-10-07 15:35:09 +0200
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:46:41 +0200
commitdfab97edd018b8904568bce77536037dd76b7507 (patch)
treefb45be914dda1e47c3d28eab6a4fc23a14c7b587 /as
parent65da95772de1633acd1bfcc7f579067bac3249af (diff)
downloaddev86-dfab97edd018b8904568bce77536037dd76b7507.tar.gz
Import Dev86src-0.15.3.tar.gzv0.15.3
Diffstat (limited to 'as')
-rw-r--r--as/as.c6
-rw-r--r--as/assemble.c19
-rw-r--r--as/error.c2
-rw-r--r--as/globvar.h2
-rw-r--r--as/mops.c11
-rw-r--r--as/pops.c19
-rw-r--r--as/readsrc.c4
7 files changed, 37 insertions, 26 deletions
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 )