]> Shamusworld >> Repos - rmac/blobdiff - sect.c
Actually implement ^^FILESIZE this time :)
[rmac] / sect.c
diff --git a/sect.c b/sect.c
index 7fcb2996bc30051a819e656b08f7ffa6db0b5e61..4dc7032c4c34a7834626589daf4f9eefa6c0df82 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -1,7 +1,7 @@
 //
 // RMAC - Reboot's Macro Assembler for all Atari computers
 // SECT.C - Code Generation, Fixups and Section Management
-// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2020 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
 // Source utilised with the kind permission of Landon Dyer
 //
@@ -455,12 +455,18 @@ int ResolveFixups(int sno)
                //
                // PC-relative fixups must be DEFINED and either in the same section
                // (whereupon the subtraction takes place) or ABS (with no subtract).
-               if (dw & FU_PCREL)
+               if ((dw & FU_PCREL) || (dw & FU_PCRELX))
                {
                        if (eattr & DEFINED)
                        {
                                if (tdb == sno)
+                               {
                                        eval -= loc;
+
+                                       // In this instruction the PC is located a DWORD away
+                                       if (dw & FU_PCRELX)
+                                               eval += 2;
+                               }
                                else if (tdb)
                                {
                                        // Allow cross-section PCREL fixups in Alcyon mode
@@ -483,6 +489,10 @@ int ResolveFixups(int sno)
                                                }
 
                                                eval -= loc;
+
+                                               // In this instruction the PC is located a DWORD away
+                                               if (dw & FU_PCRELX)
+                                                       eval += 2;
                                        }
                                        else
                                        {
@@ -495,8 +505,15 @@ int ResolveFixups(int sno)
                                        warn("unoptimized short branch");
                        }
                        else if (obj_format == MWC)
+                       {
                                eval -= loc;
 
+                               // In this instruction the PC is located a DWORD away
+                               if (dw & FU_PCRELX)
+                                       eval += 2;
+                       }
+
+                       // Be sure to clear any TDB flags, since we handled it just now
                        tdb = 0;
                        eattr &= ~TDB;
                }