X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=expr.c;h=e552c39e9becf0d853436565d7bc4d731f5730b1;hp=1747c8441666c4d79815b9b11dd20609d027dbf8;hb=f6e6a55c4cdaf0dffa0897792dc5926c7b173a23;hpb=daf2f61a3664329ae7f9609e1e14da2b8780fd10 diff --git a/expr.c b/expr.c index 1747c84..e552c39 100644 --- a/expr.c +++ b/expr.c @@ -12,7 +12,7 @@ #include "listing.h" #include "mach.h" #include "procln.h" -#include "risca.h" +#include "riscasm.h" #include "sect.h" #include "symbol.h" #include "token.h" @@ -328,12 +328,17 @@ int expr2(void) // int expr(TOKEN * otk, VALUE * a_value, WORD * a_attr, SYM ** a_esym) { + // Passed in values (once derefenced, that is) can all be zero. They are + // there so that the expression analyzer can fill them in as needed. The + // expression analyzer gets its input from "tok", and not from anything + // passed in by the user. SYM * sy; char * p; int j; - tk = otk; // Set token pointer to 'exprbuf' (direct.c) -// symbolNum = 0; // Set symbol number in symbolPtr[] to 0 + tk = otk; // Set token pointer to 'exprbuf' (direct.c) + // Also set in various other places too (riscasm.c, e.g.) +// symbolNum = 0; // Set symbol number in symbolPtr[] to 0 // Optimize for single constant or single symbol. if ((tok[1] == EOL) @@ -381,15 +386,16 @@ int expr(TOKEN * otk, VALUE * a_value, WORD * a_attr, SYM ** a_esym) } else { -#if 0 - p = (char *)tok[1]; -#else p = string[tok[1]]; -#endif + +#if 0 j = 0; if (*p == '.') j = curenv; +#else + j = (*p == '.' ? curenv : 0); +#endif sy = lookup(p, LABEL, j); @@ -398,14 +404,22 @@ int expr(TOKEN * otk, VALUE * a_value, WORD * a_attr, SYM ** a_esym) sy->sattr |= REFERENCED; + // Check for undefined register equates + if (sy->sattre & UNDEF_EQUR) + { + errors("undefined register equate '%s'", sy->sname); +//if we return right away, it returns some spurious errors... +// return ERROR; + } + // Check register bank usage if (sy->sattre & EQUATEDREG) { if ((regbank == BANK_0) && (sy->sattre & BANK_1) && !altbankok) - warns("equated symbol \'%s\' cannot be used in register bank 0", sy->sname); + warns("equated symbol '%s' cannot be used in register bank 0", sy->sname); if ((regbank == BANK_1) && (sy->sattre & BANK_0) && !altbankok) - warns("equated symbol \'%s\' cannot be used in register bank 1", sy->sname); + warns("equated symbol '%s' cannot be used in register bank 1", sy->sname); } *tk++ = SYMBOL;