From: Shamus Hammons Date: Tue, 27 Feb 2018 02:43:58 +0000 (-0600) Subject: Minor tweak for OP data address fixups. Now at version 1.13.1. X-Git-Tag: v2.1.0~77 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=commitdiff_plain;h=b93a2e2f8ade36a09709b4a72b10f3e8228bed2b;hp=261f8d9198c4235bcdced4403ba391553e6bd0d1 Minor tweak for OP data address fixups. Now at version 1.13.1. --- diff --git a/.gitignore b/.gitignore index 8266a9c..52dc3f7 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,4 @@ tmp/ elf/ tests/ regression-tests/ -rmac-* +versions/ diff --git a/docs/note-on-the-op-assembler.txt b/docs/note-on-the-op-assembler.txt index 8a3d14b..8fc3db1 100644 --- a/docs/note-on-the-op-assembler.txt +++ b/docs/note-on-the-op-assembler.txt @@ -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 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? diff --git a/makefile b/makefile index f966ea1..a1ffcc8 100644 --- 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 ca7152e..a5e1975 100644 --- 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 199cff7..9dd75fd 100644 --- 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 5d7fb4a..59f7977 100644 --- 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 diff --git a/version.h b/version.h index 66de9ac..c4f73d7 100644 --- 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__