-
Notifications
You must be signed in to change notification settings - Fork 98
/
FILE_FORMATS
354 lines (284 loc) · 10.4 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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
NOTE! integers are in big endian format.
WLA GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX object file format "WLAl"
bytes description
header:
4 format information,
"WLAl" - WLA GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX object file version 37 (20-Aug-2023)
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)
bit 1 - sms checksum was already written (1 == yes)
bit 2 - use a special range for sms checksum calculation (1 == yes)
bit 3 - sega mega drive checksum (1 == compute))
4 special range for sms checksum calculation (int)
4 base address for SMS ROM header (int)
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)
4 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)
4 file id (int)
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, 5 = direct 13-bit, 6 = direct 32-bit, 7 = bits, 8 = 9-bit short)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST, 4 == flip endianess)
4 file id (int)
1 bits starting position (0-7, only present if result type == 7)
1 bits to define (1-32, only present if result type == 7)
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, 3 = unknown, 4 = 13-bit, 5 = 32-bit, 6 = bits,
7 = 9-bit short)
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 == flip endianess)
4 section (0 = no section, 1+ = section id) (int)
4 file id (int)
1 number of stack items
1 position (0 = definition, 1 = elsewhere)
1 bits starting position (0-7, only present if result type == 6)
1 bits to define (1-32, only present if result type == 6)
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 = label, 3 = deleted, 4 = stack, 5 = string)
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
...
global list file information
n global list file information block **
section appendtos/afters
4 number of appends (int)
...
4 section id (int)
1 type (0 = after, 1 = appendto)
n 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), 9 (ram force),
10 (ram semifree), 11 (ram semisubfree) or
12 (banked)
1 keep the section (0 = no, 1 = yes)
n namespace (terminated with 0)
n banked banks list (terminated with 0, only present if type is BANKED)
4 section id (int)
1 slot number (0-255)
4 file id (int)
4 relative address (int)
4 bank number (int)
4 base (int)
4 size (int)
4 alignment (int)
4 offset (int)
4 priority (int)
4 bitwindow (int)
4 window start (int)
4 window end (int)
n data
1 list file information (0 == no, 1 == yes)
n list file information block (if present) *
WLA-GB/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX library file format "WLAI"
bytes description
header:
4 format information,
"WLAI" - WLA-GB/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX library file version 29 (02-Apr-2022)
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)
4 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)
4 file id (int)
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, 5 = direct 13-bit, 6 = direct 32-bit, 7 = bits, 8 = 9-bit short)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST, 4 == flip endianess)
4 section (1+ = section id) (int)
4 file id (int)
1 bits starting position (0-7, only present if result type == 7)
1 bits to define (1-32, only present if result type == 7)
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, 3 = unknown, 4 = 13-bit, 5 = 32-bit, 6 = bits,
7 = 9-bit short)
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 == flip endianess)
4 section (1+ = section id) (int)
4 file id (int)
1 number of stack items
1 position (0 = definition, 1 = elsewhere)
1 bits starting position (0-7, only present if result type == 6)
1 bits to define (1-32, only present if result type == 6)
4 relative address (int)
4 line number (int)
...
1 type (0 = value, 1 = operator, 2 = label, 3 = deleted, 4 = stack, 5 = string)
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
...
global list file information
n global list file information block **
section appendtos/afters
4 number of appends (int)
...
4 section id (int)
1 type (0 = after, 1 = appendto)
n name (0 terminated)
n append to (0 terminated)
...
sections:
...
n name (terminated with 0 (for free), 6 (ram free) or 7 (for superfree))
1 keep the section (0 = no, 1 = yes)
n namespace (terminated with 0)
4 section id (int)
4 file id (int)
4 number of bytes (int)
4 alignment (int)
4 offset (int)
4 priority (int)
4 bitwindow (int)
4 window start (int)
4 window end (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)
4 data 3 (present only if command == 'k') (int)
...
** global 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)
4 data 3 (present only if command == 'k') (int)
4 data 4 (present only if command == 'k') (int)
4 data 5 (present only if command == 'k') (int)
4 data 6 (present only if command == 'k') (int)
...