]> git.sur5r.net Git - cc65/blob - cfg/atarixl-c-xex.cfg
Add sample linker configurations for Atari binary output in C.
[cc65] / cfg / atarixl-c-xex.cfg
1 # Sample linker configuration for C programs using the Atari binary file support.
2 # Use with: cl65 -tatarixl -Catarixl-c-xex.cfg prog.c -o prog.xex
3 FEATURES {
4     STARTADDRESS: default = $2400;
5 }
6 SYMBOLS {
7     __SYSTEM_CHECK__: type = import;  # force inclusion of "system check" load chunk
8     __STACKSIZE__:    type = weak, value = $0800; # 2k stack
9     __STARTADDRESS__: type = export, value = %S;
10     __SYSCHKHDR__:    type = export, value = 0; # Disable system check header
11     __SYSCHKTRL__:    type = export, value = 0; # Disable system check trailer
12 }
13 MEMORY {
14     ZP:          file = "", define = yes, start = $0082,                size = $007E;
15
16 # "system check" load chunk
17     SYSCHKCHNK:  file = %O,               start = $2E00,                size = $0300;
18
19 # "shadow RAM preparation" load chunk
20     SRPREPCHNK:  file = %O, define = yes, start = %S,                   size = $7C20 - %S - $07FF;  # $07FF: space for temp. chargen buffer, 1K aligned
21
22 # "main program" load chunk
23     MAIN:        file = %O, define = yes, start = %S + __LOWBSS_SIZE__, size = $D000 - __STACKSIZE__ - %S - __LOWBSS_SIZE__;
24
25 # memory beneath the ROM preceeding the character generator
26     HIDDEN_RAM2: file = "", define = yes, start = $D800,                size = $0800;
27
28 # address of relocated character generator (same addess as ROM version)
29     CHARGEN:     file = "", define = yes, start = $E000,                size = $0400;
30
31 # memory beneath the ROM
32     HIDDEN_RAM:  file = "", define = yes, start = $E400,                size = $FFFA - $E400;
33
34 # UNUSED - hide
35     UNUSED:  file = "", start = $0,  size = $10;
36 }
37 FILES {
38     %O: format = atari;
39 }
40 FORMATS {
41     atari: runad = start,
42            initad = SYSCHKCHNK: __SYSTEM_CHECK__,
43            initad = SRPREPCHNK: sramprep;
44 }
45 SEGMENTS {
46     ZEROPAGE:    load = ZP,                            type = zp;
47     EXTZP:       load = ZP,                            type = zp,                optional = yes;
48
49     SYSCHK:      load = SYSCHKCHNK,                    type = rw,  define = yes, optional = yes;
50     LOWBSS:      load = SRPREPCHNK,                    type = bss, define = yes;  # shared btw. SRPREPCHNK and RAM, not zero initialized
51     SRPREP:      load = SRPREPCHNK,                    type = rw,  define = yes;
52     SHADOW_RAM:  load = SRPREPCHNK, run = HIDDEN_RAM,  type = rw,  define = yes, optional = yes;
53     SHADOW_RAM2: load = SRPREPCHNK, run = HIDDEN_RAM2, type = rw,  define = yes, optional = yes;
54     STARTUP:     load = MAIN,                          type = ro,  define = yes;
55     LOWCODE:     load = MAIN,                          type = ro,  define = yes, optional = yes;
56     ONCE:        load = MAIN,                          type = ro,                optional = yes;
57     CODE:        load = MAIN,                          type = ro,  define = yes;
58     RODATA:      load = MAIN,                          type = ro;
59     DATA:        load = MAIN,                          type = rw;
60     INIT:        load = MAIN,                          type = rw,                optional = yes;
61     BSS:         load = MAIN,                          type = bss, define = yes;
62     SRPREPHDR:   load = UNUSED,                        type = ro;
63     SRPREPTRL:   load = UNUSED,                        type = ro;
64 }
65 FEATURES {
66     CONDES: type    = constructor,
67             label   = __CONSTRUCTOR_TABLE__,
68             count   = __CONSTRUCTOR_COUNT__,
69             segment = ONCE;
70     CONDES: type    = destructor,
71             label   = __DESTRUCTOR_TABLE__,
72             count   = __DESTRUCTOR_COUNT__,
73             segment = RODATA;
74     CONDES: type    = interruptor,
75             label   = __INTERRUPTOR_TABLE__,
76             count   = __INTERRUPTOR_COUNT__,
77             segment = RODATA,
78             import  = __CALLIRQ__;
79 }