From d293d766ef39363891d174cd8a6b6647e18bfb5d Mon Sep 17 00:00:00 2001 From: Laubzega Date: Sat, 8 Sep 2018 19:18:41 -0700 Subject: [PATCH] New segment type renamed to "overwrite". --- src/ld65/bin.c | 4 ++-- src/ld65/config.c | 32 ++++++++++++++++---------------- src/ld65/config.h | 2 +- src/ld65/scanner.h | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ld65/bin.c b/src/ld65/bin.c index 6f0e4ab36..a77d49679 100644 --- a/src/ld65/bin.c +++ b/src/ld65/bin.c @@ -193,8 +193,8 @@ static void BinWriteMem (BinDesc* D, MemoryArea* M) NewAddr += M->Start; } if (DoWrite || (M->Flags & MF_FILL) != 0) { - /* Seek in "replace" segments */ - if (S->Flags & SF_REPLACE) { + /* Seek in "overwrite" segments */ + if (S->Flags & SF_OVERWRITE) { fseek (D->F, NewAddr - M->Start, SEEK_SET); } else { WriteMult (D->F, M->FillVal, NewAddr-Addr); diff --git a/src/ld65/config.c b/src/ld65/config.c index 0e4d0c1e4..73eee1caa 100644 --- a/src/ld65/config.c +++ b/src/ld65/config.c @@ -653,7 +653,7 @@ static void ParseSegments (void) { "RW", CFGTOK_RW }, { "BSS", CFGTOK_BSS }, { "ZP", CFGTOK_ZP }, - { "REPLACE", CFGTOK_REPLACE }, + { "OVERWRITE", CFGTOK_OVERWRITE }, }; 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_REPLACE: S->Flags |= (SF_REPLACE | SF_RO); 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_OVERWRITE: S->Flags |= (SF_OVERWRITE | SF_RO); break; + default: Internal ("Unexpected token: %d", CfgTok); } CfgNextTok (); break; @@ -1797,7 +1797,7 @@ unsigned CfgProcess (void) for (I = 0; I < CollCount (&MemoryAreas); ++I) { unsigned J; unsigned long Addr; - unsigned Replaces = 0; + unsigned Overwrites = 0; /* Get the next memory area */ MemoryArea* M = CollAtUnchecked (&MemoryAreas, I); @@ -1851,23 +1851,23 @@ unsigned CfgProcess (void) /* Remember the start address before handling this segment */ unsigned long StartAddr = Addr; - /* Take note of "replace" segments and make sure there are no other - ** segment types following them in current memory region. + /* Take note of "overwrite" segments and make sure there are no + ** other segment types following them in current memory region. */ - if (S->Flags & SF_REPLACE) { + if (S->Flags & SF_OVERWRITE) { if (S->Flags & (SF_OFFSET | SF_START)) { - ++Replaces; + ++Overwrites; } else { CfgError (GetSourcePos (M->LI), - "Segment `%s' of type `replace' requires either" + "Segment `%s' of type `overwrite' requires either" " `Start' or `Offset' attribute to be specified", GetString (S->Name)); } } else { - if (Replaces > 0) { + if (Overwrites > 0) { CfgError (GetSourcePos (M->LI), "Segment `%s' is preceded by at least one segment" - " of type `replace'", + " of type `overwrite'", GetString (S->Name)); } } @@ -1921,7 +1921,7 @@ unsigned CfgProcess (void) NewAddr += M->Start; } - if (S->Flags & SF_REPLACE) { + if (S->Flags & SF_OVERWRITE) { if (NewAddr < M->Start) { CfgError (GetSourcePos (S->LI), "Segment `%s' begins before memory area `%s'", diff --git a/src/ld65/config.h b/src/ld65/config.h index d172560bd..d97675b21 100644 --- a/src/ld65/config.h +++ b/src/ld65/config.h @@ -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_REPLACE 0x1000 /* Segment can replace (part of) another one */ +#define SF_OVERWRITE 0x1000 /* Segment can overwrite (part of) another one */ diff --git a/src/ld65/scanner.h b/src/ld65/scanner.h index 2c60da975..2df952ebb 100644 --- a/src/ld65/scanner.h +++ b/src/ld65/scanner.h @@ -105,7 +105,7 @@ typedef enum { CFGTOK_RW, CFGTOK_BSS, CFGTOK_ZP, - CFGTOK_REPLACE, + CFGTOK_OVERWRITE, CFGTOK_O65, CFGTOK_BIN,