]> git.sur5r.net Git - cc65/commitdiff
Segment OVERLAY renamed to REPLACE. Bugfix for read-only segments. Formatting.
authorLaubzega <mileksmyk@gmail.com>
Tue, 4 Sep 2018 07:34:28 +0000 (00:34 -0700)
committerLaubzega <mileksmyk@gmail.com>
Tue, 4 Sep 2018 07:34:28 +0000 (00:34 -0700)
src/ld65/bin.c
src/ld65/config.c
src/ld65/config.h
src/ld65/scanner.h

index f4d241adde45d8fa027c038e5a69d670c457e916..c94ac9319a5ea6fdbd4b841afb1000a3829b7936 100644 (file)
@@ -194,8 +194,8 @@ static void BinWriteMem (BinDesc* D, MemoryArea* M)
                 }
                 if (DoWrite || (M->Flags & MF_FILL) != 0) {
                     /* Seek in "overlay" segments */
-                    if (S->Flags & SF_OVERLAY) {
-                        fseek(D->F, NewAddr - M->Start, SEEK_SET);
+                    if (S->Flags & SF_REPLACE) {
+                        fseek (D->F, NewAddr - M->Start, SEEK_SET);
                     } else {
                         WriteMult (D->F, M->FillVal, NewAddr-Addr);
                         PrintNumVal ("SF_OFFSET", NewAddr - Addr);
index f6603d6285ca962f03596c023a60b9ea841151de..5c61bdd3f0e787a5cda45492d8fa60820eccec1d 100644 (file)
@@ -653,7 +653,7 @@ static void ParseSegments (void)
         {   "RW",               CFGTOK_RW               },
         {   "BSS",              CFGTOK_BSS              },
         {   "ZP",               CFGTOK_ZP               },
-        {   "OVERLAY",          CFGTOK_OVERLAY          },
+        {   "REPLACE",          CFGTOK_REPLACE          },
     };
 
     unsigned Count;
@@ -754,12 +754,12 @@ static void ParseSegments (void)
                     FlagAttr (&S->Attr, SA_TYPE, "TYPE");
                     CfgSpecialToken (Types, ENTRY_COUNT (Types), "Type");
                     switch (CfgTok) {
-                        case CFGTOK_RO:    S->Flags |= SF_RO;               break;
-                        case CFGTOK_RW:    /* Default */                    break;
-                        case CFGTOK_BSS:   S->Flags |= SF_BSS;              break;
-                        case CFGTOK_ZP:    S->Flags |= (SF_BSS | SF_ZP);    break;
-                        case CFGTOK_OVERLAY: S->Flags |= SF_OVERLAY;        break;
-                        default:           Internal ("Unexpected token: %d", CfgTok);
+                        case CFGTOK_RO:      S->Flags |= SF_RO;                break;
+                        case CFGTOK_RW:      /* Default */                     break;
+                        case CFGTOK_BSS:     S->Flags |= SF_BSS;               break;
+                        case CFGTOK_ZP:      S->Flags |= (SF_BSS | SF_ZP);     break;
+                        case CFGTOK_REPLACE: S->Flags |= (SF_REPLACE | SF_RO); break;
+                        default:             Internal ("Unexpected token: %d", CfgTok);
                     }
                     CfgNextTok ();
                     break;
@@ -1854,17 +1854,15 @@ unsigned CfgProcess (void)
             /* Take note of overlayed segments and make sure there are no other
             ** segment types following them in current memory region.
             */
-            if (S->Flags & SF_OVERLAY) {
-            {
+            if (S->Flags & SF_REPLACE) {
                 if (S->Flags & (SF_OFFSET | SF_START)) {
                     ++Overlays;
                 } else {
                     CfgError (GetSourcePos (M->LI),
                               "Segment `%s' of type `overlay' requires either"
-                              " `Start' or `Offset' argument to be specified.",
+                              " `Start' or `Offset' attribute to be specified",
                               GetString (S->Name));
                 }
-            }
             } else {
                 if (Overlays > 0) {
                     CfgError (GetSourcePos (M->LI),
@@ -1923,10 +1921,10 @@ unsigned CfgProcess (void)
                         NewAddr += M->Start;
                     }
 
-                    if (S->Flags & SF_OVERLAY) {
+                    if (S->Flags & SF_REPLACE) {
                         if (NewAddr < M->Start) {
                             CfgError (GetSourcePos (S->LI),
-                                      "Segment `%s' begins before memory area `%s'.",
+                                      "Segment `%s' begins before memory area `%s'",
                                       GetString (S->Name), GetString (M->Name));
                         } else {
                             Addr = NewAddr;
index a60580da30c16978027127ad88e7a356ef458ea8..d172560bd21594abc74ce7e086c8a20546d42acc 100644 (file)
@@ -96,7 +96,7 @@ struct SegDesc {
 #define SF_RUN_DEF      0x0200          /* RUN symbols already defined */
 #define SF_LOAD_DEF     0x0400          /* LOAD symbols already defined */
 #define SF_FILLVAL      0x0800          /* Segment has separate fill value */
-#define SF_OVERLAY      0x1000          /* Segment can be overlayed on another one */
+#define SF_REPLACE      0x1000          /* Segment can replace (part of) another one */
 
 
 
index e994c05477104f569f9961351c3271f302d6a8d4..2c60da9755689fedb47c74f9df421b2fd04990ac 100644 (file)
@@ -105,7 +105,7 @@ typedef enum {
     CFGTOK_RW,
     CFGTOK_BSS,
     CFGTOK_ZP,
-    CFGTOK_OVERLAY,
+    CFGTOK_REPLACE,
 
     CFGTOK_O65,
     CFGTOK_BIN,