+ // Firstly, check to see if it's a register token and return that. No
+ // need to invoke expr() for easy cases like this.
+ int reg = *tok & 255;
+ if (reg >= KW_R0 && reg <= KW_R31)
+ {
+ // Check register bank usage in the case of .equr register
+ // (encoded as bits 30 and 31 in *tok).
+ // (I still think that this is superfluous and should be taken out, see my note in token.c)
+ if (*tok & 0x80000000)
+ {
+ // Oops, with all the evaluation in token.c we now lost the equated symbol reference, so we
+ // don't know its name or anything else. Oh well...
+ if ((regbank == BANK_0) && (*tok & 0x40000000) && !altbankok)
+ return error("equated symbol cannot be used in register bank 0");
+
+ if ((regbank == BANK_1) && !(*tok & 0x40000000) && !altbankok)
+ return error("equated symbol cannot be used in register bank 1");
+ }
+ reg -= KW_R0;
+ tok++;
+ return reg;
+ }
+
+ if (*tok != SYMBOL)
+ {
+ // If at this point we don't have a symbol then it's garbage. Punt.
+ return error("Expected register number or EQUREG");
+ }
+
+ uint64_t eval; // Expression value