1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

Fixed an error in file offset calculation.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5380 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2012-01-04 21:45:11 +00:00
parent cb4ba24089
commit ad88e77f43

View File

@ -1816,6 +1816,9 @@ unsigned CfgProcess (void)
/* Get the segment */
SegDesc* S = CollAtUnchecked (&M->SegList, J);
/* Remember the start address before handling this segment */
unsigned long StartAddr = Addr;
/* Some actions depend on wether this is the load or run memory
* area.
*/
@ -1866,8 +1869,8 @@ unsigned CfgProcess (void)
Addr = NewAddr;
}
/* If the segment has .BANK expressions referring to it, it
* must be placed into a memory area that has the bank
/* If the segment has .BANK expressions referring to it, it
* must be placed into a memory area that has the bank
* attribute.
*/
if (S->Seg->BankRef && M->BankExpr == 0) {
@ -1931,6 +1934,11 @@ unsigned CfgProcess (void)
/* Calculate the new address */
Addr += S->Seg->Size;
/* If this segment goes out to the file, increase the file size */
if ((S->Flags & SF_BSS) == 0 && S->Load == M) {
M->F->Size += Addr - StartAddr;
}
}
/* If requested, define symbols for start, size and offset of the
@ -1963,11 +1971,11 @@ unsigned CfgProcess (void)
SB_Done (&Buf);
}
/* Grow the file by the size of the memory area */
if (M->Flags & MF_FILL) {
M->F->Size += M->Size;
} else {
M->F->Size += M->FillLevel;
/* If we didn't have an overflow and are requested to fill the memory
* area, acount for that in the file size.
*/
if ((M->Flags & MF_OVERFLOW) == 0 && (M->Flags & MF_FILL) != 0) {
M->F->Size += (M->Size - M->FillLevel);
}
}