]> Shamusworld >> Repos - rmac/blobdiff - mark.c
Minor code cleanups.
[rmac] / mark.c
diff --git a/mark.c b/mark.c
index ca7152e81bdf643f76a035715a661b4de1095e74..1cb0f05131472f9d097dbdf5fe152ba58ef8c03e 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -1,7 +1,7 @@
 //
 // RMAC - Reboot's Macro Assembler for all Atari computers
 // MARK.C - A record of things that are defined relative to any of the sections
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
 // Source utilised with the kind permission of Landon Dyer
 //
@@ -469,8 +469,18 @@ printf("(sect[TEXT].sloc=$%X) --> ", sect[TEXT].sloc);
                                                // place to prevent a bad address at link time. :-P As
                                                // a consequence of this, the highest address we can
                                                // have here is $1FFFF8.
+                                               uint32_t diffsave = diff;
                                                diff = ((diff & 0x001FFFFF) << 11) | olBitsSave;
                                                SETBE32(dp, 0, diff);
+                                               // But we need those 3 bits, otherwise we can get in
+                                               // trouble with things like OL data that is in the cart
+                                               // space, and BOOM! So the 2nd phrase of the fixup (it
+                                               // will *always* have a 2nd phrase) has a few spare
+                                               // bits, we chuck them in there.
+                                               uint32_t p2 = GETBE32(dp, 8);
+                                               p2 &= 0x1FFFFFFF;
+                                               p2 |= (diffsave & 0x00E00000) << 8;
+                                               SETBE32(dp, 8, p2);
                                        }
                                        else                                    // LONG relocation
                                        {