]> git.sur5r.net Git - cc65/blob - src/ld65/config.h
Removed underlines from structure names.
[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-2000 Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
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 #include "segments.h"
42
43
44
45 /*****************************************************************************/
46 /*                                   Data                                    */
47 /*****************************************************************************/
48
49
50
51 /* File list entry */
52 typedef struct File File;
53 struct File {
54     File*               Next;           /* Pointer to next entry in list */
55     unsigned            Flags;
56     unsigned            Format;         /* Output format */
57     struct Memory*      MemList;        /* List of memory areas in this file */
58     struct Memory*      MemLast;        /* Last memory area in this file */
59     char                Name [1];       /* Name of file */
60 };
61
62 /* Segment list node. Needed because there are two lists (RUN & LOAD) */
63 typedef struct MemListNode MemListNode;
64 struct MemListNode {
65     MemListNode*        Next;           /* Next entry */
66     struct SegDesc*     Seg;            /* Segment */
67 };
68
69 /* Memory list entry */
70 typedef struct Memory Memory;
71 struct Memory {
72     Memory*             Next;           /* Pointer to next entry in list */
73     Memory*             FNext;          /* Next in file list */
74     unsigned            Attr;           /* Which values are valid? */
75     unsigned            Flags;          /* Set of bitmapped flags */
76     unsigned long       Start;          /* Start address */
77     unsigned long       Size;           /* Length of memory section */
78     unsigned long       FillLevel;      /* Actual fill level of segment */
79     unsigned char       FillVal;        /* Value used to fill rest of seg */
80     MemListNode*        SegList;        /* List of segments for this section */
81     MemListNode*        SegLast;        /* Last segment in this section */
82     File*               F;              /* File that contains the entry */
83     char                Name [1];       /* Name of the memory section */
84 };
85
86 /* Segment descriptor entry */
87 typedef struct SegDesc SegDesc;
88 struct SegDesc {
89     SegDesc*            Next;           /* Pointer to next entry in list */
90     Segment*            Seg;            /* Pointer to segment structure */
91     unsigned            Attr;           /* Attributes for segment */
92     unsigned            Flags;          /* Set of bitmapped flags */
93     Memory*             Load;           /* Load memory section */
94     Memory*             Run;            /* Run memory section */
95     unsigned long       Addr;           /* Start address or offset into segment */
96     unsigned char       Align;          /* Alignment if given */
97     char                Name [1];       /* Copy of name */
98 };
99
100 /* Segment list */
101 extern SegDesc*         SegDescList;    /* Single linked list */
102 extern unsigned         SegDescCount;   /* Number of entries in list */
103
104 /* Memory flags */
105 #define MF_DEFINE       0x0001          /* Define start and size */
106 #define MF_FILL         0x0002          /* Fill segment */
107 #define MF_RO           0x0004          /* Read only memory area */
108
109 /* Segment flags */
110 #define SF_RO           0x0001          /* Read only segment */
111 #define SF_BSS          0x0002          /* Segment is BSS style segment */
112 #define SF_ZP           0x0004          /* Zeropage segment (o65 only) */
113 #define SF_WPROT        0x0008          /* Write protected segment */
114 #define SF_DEFINE       0x0010          /* Define start and size */
115 #define SF_ALIGN        0x0020          /* Align the segment */
116 #define SF_OFFSET       0x0040          /* Segment has offset in memory */
117 #define SF_START        0x0080          /* Segment has fixed start address */
118 #define SF_LOAD_AND_RUN 0x1000          /* LOAD and RUN given */
119 #define SF_RUN_DEF      0x2000          /* RUN symbols already defined */
120 #define SF_LOAD_DEF     0x4000          /* LOAD symbols already defined */
121
122
123
124 /*****************************************************************************/
125 /*                                   Code                                    */
126 /*****************************************************************************/
127
128
129
130 void CfgRead (void);
131 /* Read the configuration */
132
133 void CfgAssignSegments (void);
134 /* Assign segments, define linker symbols where requested */
135
136 void CfgWriteTarget (void);
137 /* Write the target file(s) */
138
139
140
141 /* End of config.h */
142
143 #endif
144
145
146
147
148