]> Shamusworld >> Repos - rmac/blobdiff - sect.c
Roll back TOKENPTR changes and most of the .u32 changes weren't needed.
[rmac] / sect.c
diff --git a/sect.c b/sect.c
index 7bba11ce209de36016ea70274456c75321fe8b77..3e127656916367fa1f7573336582f7a951f9501e 100644 (file)
--- a/sect.c
+++ b/sect.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
 // SECT.C - Code Generation, Fixups and Section Management
-// Copyright (C) 199x Landon Dyer, 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
 //
@@ -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
-       VALUE eval;                             // Expression value
+       uint64_t eval;                  // Expression value
        SYM * sy;                               // (Temp) pointer to a symbol
        uint16_t i;                             // (Temp) word
        int reg2;
@@ -514,7 +516,7 @@ int ResolveFixups(int sno)
                                if (eattr & DEFINED)
                                {
                                        if (tdb == sno)
-                                               eval -= (VALUE)loc;
+                                               eval -= (uint32_t)loc;
                                        else if (tdb)
                                        {
                                                error("PC-relative expr across sections");
@@ -525,7 +527,7 @@ int ResolveFixups(int sno)
                                                warn("unoptimized short branch");
                                }
                                else if (obj_format == MWC)
-                                       eval -= (VALUE)loc;
+                                       eval -= (uint32_t)loc;
 
                                tdb = 0;
                                eattr &= ~TDB;