Added a "fillval" attribute to the segment definition. When given, it

overrides the value from the memory area for all space that lies within the
segment itself.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5823 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2012-09-09 19:00:43 +00:00
parent 1c77d3a6f0
commit 574c8fa273
5 changed files with 55 additions and 19 deletions

View File

@@ -464,16 +464,22 @@ void SegWrite (const char* TgtName, FILE* Tgt, Segment* S, SegWriteFunc F, void*
/* Loop over all sections in this segment */
for (I = 0; I < CollCount (&S->Sections); ++I) {
Section* Sec = CollAtUnchecked (&S->Sections, I);
Fragment* Frag;
Section* Sec = CollAtUnchecked (&S->Sections, I);
Fragment* Frag;
unsigned char FillVal;
/* Output were this section is from */
Print (stdout, 2, " Section from \"%s\"\n", GetObjFileName (Sec->Obj));
/* If we have fill bytes, write them now */
/* If we have fill bytes, write them now. Beware: If this is the
* first section, the fill value is not considered part of the segment
* and therefore taken from the memory area.
*/
FillVal = (I == 0)? S->MemArea->FillVal : S->FillVal;
Print (stdout, 2, " Filling 0x%lx bytes with 0x%02x\n",
Sec->Fill, S->FillVal);
WriteMult (Tgt, S->FillVal, Sec->Fill);
Sec->Fill, FillVal);
WriteMult (Tgt, FillVal, Sec->Fill);
Offs += Sec->Fill;
/* Loop over all fragments in this section */