mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Segment OVERLAY renamed to REPLACE. Bugfix for read-only segments. Formatting.
This commit is contained in:
parent
1b0e2cf783
commit
cd9efd53fe
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
||||
|
||||
|
||||
|
@ -105,7 +105,7 @@ typedef enum {
|
||||
CFGTOK_RW,
|
||||
CFGTOK_BSS,
|
||||
CFGTOK_ZP,
|
||||
CFGTOK_OVERLAY,
|
||||
CFGTOK_REPLACE,
|
||||
|
||||
CFGTOK_O65,
|
||||
CFGTOK_BIN,
|
||||
|
Loading…
x
Reference in New Issue
Block a user