-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinker.cfg
124 lines (101 loc) · 4.94 KB
/
linker.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Train 3 Open Source Edition
# Linker Configuration - Segmented binary load file with overlapping segments
#Start address
FEATURES {
STARTADDRESS: default = $1000;
}
#Symbols that can be used instead of numbers
SYMBOLS {
__EXEHDR__: type = import;
__AUTOSTART__: type = import; # force inclusion of autostart "trailer"
__STACKSIZE__: type = weak, value = $0180; # 384B stack
__STARTADDRESS__: type = export, value = %S;
__RESERVED_MEMORY__: type = weak, value = $0000;
}
MEMORY {
#Zero page
ZP: file = "", define = yes, start = $0082, size = $0048;
# File header, just $FFFF, see libsrc/exehdr.s
HEADER: file = %O, start = $0000, size = $0002;
# Preinitialization 1 - Disable BASIC
MEM_PREINIT_HEADER: file =%O, start = $0000, size=4;
MEM_PREINIT: file = %O, start = $2000, size = $1000;
# Loading screen - Display list and screen memory
MEM_LD_SCREEN_HEADER: file=%O, start = $0000, size=4;
MEM_LD_SCREEN: file = %O start = $BC00, size = $1000;
# Preinitialization 2 - Show loading screen
MEM_PREINIT2_HEADER: file =%O, start = $0000, size=4;
MEM_PREINIT2: file = %O, start = $2000, size = $1000;
# "main program" load chunk with some game data included. See libsrc/exehdr.s
# Note the STACK and RESERVED_MEMORY
MAINHDR: file = %O, start = $0000, size = $0004;
MAIN: file = %O, define = yes, start = %S, size = $C000 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;
# "run address"
# Segment comes from library, see libsrc/exetrailer.s
TRAILER: file = %O, start = $0000, size = $0006;
# "Cave and status bar screen memory"
GAMESCREEN: file= "",define=yes, start = $0400, size = 960;
STATUSBARSCREEN: file="", start = $0400+960, size = 40;
# "PMG area" (2KB, start at $0800)
# Note that there is no file
PMGAREA: file = "",define=yes, start = $0800, size = $0800;
# "raster music tracker player" binary file
# Address is zero, bacuse the binary file contains section headers)
RMTPLAYER: file = %O, start = $0000, size = $1000;
RMTSONG : file = %O, start = $0000, size = $4000;
}
SEGMENTS {
#Segment used by the main program and library
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
INIT: load = MAIN, type = rw, optional = yes;
#Segments of game data
TRAIN_SEG_CHARSET1: load = MAIN, type = ro, align = $0400;
TRAIN_SEG_CHARSET2: load = MAIN, type = ro, align = $0400;
TRAIN_SEG_DL: load = MAIN, type = ro, align = $0400;
TRAIN_SEG_SCROLLER: load = MAIN, type = ro, align = $0400;
TRAIN_SEG_DLI_JMPTAB: load = MAIN, type = ro, align = $0100;
#BSS segment must be the last one,
#otherwise the RUN vector will not be generated correctly
BSS: load = MAIN, type = bss, define = yes;
AUTOSTRT: load = TRAILER, type = ro;
#Raster music tracker
TRAIN_SEG_RMTSONG: load = RMTSONG, type = rw;
TRAIN_SEG_RMTPLAYER: load = RMTPLAYER, type = rw;
#PMG and screen memory. Nothe that the type is BSS. Uninitialized
TRAIN_SEG_PMGAREA: load = PMGAREA, type = bss;
TRAIN_SEG_GAMESCREEN: load = GAMESCREEN, type = bss;
TRAIN_SEG_STATUSBARSCREEN: load = STATUSBARSCREEN, type = bss;
#Preinitialization 1
TRAIN_SEG_PREINIT_HEADER: load=MEM_PREINIT_HEADER, type=ro;
TRAIN_SEG_PREINIT: load=MEM_PREINIT, type=ro;
#Loading screen
TRAIN_SEG_LD_SCREEN_HEADER: load=MEM_LD_SCREEN_HEADER, type=ro;
TRAIN_SEG_LD_SCREEN: load=MEM_LD_SCREEN, type=ro;
#Preinitialization 2
TRAIN_SEG_PREINIT2_HEADER: load=MEM_PREINIT2_HEADER, type=ro;
TRAIN_SEG_PREINIT2: load=MEM_PREINIT2, type=ro;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
}