X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=riscasm.c;h=d2d594b31c5a0d0ae59c94dff306321e98db271b;hp=52925558f9faefb5412407ac30a958442f81f5ba;hb=d9aaeb6dc9db7a224a85e8a8ca44ddcb23cf7657;hpb=d95ee7f628ceac9af515079fb6797476557a23d2 diff --git a/riscasm.c b/riscasm.c index 5292555..d2d594b 100644 --- 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 @@ -205,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 @@ -222,7 +224,8 @@ int GenerateRISCCode(int state) break; // Single operand instructions (Rd) - // ABS, MIRROR, NEG, NOT, PACK, RESMAC, SAT8, SAT16, SAT16S, SAT24, SAT32S, UNPACK + // ABS, MIRROR, NEG, NOT, PACK, RESMAC, SAT8, SAT16, SAT16S, SAT24, SAT32S, + // UNPACK case RI_ONE: reg2 = GetRegister(FU_REGTWO); at_eol(); @@ -230,8 +233,8 @@ int GenerateRISCCode(int state) break; // Two operand instructions (Rs,Rd) - // ADD, ADDC, AND, CMP, DIV, IMACN, IMULT, IMULTN, MOVEFA, MOVETA, MULT, MMULT, - // MTOI, NORMI, OR, ROR, SH, SHA, SUB, SUBC, XOR + // ADD, ADDC, AND, CMP, DIV, IMACN, IMULT, IMULTN, MOVEFA, MOVETA, MULT, + // MMULT, MTOI, NORMI, OR, ROR, SH, SHA, SUB, SUBC, XOR case RI_TWO: if (parm == 37) altbankok = 1; // MOVEFA @@ -256,7 +259,8 @@ int GenerateRISCCode(int state) case RI_NUM_31: // Numeric operand (n,Rd) where n = 1..32 - // ADDQ, ADDQMOD, ADDQT, SHARQ, SHLQ, SHRQ, SUBQ, SUBQMOD, SUBQT, ROLQ, RORQ + // ADDQ, ADDQMOD, ADDQT, SHARQ, SHLQ, SHRQ, SUBQ, SUBQMOD, SUBQT, ROLQ, + // RORQ case RI_NUM_32: switch (type) { @@ -279,6 +283,7 @@ int GenerateRISCCode(int state) return MalformedOpcode(0x01); tok++; + riscImmTokenSeen = 1; if (expr(r_expr, &eval, &eattr, &esym) != OK) return MalformedOpcode(0x02); @@ -316,6 +321,7 @@ int GenerateRISCCode(int state) return MalformedOpcode(0x03); tok++; + riscImmTokenSeen = 1; if (expr(r_expr, &eval, &eattr, &esym) != OK) return MalformedOpcode(0x04); @@ -344,7 +350,7 @@ int GenerateRISCCode(int state) { if (eattr & TDB) //{ -//printf("risca: Doing rmark for RI_MOVEI (tdb=$%X)...\n", eattr & TDB); +//printf("RISCASM: Doing rmark for RI_MOVEI (tdb=$%X)...\n", eattr & TDB); rmark(cursect, sloc + 2, (eattr & TDB), (MLONG | MMOVEI), NULL); //} }