]> git.sur5r.net Git - cc65/blob - src/ld65/tgtcfg.c
changed Atari ZP define to have max. ZP space available
[cc65] / src / ld65 / tgtcfg.c
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                               tgtcfg.c                                    */
4 /*                                                                           */
5 /*               Target machine configurations 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 #include "binfmt.h"
37 #include "tgtcfg.h"
38
39
40
41 /*****************************************************************************/
42 /*                           Target configurations                           */
43 /*****************************************************************************/
44
45
46
47 static const char CfgNone [] =
48     "MEMORY {"
49         "RAM: start = %S, size = $10000, file = %O;"
50     "}"
51     "SEGMENTS {"
52         "CODE: load = RAM, type = rw;"
53         "RODATA: load = RAM, type = rw;"
54         "DATA: load = RAM, type = rw;"
55         "BSS: load = RAM, type = bss, define = yes;"
56     "}";
57
58 static const char CfgAtari [] =
59     "MEMORY {"
60         "ZP: start = $82, size = $7E, type = rw;"
61         "HEADER: start = $0000, size = $6, file = %O;"
62         "RAM: start = $1F00, size = $9D1F, file = %O;"  /* 9D1F: matches upper bound BC1F */
63     "}"
64     "SEGMENTS {"
65         "EXEHDR: load = HEADER, type = wprot;"
66         "CODE: load = RAM, type = wprot, define = yes;"
67         "RODATA: load = RAM, type = wprot;"
68         "DATA: load = RAM, type = rw;"
69         "BSS: load = RAM, type = bss, define = yes;"
70         "ZEROPAGE: load = ZP, type = zp;"
71         "AUTOSTRT: load = RAM, type = wprot;"
72     "}";
73
74 static const char CfgC64 [] =
75     "MEMORY {"
76         "ZP: start = $02, size = $1A, type = rw;"
77         "RAM: start = $7FF, size = $c801, file = %O;"
78     "}"
79     "SEGMENTS {"
80         "CODE: load = RAM, type = wprot;"
81         "RODATA: load = RAM, type = wprot;"
82         "DATA: load = RAM, type = rw;"
83         "BSS: load = RAM, type = bss, define = yes;"
84         "ZEROPAGE: load = ZP, type = zp;"
85     "}";
86
87 static const char CfgC128 [] =
88     "MEMORY {"
89         "ZP: start = $02, size = $1A, type = rw;"
90         "RAM: start = $1bff, size = $a401, file = %O;"
91     "}"
92     "SEGMENTS {"
93         "CODE: load = RAM, type = wprot;"
94         "RODATA: load = RAM, type = wprot;"
95         "DATA: load = RAM, type = rw;"
96         "BSS: load = RAM, type = bss, define = yes;"
97         "ZEROPAGE: load = ZP, type = zp;"
98     "}";
99
100 static const char CfgAce [] =
101     "";
102
103 static const char CfgPlus4 [] =
104     "MEMORY {"
105         "ZP: start = $02, size = $1A, type = rw;"
106         "RAM: start = $0fff, size = $7001, file = %O;"
107     "}"
108     "SEGMENTS {"
109         "CODE: load = RAM, type = wprot;"
110         "RODATA: load = RAM, type = wprot;"
111         "DATA: load = RAM, type = rw;"
112         "BSS: load = RAM, type = bss, define = yes;"
113         "ZEROPAGE: load = ZP, type = zp;"
114     "}";
115
116 static const char CfgCBM610 [] =
117     "MEMORY {"
118         "ZP: start = $02, size = $1A, type = rw;"
119         "RAM: start = $0001, size = $FFF0, file = %O;"
120     "}"
121     "SEGMENTS {"
122         "CODE: load = RAM, type = wprot;"
123         "RODATA: load = RAM, type = wprot;"
124         "DATA: load = RAM, type = rw;"
125         "BSS: load = RAM, type = bss, define = yes;"
126         "ZEROPAGE: load = ZP, type = zp;"
127     "}";
128
129 static const char CfgPET [] =
130     "MEMORY {"
131         "ZP: start = $02, size = $1A, type = rw;"
132         "RAM: start = $03FF, size = $7BFF, file = %O;"
133     "}"
134     "SEGMENTS {"
135         "CODE: load = RAM, type = wprot;"
136         "RODATA: load = RAM, type = wprot;"
137         "DATA: load = RAM, type = rw;"
138         "BSS: load = RAM, type = bss, define = yes;"
139         "ZEROPAGE: load = ZP, type = zp;"
140     "}";
141
142 static const char CfgNES [] =
143     "MEMORY {"
144         "RAM: start = $0200, size = $0600, file = \"\";"
145         "ROM: start = $8000, size = $8000, file = %O;"
146     "}"
147     "SEGMENTS {"
148         "CODE: load = ROM, type = ro;"
149         "RODATA: load = ROM, type = ro;"
150         "DATA: load = ROM, run = RAM, type = rw, define = yes;"
151         "BSS: load = RAM, type = bss, define = yes;"
152         "VECTORS: load = ROM, type = ro, start = $FFFA;"
153     "}";
154
155 static const char CfgLunix [] =
156     "MEMORY {"
157         "COMBINED: start = $0000, size = $FFFF, file = %O;"
158         "ZEROPAGE: start = $0000, size = $0100, file = %O;"
159     "}"
160     "SEGMENTS {"
161         "CODE: load = COMBINED, type = wprot;"
162         "RODATA: load = COMBINED, type = wprot;"
163         "DATA: load = COMBINED, type = rw, define = yes;"
164         "BSS: load = COMBINED, type = bss, define = yes;"
165         "ZEROPAGE: load = ZEROPAGE, type = zp;"
166     "}"
167     "FILES {"
168         "%O: format = o65;"
169     "}"
170     "FORMATS {"
171         "o65: os = lunix, type = small,"
172               "extsym = \"LUNIXKERNAL\", extsym = \"LIB6502\";"
173     "}";
174
175 static const char CfgOSA65 [] =
176     "MEMORY {"
177         "COMBINED: start = $0000, size = $FFFF, file = %O;"
178         "ZEROPAGE: start = $0000, size = $0100, file = %O;"
179     "}"
180     "SEGMENTS {"
181         "CODE: load = COMBINED, type = wprot;"
182         "RODATA: load = COMBINED, type = wprot;"
183         "DATA: load = COMBINED, type = rw, define = yes;"
184         "BSS: load = COMBINED, type = bss, define = yes;"
185         "ZEROPAGE: load = ZEROPAGE, type = zp;"
186     "}"
187     "FILES {"
188         "%O: format = o65;"
189     "}"
190     "FORMATS {"
191         "o65: os = osa65, type = small,"
192               "extsym = \"OSA2KERNAL\", extsym = \"LIB6502\";"
193     "}";
194
195 static const char CfgApple2 [] =
196     "MEMORY {"
197         "ZP: start = $00, size = $1A, type = rw;"
198         "RAM: start = $800, size = $8E00, file = %O;"
199     "}"
200     "SEGMENTS { "
201         "CODE: load = RAM, type = ro;"
202         "RODATA: load = RAM, type = ro;"
203         "DATA: load = RAM, type = rw;"
204         "BSS: load = RAM, type = bss, define = yes;"
205         "ZEROPAGE: load = ZP, type = zp;"
206     "}";
207
208 static const char CfgGeos [] =
209     "MEMORY {"
210         "HEADER: start = $204, size = 508, file = %O;"
211         "RAM: start = $400, size = $7C00, file = %O;"
212     "}"
213     "SEGMENTS { "
214         "HEADER: load = HEADER, type = ro;"
215         "CODE: load = RAM, type = ro;"
216         "RODATA: load = RAM, type = ro;"
217         "DATA: load = RAM, type = rw;"
218         "BSS: load = RAM, type = bss, define = yes;"
219     "}";
220
221
222
223 /*****************************************************************************/
224 /*                                   Data                                    */
225 /*****************************************************************************/
226
227
228
229 /* Target configurations for all systems */
230 const TargetDesc Targets [TGT_COUNT] = {
231     {   BINFMT_BINARY,  CfgNone         },
232     {   BINFMT_BINARY,  CfgAtari        },
233     {   BINFMT_BINARY,  CfgC64          },
234     {   BINFMT_BINARY,  CfgC128         },
235     {   BINFMT_BINARY,  CfgAce          },
236     {   BINFMT_BINARY,  CfgPlus4        },
237     {   BINFMT_BINARY,  CfgCBM610       },
238     {   BINFMT_BINARY,  CfgPET          },
239     {   BINFMT_BINARY,  CfgNES          },
240 #if 0
241     {   BINFMT_O65,     CfgLunix        },
242     {   BINFMT_O65,     CfgOSA65        },
243 #endif
244     {   BINFMT_BINARY,  CfgApple2       },
245     {   BINFMT_BINARY,  CfgGeos         },
246 };
247
248
249