unsigned orgaddr = 0; // Org'd address
unsigned orgwarning = 0; // Has an ORG warning been issued
int lastOpcode = -1; // Last RISC opcode assembled
+uint8_t riscImmTokenSeen; // The '#' (immediate) token was seen
const char reg_err[] = "missing register R0...R31";
// Evaluate what's in the global "tok" buffer
if (expr(r_expr, &eval, &eattr, &esym) != OK)
- // Hmm, the evaluator should report the error to us...
-// return MalformedOpcode(0x00);
return ERROR;
if ((challoc - ch_size) < 4)
// Get opcode parameter and type
unsigned short parm = (WORD)(roptbl[state - 3000].parm);
unsigned type = roptbl[state - 3000].typ;
+ riscImmTokenSeen = 0; // Set to "token not seen yet"
// Detect whether the opcode parmeter passed determines that the opcode is
// specific to only one of the RISC processors and ensure it is legal in
return MalformedOpcode(0x01);
tok++;
+ riscImmTokenSeen = 1;
if (expr(r_expr, &eval, &eattr, &esym) != OK)
return MalformedOpcode(0x02);
return MalformedOpcode(0x03);
tok++;
+ riscImmTokenSeen = 1;
if (expr(r_expr, &eval, &eattr, &esym) != OK)
return MalformedOpcode(0x04);