1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

In Atari XEX output format, join memory areas if possible.

This makes executables shorter if two memory areas are consecutive.
This commit is contained in:
Daniel Serpell 2020-07-03 23:03:19 -04:00 committed by Oliver Schmidt
parent 0f8b587bc2
commit 17c5504129
2 changed files with 5 additions and 4 deletions

View File

@ -932,7 +932,8 @@ the standard format used by Atari DOS 2.0 and upward file managers in the Atari
</verb></tscreen>
In the Atari segmented file format, the linker will write each <tt/MEMORY/ area
as a new segment, including a header with the start and end address.
as including a header with the start and end address. If two memory areas are
contiguous, the headers will be joined if possible.
The necessary o65 or Atari attributes are defined in a special section labeled
<ref id="FORMAT" name="FORMAT">.

View File

@ -241,9 +241,6 @@ static unsigned long XexWriteMem (XexDesc* D, MemoryArea* M)
/* Store initial position to get total file size */
unsigned long StartPos = ftell (D->F);
/* Always write a segment header for each memory area */
D->HeadPos = 0;
/* Get the start address and size of this memory area */
unsigned long Addr = M->Start;
@ -400,6 +397,7 @@ void XexWriteTarget (XexDesc* D, struct File* F)
if (D->F == 0) {
Error ("Cannot open `%s': %s", D->Filename, strerror (errno));
}
D->HeadPos = 0;
/* Keep the user happy */
Print (stdout, 1, "Opened `%s'...\n", D->Filename);
@ -415,6 +413,8 @@ void XexWriteTarget (XexDesc* D, struct File* F)
Write16 (D->F, 0x2E2);
Write16 (D->F, 0x2E3);
Write16 (D->F, GetExportVal (I->InitAd->Exp));
/* Always write a new segment header after an INITAD segment */
D->HeadPos = 0;
}
}