mirror of
https://github.com/cc65/cc65.git
synced 2025-01-12 17:30:50 +00:00
Fix for #928.
This commit is contained in:
parent
68eb0f2cdc
commit
083f3ae26b
@ -195,7 +195,7 @@ static void BinWriteMem (BinDesc* D, MemoryArea* M)
|
|||||||
if (DoWrite || (M->Flags & MF_FILL) != 0) {
|
if (DoWrite || (M->Flags & MF_FILL) != 0) {
|
||||||
/* Seek in "overwrite" segments */
|
/* Seek in "overwrite" segments */
|
||||||
if (S->Flags & SF_OVERWRITE) {
|
if (S->Flags & SF_OVERWRITE) {
|
||||||
fseek (D->F, NewAddr - M->Start, SEEK_SET);
|
fseek (D->F, NewAddr - M->Start + M->FileOffs, SEEK_SET);
|
||||||
} else {
|
} else {
|
||||||
WriteMult (D->F, M->FillVal, NewAddr-Addr);
|
WriteMult (D->F, M->FillVal, NewAddr-Addr);
|
||||||
PrintNumVal ("SF_OFFSET", NewAddr - Addr);
|
PrintNumVal ("SF_OFFSET", NewAddr - Addr);
|
||||||
@ -226,6 +226,12 @@ static void BinWriteMem (BinDesc* D, MemoryArea* M)
|
|||||||
unsigned long P = ftell (D->F);
|
unsigned long P = ftell (D->F);
|
||||||
SegWrite (D->Filename, D->F, S->Seg, BinWriteExpr, D);
|
SegWrite (D->Filename, D->F, S->Seg, BinWriteExpr, D);
|
||||||
PrintNumVal ("Wrote", (unsigned long) (ftell (D->F) - P));
|
PrintNumVal ("Wrote", (unsigned long) (ftell (D->F) - P));
|
||||||
|
/* If we have just written an OVERWRITE segement, move position to the
|
||||||
|
* end of file, so that subsequent segments are written in the correct
|
||||||
|
* place. */
|
||||||
|
if (S->Flags & SF_OVERWRITE) {
|
||||||
|
fseek (D->F, 0, SEEK_END);
|
||||||
|
}
|
||||||
} else if (M->Flags & MF_FILL) {
|
} else if (M->Flags & MF_FILL) {
|
||||||
WriteMult (D->F, S->Seg->FillVal, S->Seg->Size);
|
WriteMult (D->F, S->Seg->FillVal, S->Seg->Size);
|
||||||
PrintNumVal ("Filled", (unsigned long) S->Seg->Size);
|
PrintNumVal ("Filled", (unsigned long) S->Seg->Size);
|
||||||
|
@ -2107,10 +2107,12 @@ unsigned CfgProcess (void)
|
|||||||
Addr += S->Seg->Size;
|
Addr += S->Seg->Size;
|
||||||
|
|
||||||
/* If this segment will go out to the file, or its place
|
/* If this segment will go out to the file, or its place
|
||||||
** in the file will be filled, then increase the file size.
|
** in the file will be filled, then increase the file size,
|
||||||
|
** unless it's an OVERWRITE segment.
|
||||||
*/
|
*/
|
||||||
if (S->Load == M &&
|
if (S->Load == M &&
|
||||||
((S->Flags & SF_BSS) == 0 || (M->Flags & MF_FILL) != 0)) {
|
((S->Flags & SF_BSS) == 0 || (M->Flags & MF_FILL) != 0)
|
||||||
|
&& (S->Flags & SF_OVERWRITE) == 0) {
|
||||||
M->F->Size += Addr - StartAddr;
|
M->F->Size += Addr - StartAddr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user