]> Shamusworld >> Repos - rmac/blobdiff - sect.c
FPU instructions debugged and stricter checks enforced
[rmac] / sect.c
diff --git a/sect.c b/sect.c
index e010ff24696f5629e6f6ebaa623ba44573192109..16a802577dcb2d8ba903e52b9aaeb5ce38bde7f4 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -308,9 +308,11 @@ int AddFixup(uint16_t attr, uint32_t loc, TOKEN * fexpr)
                // Count the # of tokens in the expression
                for(len=0; fexpr[len]!=ENDEXPR; len++)
                {
-                       // Add one to len for 2X tokens
-                       if (fexpr[len] == CONST || fexpr[len] == SYMBOL)
+                       // Add one to len for 2X tokens, two for 3X tokens
+                       if (fexpr[len] == SYMBOL)
                                len++;
+                       else if (fexpr[len] == CONST)
+                               len += 2;
                }
 
                // Add 1 for ENDEXPR
@@ -388,7 +390,7 @@ int AddFixup(uint16_t attr, uint32_t loc, TOKEN * fexpr)
 int ResolveFixups(int sno)
 {
        PTR fup;                                // Current fixup
-       uint32_t eval;                          // Expression value
+       uint64_t eval;                  // Expression value
        SYM * sy;                               // (Temp) pointer to a symbol
        uint16_t i;                             // (Temp) word
        int reg2;
@@ -549,10 +551,19 @@ int ResolveFixups(int sno)
 
                                if (eval == 0)
                                {
-                                       error("illegal bra.s with zero offset");
-                                       continue;
+                                       if (CHECK_OPTS(OPT_NULL_BRA))
+                                       {
+                                               // just output a nop
+                                               *locp++ = 0x4E;
+                                               *locp = 0x71;
+                                               continue;
+                                       }
+                                       else
+                                       {
+                                               error("illegal bra.s with zero offset");
+                                               continue;
+                                       }
                                }
-
                                *++locp = (uint8_t)eval;
                                break;
                        // Fixup one-byte value at locp + 1.