1 /*****************************************************************************/
5 /* Target configuration file for the ld65 linker */
9 /* (C) 1998-2010, Ullrich von Bassewitz */
10 /* Roemerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
49 /*****************************************************************************/
51 /*****************************************************************************/
56 typedef struct File File;
58 unsigned Name; /* Name index of the file */
60 unsigned Format; /* Output format */
61 Collection MemList; /* List of memory areas in this file */
64 /* Memory list entry */
65 typedef struct Memory Memory;
67 unsigned Name; /* Name index of the memory section */
68 unsigned Attr; /* Which values are valid? */
69 unsigned Flags; /* Set of bitmapped flags */
70 unsigned long Start; /* Start address */
71 unsigned long Size; /* Length of memory section */
72 unsigned long FillLevel; /* Actual fill level of segment */
73 unsigned char FillVal; /* Value used to fill rest of seg */
74 unsigned char Relocatable; /* Memory area is relocatable */
75 Collection SegList; /* List of segments for this section */
76 File* F; /* File that contains the entry */
79 /* Segment descriptor entry */
80 typedef struct SegDesc SegDesc;
82 unsigned Name; /* Index of the name */
83 Segment* Seg; /* Pointer to segment structure */
84 unsigned Attr; /* Attributes for segment */
85 unsigned Flags; /* Set of bitmapped flags */
86 Memory* Load; /* Load memory section */
87 Memory* Run; /* Run memory section */
88 unsigned long Addr; /* Start address or offset into segment */
89 unsigned char Align; /* Run area alignment if given */
90 unsigned char AlignLoad; /* Load area alignment if given */
94 #define MF_DEFINE 0x0001 /* Define start and size */
95 #define MF_FILL 0x0002 /* Fill segment */
96 #define MF_RO 0x0004 /* Read only memory area */
97 #define MF_OVERFLOW 0x0008 /* Memory area overflow */
100 #define SF_RO 0x0001 /* Read only segment */
101 #define SF_BSS 0x0002 /* Segment is BSS style segment */
102 #define SF_ZP 0x0004 /* Zeropage segment (o65 only) */
103 #define SF_DEFINE 0x0008 /* Define start and size */
104 #define SF_ALIGN 0x0010 /* Align segment in run area */
105 #define SF_ALIGN_LOAD 0x0020 /* Align segment in load area */
106 #define SF_OFFSET 0x0040 /* Segment has offset in memory */
107 #define SF_START 0x0080 /* Segment has fixed start address */
108 #define SF_OPTIONAL 0x0100 /* Segment is optional (must not exist) */
109 #define SF_RUN_DEF 0x0200 /* RUN symbols already defined */
110 #define SF_LOAD_DEF 0x0400 /* LOAD symbols already defined */
114 /*****************************************************************************/
116 /*****************************************************************************/
121 /* Read the configuration */
123 unsigned CfgAssignSegments (void);
124 /* Assign segments, define linker symbols where requested. The function will
125 * return the number of memory area overflows (so zero means anything went ok).
126 * In case of overflows, a short mapfile can be generated later, to ease the
127 * task of rearranging segments for the user.
130 void CfgWriteTarget (void);
131 /* Write the target file(s) */
135 /* End of config.h */