]> Shamusworld >> Repos - rmac/blobdiff - riscasm.c
Multiple fixes for 020+ mode, including:
[rmac] / riscasm.c
index 74de784e839ceb91fde20d4300a064112e49606c..33c8cd3f7023f5633ffa006e004afe9da2ef105d 100644 (file)
--- a/riscasm.c
+++ b/riscasm.c
@@ -1,7 +1,7 @@
 //
-// RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
+// RMAC - Reboot's Macro Assembler for all Atari computers
 // RISCA.C - GPU/DSP Assembler
-// Copyright (C) 199x Landon Dyer, 2011 - 2017 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2017 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
 // Source utilised with the kind permission of Landon Dyer
 //
@@ -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
 //
@@ -758,9 +750,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 +795,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);