X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=riscasm.c;h=fb6c5ce18781e6ec5cb1ccc9ba90b88473244a3b;hb=c77f5e305ec19e7d445bdd138187ca7458ba5a16;hp=5681f354e5a1d480d7a97783a9f9f138e663d058;hpb=0de5c6860bd1bb7f0017e30721ed52c1cc2a720f;p=rmac diff --git a/riscasm.c b/riscasm.c index 5681f35..fb6c5ce 100644 --- a/riscasm.c +++ b/riscasm.c @@ -231,8 +231,8 @@ static int EvaluateRegisterFromTokenStream(uint32_t fixup) } // If we got a register in range (0-31), return it - if (eval <= 31) - return (int)eval; + if (eattr & RISCREG) + return (int)eval - KW_R0; // Otherwise, it's out of range & we flag an error return error(reg_err); @@ -474,8 +474,8 @@ int GenerateRISCCode(int state) { if ((tok[2] == '+') || (tok[2] == '-')) { - if ((sy->svalue & 0x1F) == 14 || (sy->svalue & 0x1F) == 15) { - indexed = (sy->svalue & 0x1F); + if ((sy->svalue - KW_R0) == 14 || (sy->svalue - KW_R0) == 15) { + indexed = (sy->svalue - KW_R0); tok++; } else @@ -590,10 +590,10 @@ int GenerateRISCCode(int state) if (sy->sattre & EQUATEDREG) { - if (((sy->svalue & 0x1F) == 14 || (sy->svalue & 0x1F) == 15) + if (((sy->svalue - KW_R0) == 14 || (sy->svalue - KW_R0) == 15) && (tok[2] != ')')) { - indexed = (sy->svalue & 0x1F); + indexed = (sy->svalue - KW_R0); tok++; } }