forked from vhelin/wla-dx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FILE_FORMATS
299 lines (238 loc) · 7.85 KB
/
FILE_FORMATS
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
NOTE! integers are in big endian format.
WLA GB-Z80/Z80/6502/65C02/65CE02/6510/65816/6800/6801/6809/8008/8080/HuC6280/SPC-700 object file format "WLAa"
bytes description
header:
4 format information,
"WLAa" - WLA GB-Z80/Z80/6502/65C02/65CE02/6510/65816/6800/6801/6809/8008/8080/HuC6280/SPC-700 object file version 26 (17-Jun-2020)
1 empty fill
1 misc bits (bit 0 - sms checksum (1 == compute)
bit 1 - snes rom mode (0 == lorom, 1 == hirom)
bit 2 - snes banking indicator (1 == use snes rom banking)
bit 3 - snes rom speed indicator (0 == 200ns, 1 == 120ns)
bit 4 - gb checksum (1 == compute)
bit 5 - gb complement check (1 == compute)
bit 6 - snes checksum (1 == compute)
bit 7 - 65816 indicator (1 == 65816))
1 more bits (bit 0 - smc (1 == add smc rom header)
bit 1 - snes sram size, lower bit
bit 2 - snes sram size, higher bit
bit 3 - sms tag (1 == inject)
bit 4 - sms header (1 == inject)
bit 5 - snes exhirom (1 = yes)
bit 6 - snes exlorom (1 = yes)
bit 7 - endianess (1 = big endian))
1 extr bits (bit 0 - 65ce02 indicator (1 == 65ce02))
rom bank map:
4 number of rom banks (int)
1 entry types (0 = general bank size follows, 1 = bank size list follows)
4 general bank size (int)
...
4 bank size (int)
...
memory map:
1 number of entries (1-255)
...
4 slot address (int)
4 slot size (int)
n slot name (0 terminated)
...
source file name list:
4 number of source file names (int)
...
n source file name (0 terminated)
1 id
4 checksum
...
exported definitions:
4 number of definitions (int)
...
n definition label (terminated with 0 (value definition) or 1 (calculation definition))
8 value or index of the pending calculation (double)
...
labels, symbols and breakpoints:
4 number of entries (int)
...
n name (0 terminated if a label, 1 if a symbol, 2 if a breakpoint)
1 slot number (0-255)
1 file id
4 section (0 = no section, 1+ = section id) (int)
4 relative address (int)
4 line number (int)
4 bank number (int)
4 base (int)
...
outside references:
4 number of references (int)
...
n label (0 terminated)
1 type (0 = direct 16-bit, 1 = relative 8-bit, 2 = direct 8-bit, 3 = direct 24-bit,
4 = relative 16-bit)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST)
1 file id
1 slot number (0-255)
4 section (0 = no section, 1+ = section id) (int)
4 line number (int)
4 relative address (int)
4 bank number (int)
4 base (int)
...
pending calculations:
4 number of pending calculations (int)
...
4 id (int)
1 result type (0 = 8-bit, 1 = 16-bit, 2 = 24-bit)
if bit 7 == 1, then the label references are relative, else absolute
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST)
4 section (0 = no section, 1+ = section id) (int)
1 file id
1 number of stack items
1 position (0 = definition, 1 = elsewhere)
1 slot number (0-255)
4 relative address (int)
4 line number (int)
4 bank number (int)
4 base (int)
...
1 type (0 = value, 1 = operator, 2 = string, 3 = deleted, 4 = stack)
1 sign (0 = positive, 1 = negative)
8 value (double) OR
n string (0 terminated)
...
...
label sizeofs
4 number of label sizeofs (int)
...
n name (0 terminated)
4 size
...
section appends
4 number of appends (int)
...
n section name (0 terminated)
n append to (0 terminated)
...
data area (loops to the end of the file):
...
1 type (0 = data block, 1 = section)
...
data block:
4 address (int)
4 number of bytes n (int)
n data
section:
n name (terminated with 0 (free), 1 (force), 2 (overwrite), 3 (header),
4 (semifree), 5 (absolute), 6 (ram free),
7 (superfree), 8 (semisubfree) or 9 (ram force))
1 keep the section (0 = no, 1 = yes)
n namespace (terminated with 0)
4 section id (int)
1 slot number (0-255)
1 file id
4 relative address (int)
4 bank number (int)
4 base (int)
4 size (int)
4 alignment (int)
4 offset (int)
4 priority (int)
n data
1 list file information (0 == no, 1 == yes)
n list file information block (if present)
WLA-GB/Z80/6502/65C02/65CE02/6510/65816/6800/6801/6809/8008/8080/HuC6280/SPC-700 library file format "WLA9"
bytes description
header:
4 format information,
"WLA9" - WLA-GB/Z80/6502/65C02/65CE02/6510/65816/6800/6801/6809/8008/8080/HuC6280/SPC-700 library file version 20 (17-Jun-2020)
1 misc bits (bit 0 - endianess (1 = big endian)
bit 1 - 65816 indicator (1 == 65816)
bit 2 - 65ce02 indicator (1 == 65ce02))
source file name list:
4 number of source file names (int)
...
n source file name (0 terminated)
1 id
4 checksum
...
exported definitions:
4 number of definitions (int)
...
n definition label (terminated with 0 (value definition) or 1 (calculation definition))
8 value or index of the pending calculation (double)
...
labels, symbols and breakpoints:
4 number of entries (int)
...
n name (0 terminated if a label, 1 if a symbol, 2 if a breakpoint)
4 section (1+ = section id) (int)
1 file id
4 line number (int)
4 relative address (int)
...
outside references:
4 number of references (int)
...
n label (0 terminated)
1 type (0 = direct 16-bit, 1 = relative 8-bit, 2 = direct 8-bit, 3 = direct 24-bit,
4 = relative 16-bit)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST)
4 section (1+ = section id) (int)
1 file id
4 line number (int)
4 relative address (int)
...
pending calculations:
4 number of pending calculations (int)
...
4 id (int)
1 result type (0 = 8-bit, 1 = 16-bit, 2 = 24-bit)
if bit 7 == 1, then the label references are relative, else absolute
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST)
4 section (1+ = section id) (int)
1 file id
1 number of stack items
1 position (0 = definition, 1 = elsewhere)
4 relative address (int)
4 line number (int)
...
1 type (0 = value, 1 = operator, 2 = string, 3 = deleted, 4 = stack)
1 sign (0 = positive, 1 = negative)
8 value (double) OR
n string (0 terminated)
...
...
label sizeofs
4 number of label sizeofs (int)
...
n name (0 terminated)
4 size
...
section appends
4 number of appends (int)
...
n section name (0 terminated)
n append to (0 terminated)
...
sections:
...
n name (terminated with 0 (for free), 6 (ram) or 7 (for superfree))
1 keep the section (0 = no, 1 = yes)
n namespace (terminated with 0)
4 section id (int)
1 file id
4 number of bytes (int)
4 alignment (int)
4 offset (int)
4 priority (int)
n data
1 list file information (0 == no, 1 == yes)
n list file information block (if present)
...
* list file information block:
bytes description
4 number of items
...
1 command ('f' == file name, 'k' == new line)
4 data 0 (int)
4 data 1 (present only if command == 'k') (int)
4 data 2 (present only if command == 'k') (int)
...