X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=riscasm.c;h=63466716173eef8ae94f8a348d3dd8981e6d479b;hp=6238cf9b0d93489f62b9e5dfa649c14f07b5afe1;hb=ff8188b7e279f99cf11ac8a283c4146af324d26f;hpb=03dd34951a331e0b8971195ccef1600fffaea2e6 diff --git a/riscasm.c b/riscasm.c index 6238cf9..6346671 100644 --- a/riscasm.c +++ b/riscasm.c @@ -127,38 +127,30 @@ void strtoupper(char * s) // static inline int MalformedOpcode(int signal) { - char buf[16]; - sprintf(buf, "%02X", signal); - return errors("Malformed opcode [internal $%s]", buf); + return error("Malformed opcode [internal $%02X]", signal); } + // // Function to return "Illegal Indexed Register" error // Anyone trying to index something other than R14 or R15 // static inline int IllegalIndexedRegister(int reg) { - char buf[16]; - sprintf(buf, "%d", reg - KW_R0); - return errors("Attempted index reference with non-indexable register (r%s)", buf); + return error("Attempted index reference with non-indexable register (r%d)", reg - KW_R0); } + // // Function to return "Illegal Indexed Register" error for EQUR scenarios // Trying to use register value within EQUR that isn't 14 or 15 // -static inline int IllegalIndexedRegisterEqur(SYM *sy) +static inline int IllegalIndexedRegisterEqur(SYM * sy) { - //char buf[160]; - char *buf = NULL; - buf = (char *)malloc((strlen(sy->sname) + 7) * sizeof(char)); - if (NULL != buf) { - sprintf(buf, "%s = r%d",sy->sname, sy->svalue); - return errors("Attempted index reference with non-indexable register within EQUR (%s)", buf); - } - return errors("Unable to allocate memory! (IllegalIndexRegisterEqur)", "OOPS"); + return error("Attempted index reference with non-indexable register within EQUR (%s = r%d)", sy->sname, sy->svalue); } + // // Build RISC instruction word // @@ -182,7 +174,7 @@ void BuildRISCIntructionWord(unsigned short opcode, int reg1, int reg2) // int GetRegister(WORD rattr) { - VALUE eval; // Expression value + uint64_t eval; // Expression value WORD eattr; // Expression attributes SYM * esym; // External symbol involved in expr. TOKEN r_expr[EXPRSIZE]; // Expression token list @@ -225,7 +217,7 @@ int GenerateRISCCode(int state) WORD attrflg; int indexed; // Indexed register flag - VALUE eval; // Expression value + uint64_t eval; // Expression value WORD eattr; // Expression attributes SYM * esym; // External symbol involved in expr. TOKEN r_expr[EXPRSIZE]; // Expression token list @@ -730,7 +722,8 @@ int GenerateRISCCode(int state) { // CC using a constant number tok++; - val = *tok; + tok++; // Toss hi LONG, as most likely not 64-bit number + val = *tok; // Use lo LONG tok++; CHECK_COMMA; } @@ -758,9 +751,7 @@ int GenerateRISCCode(int state) ccsym = lookup(string[tok[1]], LABEL, 0); if (ccsym && (ccsym->sattre & EQUATEDCC) && !(ccsym->sattre & UNDEF_CC)) - { val = ccsym->svalue; - } else return error("unknown condition code"); } @@ -805,7 +796,7 @@ int GenerateRISCCode(int state) reg2 = ((int)(eval - ((orgactive ? orgaddr : sloc) + 2))) / 2; if ((reg2 < -16) || (reg2 > 15)) - error("PC relative overflow"); + error("PC relative overflow (outside of -16 to 15)"); } BuildRISCIntructionWord(parm, reg2, reg1);