]> Shamusworld >> Repos - rmac/blobdiff - riscasm.c
Misc. whitespace cleanups, removal of unneeded code.
[rmac] / riscasm.c
index e55a9861cbb8e53b31dbf546328439fd6b5af148..b4a06d7559d064f5bde2d3ac874a52d30a3fc610 100644 (file)
--- a/riscasm.c
+++ b/riscasm.c
@@ -27,17 +27,18 @@ unsigned orgactive = 0;             // RISC org directive active
 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";
 
-// Jaguar Jump Condition Names
+// Jaguar jump condition names
 const char condname[MAXINTERNCC][5] = { 
        "NZ", "Z", "NC", "NCNZ", "NCZ", "C", "CNZ", "CZ", "NN", "NNNZ", "NNZ",
        "N", "N_NZ", "N_Z", "T", "A", "NE", "EQ", "CC", "HS", "HI", "CS", "LO",
        "PL", "MI", "F"
 };
 
-// Jaguar Jump Condition Numbers
+// Jaguar jump condition numbers
 const char condnumber[] = {
        1, 2, 4, 5, 6, 8, 9, 10, 20, 21, 22, 24, 25, 26,
        0, 0, 1, 2, 4, 4, 5,  8,  8, 20, 24, 31
@@ -161,8 +162,6 @@ int GetRegister(WORD rattr)
 
        // 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)
@@ -207,6 +206,7 @@ int GenerateRISCCode(int state)
        // 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
@@ -281,6 +281,7 @@ int GenerateRISCCode(int state)
                        return MalformedOpcode(0x01);
 
                tok++;
+               riscImmTokenSeen = 1;
 
                if (expr(r_expr, &eval, &eattr, &esym) != OK)
                        return MalformedOpcode(0x02);
@@ -318,6 +319,7 @@ int GenerateRISCCode(int state)
                        return MalformedOpcode(0x03);
 
                tok++;
+               riscImmTokenSeen = 1;
 
                if (expr(r_expr, &eval, &eattr, &esym) != OK)
                        return MalformedOpcode(0x04);