]> git.sur5r.net Git - cc65/blob - src/ld65/config.h
Removed the - now unused - empty builtin configuration (was used for the ace
[cc65] / src / ld65 / config.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 config.h                                  */
4 /*                                                                           */
5 /*               Target configuration file for the ld65 linker               */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2005 Ullrich von Bassewitz                                       */
10 /*               Römerstrasse 52                                             */
11 /*               D-70794 Filderstadt                                         */
12 /* EMail:        uz@cc65.org                                                 */
13 /*                                                                           */
14 /*                                                                           */
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.                                    */
18 /*                                                                           */
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:                            */
22 /*                                                                           */
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              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef CONFIG_H
37 #define CONFIG_H
38
39
40
41 /* ld65 */
42 #include "segments.h"
43
44
45
46 /*****************************************************************************/
47 /*                                   Data                                    */
48 /*****************************************************************************/
49
50
51
52 /* File list entry */
53 typedef struct File File;
54 struct File {
55     unsigned            Name;           /* Name index of the file */
56     File*               Next;           /* Pointer to next entry in list */
57     unsigned            Flags;
58     unsigned            Format;         /* Output format */
59     struct Memory*      MemList;        /* List of memory areas in this file */
60     struct Memory*      MemLast;        /* Last memory area in this file */
61 };
62
63 /* Segment list node. Needed because there are two lists (RUN & LOAD) */
64 typedef struct MemListNode MemListNode;
65 struct MemListNode {
66     MemListNode*        Next;           /* Next entry */
67     struct SegDesc*     Seg;            /* Segment */
68 };
69
70 /* Memory list entry */
71 typedef struct Memory Memory;
72 struct Memory {
73     unsigned            Name;           /* Name index of the memory section */
74     Memory*             Next;           /* Pointer to next entry in list */
75     Memory*             FNext;          /* Next in file list */
76     unsigned            Attr;           /* Which values are valid? */
77     unsigned            Flags;          /* Set of bitmapped flags */
78     unsigned long       Start;          /* Start address */
79     unsigned long       Size;           /* Length of memory section */
80     unsigned long       FillLevel;      /* Actual fill level of segment */
81     unsigned char       FillVal;        /* Value used to fill rest of seg */
82     unsigned char       Relocatable;    /* Memory area is relocatable */
83     MemListNode*        SegList;        /* List of segments for this section */
84     MemListNode*        SegLast;        /* Last segment in this section */
85     File*               F;              /* File that contains the entry */
86 };
87
88 /* Segment descriptor entry */
89 typedef struct SegDesc SegDesc;
90 struct SegDesc {
91     unsigned            Name;           /* Index of the name */
92     SegDesc*            Next;           /* Pointer to next entry in list */
93     Segment*            Seg;            /* Pointer to segment structure */
94     unsigned            Attr;           /* Attributes for segment */
95     unsigned            Flags;          /* Set of bitmapped flags */
96     Memory*             Load;           /* Load memory section */
97     Memory*             Run;            /* Run memory section */
98     unsigned long       Addr;           /* Start address or offset into segment */
99     unsigned char       Align;          /* Run area alignment if given */
100     unsigned char       AlignLoad;      /* Load area alignment if given */
101 };
102
103 /* Segment list */
104 extern SegDesc*         SegDescList;    /* Single linked list */
105 extern unsigned         SegDescCount;   /* Number of entries in list */
106
107 /* Memory flags */
108 #define MF_DEFINE       0x0001          /* Define start and size */
109 #define MF_FILL         0x0002          /* Fill segment */
110 #define MF_RO           0x0004          /* Read only memory area */
111 #define MF_OVERFLOW     0x0008          /* Memory area overflow */
112
113 /* Segment flags */
114 #define SF_RO           0x0001          /* Read only segment */
115 #define SF_BSS          0x0002          /* Segment is BSS style segment */
116 #define SF_ZP           0x0004          /* Zeropage segment (o65 only) */
117 #define SF_DEFINE       0x0008          /* Define start and size */
118 #define SF_ALIGN        0x0010          /* Align segment in run area */
119 #define SF_ALIGN_LOAD   0x0020          /* Align segment in load area */
120 #define SF_OFFSET       0x0040          /* Segment has offset in memory */
121 #define SF_START        0x0080          /* Segment has fixed start address */
122 #define SF_OPTIONAL     0x0100          /* Segment is optional (must not exist) */
123 #define SF_RUN_DEF      0x0200          /* RUN symbols already defined */
124 #define SF_LOAD_DEF     0x0400          /* LOAD symbols already defined */
125
126
127
128 /*****************************************************************************/
129 /*                                   Code                                    */
130 /*****************************************************************************/
131
132
133
134 void CfgRead (void);
135 /* Read the configuration */
136
137 unsigned CfgAssignSegments (void);
138 /* Assign segments, define linker symbols where requested. The function will
139  * return the number of memory area overflows (so zero means anything went ok).
140  * In case of overflows, a short mapfile can be generated later, to ease the
141  * task of rearranging segments for the user.
142  */
143
144 void CfgWriteTarget (void);
145 /* Write the target file(s) */
146
147
148
149 /* End of config.h */
150
151 #endif
152
153
154
155
156