diff options
Diffstat (limited to 'as/assemble.c')
-rw-r--r-- | as/assemble.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/as/assemble.c b/as/assemble.c index 1992068..c631905 100644 --- a/as/assemble.c +++ b/as/assemble.c @@ -9,6 +9,7 @@ #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[] = { @@ -163,6 +164,13 @@ PUBLIC void assemble() if (nocolonlabel) error(NEEDENDLABEL); #endif + if( label->value_reg_or_op.value != oldlabel) + { + dirty_pass = TRUE; + if( pass == last_pass ) + error(UNSTABLE_LABEL); + } + label->type |= LABIT; /* confirm, perhaps redundant */ if (label->type & REDBIT) { @@ -203,6 +211,7 @@ PRIVATE void asline() fqflag = #endif fdflag = fcflag = FALSE; + cpuwarn(); readline(); getsym(); if (sym != IDENT) /* expect label, mnemonic or macro */ @@ -219,6 +228,8 @@ PRIVATE void asline() else if (!(symptr->type & (MACBIT | MNREGBIT))) /* not macro, op, pseudo-op or register, expect label */ { + oldlabel = symptr->value_reg_or_op.value; + if ((nocolonlabel = (*lineptr - ':')) == 0) /* exported label? */ { sym = COLON; @@ -229,6 +240,26 @@ PRIVATE void asline() if (symptr->type & REDBIT) 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)) + { + label->data = (label->data & FORBIT) | lcdata; + label->value_reg_or_op.value = lc; + } } else if (checksegrel(symptr)) { @@ -239,12 +270,13 @@ PRIVATE void asline() symptr->type |= EXPBIT; #endif #endif - symptr->data = (symptr->data & FORBIT) | lcdata; /* remember if forward referenced */ + symptr->data = (symptr->data & FORBIT) | lcdata; symptr->value_reg_or_op.value = lc; /* unless changed by EQU,COMM or SET */ label = symptr; } + getsym(); if (sym != IDENT) { @@ -294,12 +326,17 @@ PRIVATE void asline() } } opcode = symptr->value_reg_or_op.op.opcode; +#ifdef I80386 + needcpu((page==0 && ((opcode&0xF0) == 0x60||(opcode&0xF6)==0xC0))?1:0); +#endif routine = rout_table[symptr->value_reg_or_op.op.routine]; getsym(); (*routine)(); if (sym != EOLSYM) error(JUNK_AFTER_OPERANDS); #ifdef I80386 + needcpu(page==PAGE1_OPCODE?2:0); + if (aprefix != 0) ++mcount; if (oprefix != 0) |