Fixed a bug with different load/run areas, where a segment was marked as

dumped if the run area preceeded the load area, so it was not output into
the file for the load area (and not for the run area either).


git-svn-id: svn://svn.cc65.org/cc65/trunk@603 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2001-03-03 12:01:46 +00:00
parent 083f0aee44
commit 724262fb90
2 changed files with 62 additions and 32 deletions

View File

@@ -102,13 +102,21 @@ static unsigned BinWriteExpr (ExprNode* E, int Signed, unsigned Size,
/* Called from SegWrite for an expression. Evaluate the expression, check the
* range and write the expression value to the file.
*/
{
{
/* There's a predefined function to handle constant expressions */
return SegWriteConstExpr (((BinDesc*)Data)->F, E, Signed, Size);
}
static void PrintBoolVal (const char* Name, int B)
/* Print a boolean value for debugging */
{
printf (" %s = %s\n", Name, B? "true" : "false");
}
static void BinWriteMem (BinDesc* D, Memory* M)
/* Write the segments of one memory area to a file */
{
@@ -134,6 +142,14 @@ static void BinWriteMem (BinDesc* D, Memory* M)
S->Load == M && /* LOAD segment */
S->Seg->Dumped == 0; /* Not already written */
/* Output the DoWrite flag for debugging */
if (Verbose > 1) {
PrintBoolVal ("bss", S->Flags & SF_BSS);
PrintBoolVal ("LoadArea", S->Load == M);
PrintBoolVal ("Dumped", S->Seg->Dumped);
PrintBoolVal ("DoWrite", DoWrite);
}
/* Check if we would need an alignment */
if (S->Seg->Align > S->Align) {
/* Segment itself requires larger alignment than configured
@@ -175,7 +191,11 @@ static void BinWriteMem (BinDesc* D, Memory* M)
} else if (M->Flags & MF_FILL) {
WriteMult (D->F, M->FillVal, S->Seg->Size);
}
S->Seg->Dumped = 1;
/* If this was the load memory area, mark the segment as dumped */
if (S->Load == M) {
S->Seg->Dumped = 1;
}
/* Calculate the new address */
Addr += S->Seg->Size;