Minor tweak for OP data address fixups. Now at version 1.13.1.
authorShamus Hammons <jlhamm@acm.org>
Tue, 27 Feb 2018 02:43:58 +0000 (20:43 -0600)
committerShamus Hammons <jlhamm@acm.org>
Tue, 27 Feb 2018 02:43:58 +0000 (20:43 -0600)
.gitignore
docs/note-on-the-op-assembler.txt
makefile
mark.c
rmac.c
sect.c
version.h

index 8266a9c64842530bc7c4aa63d2c575c5686e041f..52dc3f724a20c6cca63e4c3d0b9f3e88db1cbea1 100644 (file)
@@ -29,4 +29,4 @@ tmp/
 elf/
 tests/
 regression-tests/
-rmac-*
+versions/
index 8a3d14b41d79c4bf7b85ef3171f5f5996fe4b93d..8fc3db128fc62b4fa65f71c12c8396e7d1f42838 100644 (file)
@@ -91,7 +91,8 @@ A: Yes, it will emit NOPs to ensure that bitmaps and scbitmaps are on proper
    memory boundaries, and fixup link addresses as necessary. This is needed
    because of a quirk in how the OP works (it ORs constants on the address
    lines to get the phrases it needs and if they are not zeroes, it will fail
-   in bizarre ways).
+   in bizarre ways). It will also set all <ypos> constants on the correct
+   half-line (as that's how the OP views them).
 
 
 Q: Why can't I define the link addresses for all the objects?
index f966ea1e3daf8e28f3995b42e2af53e2759b0395..a1ffcc84c3edd159c4cb97d7364d0f4f8dac728b 100644 (file)
--- a/makefile
+++ b/makefile
@@ -152,7 +152,7 @@ rmac : $(OBJS)
 #
 
 clean:
-       $(rm) $(OBJS) kwgen.o 68kgen.o rmac kwgen 68kgen kwtab.h 68ktab.h mntab.h risckw.h 6502kw.h
+       $(rm) $(OBJS) kwgen.o 68kgen.o rmac kwgen 68kgen kwtab.h 68ktab.h mntab.h risckw.h 6502kw.h opkw.h
 
 #
 # Dependencies
diff --git a/mark.c b/mark.c
index ca7152e81bdf643f76a035715a661b4de1095e74..a5e1975498d33d3fd155267e957581d795b21907 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -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
                                        {
diff --git a/rmac.c b/rmac.c
index 199cff759e18ba3aea3c64aa25eb39fce21051a5..9dd75fdb86f8efabe6f92c990fd6a278c4e4c3da 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -209,7 +209,7 @@ void DisplayVersion(void)
                "| |  | | | | | | (_| | (__ \n"
                "|_|  |_| |_| |_|\\__,_|\\___|\n"
                "\nReboot's Macro Assembler\n"
-               "Copyright (C) 199x Landon Dyer, 2011-2017 Reboot\n"
+               "Copyright (C) 199x Landon Dyer, 2011-2018 Reboot\n"
                "V%01i.%01i.%01i %s (%s)\n\n", MAJOR, MINOR, PATCH, __DATE__, PLATFORM);
 }
 
diff --git a/sect.c b/sect.c
index 5d7fb4ad22b31b87efa3784c897533f63a17519d..59f7977160b11dee3d3057e050f166f426bc74ea 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -701,16 +701,8 @@ int ResolveFixups(int sno)
                        SETBE32(locp, 0, eval);
                        break;
 
-               // Fixup QUAD forward references
-               // Need to add flags for OP uses... [DONE]
+               // Fixup QUAD forward references (mainly used by the OP assembler)
                case FU_QUAD:
-                       // If the symbol is undefined, make sure to pass the symbol in
-                       // to the MarkRelocatable() function.
-/*                     if (!(eattr & DEFINED))
-                               MarkRelocatable(sno, loc, 0, MQUAD, esym);
-                       else if (tdb)
-                               MarkRelocatable(sno, loc, tdb, MQUAD, NULL);//*/
-
                        if (w & FU_OBJLINK)
                        {
                                uint64_t quad = GETBE64(locp, 0);
@@ -719,13 +711,16 @@ int ResolveFixups(int sno)
                                if (fup->orgaddr)
                                        addr = fup->orgaddr;
 
-//printf("sect.c: FU_OBJLINK quad=%016lX, addr=%016lX ", quad, addr);
 
                                eval = (quad & 0xFFFFFC0000FFFFFFLL) | ((addr & 0x3FFFF8) << 21);
-//printf("(%016lX)\n", eval);
                        }
                        else if (w & FU_OBJDATA)
                        {
+                               // If it's in a TEXT or DATA section, be sure to mark for a
+                               // fixup later
+                               if (tdb)
+                                       MarkRelocatable(sno, loc, tdb, MQUAD, NULL);
+
                                uint64_t quad = GETBE64(locp, 0);
                                uint64_t addr = eval;
 
@@ -736,7 +731,6 @@ int ResolveFixups(int sno)
                        }
 
                        SETBE64(locp, 0, eval);
-//printf("(%016lX)\n", eval);
                        break;
 
                // Fixup a 3-bit "QUICK" reference in bits 9..1
index 66de9ac75f5c3344fac09688ccc5c6a681cd730f..c4f73d75acfaba63411aade4fd9fecc5248ed924 100644 (file)
--- a/version.h
+++ b/version.h
@@ -15,7 +15,7 @@
 
 #define MAJOR   1              // Major version number
 #define MINOR   13             // Minor version number
-#define PATCH   0              // Patch release number
+#define PATCH   1              // Patch release number
 
 #endif // __VERSION_H__