-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathformats.s
381 lines (339 loc) · 8.79 KB
/
formats.s
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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
;*---------------------------------------------------------------------------
; :Program. formats.s
; :Contents. informations and routines regarding special formats
; :Author. Bert Jahn
; :Version $Id: formats.s 1.27 2020/03/14 14:10:05 wepl Exp wepl $
; :History. 18.03.01 created
; 23.07.01 rob format added
; 28.10.01 dos force made more tolerant
; 02.11.02 rework for new sync-search
; 08.11.02 added ocean, vision and twilight formats (Codetapper)
; 21.12.03 added goliath format (Codetapper)
; 01.01.04 added thalamus format (Codetapper)
; 09.01.04 added beyond the ice palace format (Codetapper)
; 09.02.04 added rob northen copylock
; 12.02.04 wwf_info added
; 05.10.04 twilight2/3 added
; 04.11.04 added rnclold
; 07.02.20 fixed structures for unknown/raw
; :Requires. OS V37+, MC68020+
; :Copyright. ©1998-2001 Bert Jahn, All Rights Reserved
; :Language. 68020 Assembler
; :Translator. Barfly V2.9
; :To Do.
;---------------------------------------------------------------------------*
INCLUDE fmt_std.s
INCLUDE fmt_gremlin.s
INCLUDE fmt_robnorthen.s
INCLUDE fmt_twilight.s
INCLUDE fmt_zzkj.s
_format_unknown dc.l 0 ;succ
dc.l 0 ;decode
dc.l 0 ;encode
dc.l 0 ;info
dc.l _name_unknown ;name
dc.l 0 ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w 0 ;datalen
dc.w 0 ;minimal rawlen
dc.w 0 ;writelen
dc.w -1 ;type
dc.w 0 ;flags
_format_raw dc.l _formats ;succ
dc.l 0 ;decode
dc.l 0 ;encode
dc.l 0 ;info
dc.l _name_raw ;name
dc.l 0 ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w DEFREADLEN ;datalen
dc.w 0 ;minimal rawlen
dc.w 0 ;writelen
dc.w TT_RAW ;type
dc.w 0 ;flags
_formats dc.l .stdf ;succ
dc.l _decode_std ;decode
dc.l 0 ;encode
dc.l 0 ;info
dc.l _name_std ;name
dc.l _sync_stdls ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w $1600 ;datalen
dc.w $440*11 ;minimal rawlen
dc.w $440*11 ;writelen
dc.w TT_STD ;type
dc.w 0 ;flags
.stdf dc.l .grem ;succ
dc.l _decode_stdf ;decode
dc.l 0 ;encode
dc.l 0 ;info
dc.l _name_stdf ;name
dc.l _sync_stdf ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w $1600 ;datalen
dc.w $440*11 ;minimal rawlen
dc.w $440*11 ;writelen
dc.w TT_STDF ;type
dc.w WWFF_FORCE ;flags
.grem dc.l .rob ;succ
dc.l _decode_grem ;decode
dc.l _encode_grem ;encode
dc.l 0 ;info
dc.l _name_grem ;name
dc.l _sync_grem ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w $1800 ;datalen
dc.w $3000+16 ;minimal rawlen
dc.w $3000+16 ;writelen
dc.w TT_GREM ;type
dc.w 0 ;flags
.rob dc.l .pmover ;succ
dc.l _decode_rob ;decode
dc.l _encode_rob ;encode
dc.l _info_rob ;info
dc.l _name_rob ;name
dc.l _sync_rob ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 4 ;speclen (diskkey)
dc.w $1800 ;datalen
dc.w 2+(12*$40c) ;minimal rawlen (that is minimum length, often a long track)
dc.w 2+(12*$40c) ;writelen
dc.w TT_ROB ;type
dc.w 0 ;flags
.pmover dc.l _beast1
INCLUDE fmt_primemover.s
_beast1 dc.l _beast2
INCLUDE fmt_beast1.s
_beast2 dc.l _bloodmoney
INCLUDE fmt_beast2.s
_bloodmoney dc.l _psygnosis1
INCLUDE fmt_bloodmoney.s
_psygnosis1 dc.l _turrican1
INCLUDE fmt_psygnosis1.s
_turrican1 dc.l _turrican2
INCLUDE fmt_turrican1.s
_turrican2 dc.l _turrican3a
INCLUDE fmt_turrican2.s
_turrican3a dc.l _turrican3b
INCLUDE fmt_turrican3a_1800.s
_turrican3b dc.l _ocean
INCLUDE fmt_turrican3b_1A00.s
_ocean dc.l _vision
INCLUDE fmt_ocean.s
_vision dc.l _slackskin
INCLUDE fmt_vision.s
_slackskin dc.l _twilight3 ;must ordered before twilight1
INCLUDE fmt_slackskin.s ;otherwise false detections
_twilight3 dc.l _twilight2
dc.l _decode_twilight3 ;decode
dc.l _encode_twilight3 ;encode
dc.l 0 ;info
dc.l _name_twilight3 ;name
dc.l _sync_twilight ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w $1800 ;datalen
dc.w 4+8+8+($1800*2)+4 ;minimal rawlen
dc.w 4+8+8+($1800*2)+4 ;writelen
dc.w TT_TWILIGHT3 ;type
dc.w 0 ;flags
_twilight2 dc.l _twilight1
dc.l _decode_twilight2 ;decode
dc.l _encode_twilight2 ;encode
dc.l 0 ;info
dc.l _name_twilight2 ;name
dc.l _sync_twilight ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w $1520 ;datalen
dc.w 4+8+8+($1520*2)+4 ;minimal rawlen
dc.w 4+8+8+($1520*2)+4 ;writelen
dc.w TT_TWILIGHT2 ;type
dc.w 0 ;flags
_twilight1 dc.l _zzkja
dc.l _decode_twilight1 ;decode
dc.l _encode_twilight1 ;encode
dc.l 0 ;info
dc.l _name_twilight1 ;name
dc.l _sync_twilight ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w $1400 ;datalen
dc.w 4+8+8+($1400*2)+4 ;minimal rawlen
dc.w 4+8+8+($1400*2)+4 ;writelen
dc.w TT_TWILIGHT ;type
dc.w 0 ;flags
_zzkja dc.l _zzkjb ;succ
dc.l _decode_zzkja ;decode
dc.l _encode_zzkja ;encode
dc.l 0 ;info
dc.l _name_zzkja ;name
dc.l _sync_zzkj ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w $800 ;datalen
dc.w 6+($808*2) ;minimal rawlen
dc.w 6+($808*2) ;writelen
dc.w TT_ZZKJA ;type
dc.w 0 ;flags
_zzkjb dc.l _zzkjc ;succ
dc.l _decode_zzkjb ;decode
dc.l _encode_zzkjb ;encode
dc.l 0 ;info
dc.l _name_zzkjb ;name
dc.l _sync_zzkj ;sync
dc.l 0 ;density
dc.w $130 ;index
dc.w 0 ;speclen
dc.w $1000 ;datalen
dc.w 6+($1008*2) ;minimal rawlen
dc.w 6+($1008*2) ;writelen
dc.w TT_ZZKJB ;type
dc.w WWFF_INDEX ;flags
_zzkjc dc.l _zzkjd ;succ
dc.l _decode_zzkjc ;decode
dc.l _encode_zzkjc ;encode
dc.l 0 ;info
dc.l _name_zzkjc ;name
dc.l _sync_zzkjc ;sync
dc.l 0 ;density
dc.w $130 ;index
dc.w 0 ;speclen
dc.w $1600 ;datalen
dc.w 26+($1608*2) ;minimal rawlen
dc.w 26+($1608*2) ;writelen
dc.w TT_ZZKJC ;type
dc.w WWFF_INDEX ;flags
_zzkjd dc.l _specialfx ;succ
dc.l _decode_zzkjd ;decode
dc.l _encode_zzkjd ;encode
dc.l 0 ;info
dc.l _name_zzkjd ;name
dc.l _sync_zzkjd ;sync
dc.l 0 ;density
dc.w 0 ;index
dc.w 0 ;speclen
dc.w $1600 ;datalen
dc.w $41c*11 ;minimal rawlen
dc.w $41c*11 ;writelen
dc.w TT_ZZKJD ;type
dc.w 0 ;flags
_specialfx dc.l _tiertex ;succ
INCLUDE fmt_specialfx.s
_tiertex dc.l _elite ;succ
INCLUDE fmt_tiertex.s
_elite dc.l _goliath ;succ
INCLUDE fmt_elite.s
_goliath dc.l _thalamus ;succ
INCLUDE fmt_goliath.s
_thalamus dc.l _beyond ;succ
INCLUDE fmt_thalamus.s
_beyond dc.l _rncl ;succ
INCLUDE fmt_beyond.s
_rncl dc.l _rnclold ;succ
INCLUDE fmt_rncopylock.s
_rnclold dc.l _hitec ;succ
INCLUDE fmt_rncopylockold.s
_hitec dc.l _mason ;succ
INCLUDE fmt_hitec.s
_mason dc.l 0 ;succ
INCLUDE fmt_mason.s
; even odd
; --sync-- ffTTSSGG ffTTSSGG
_sync_std dc.l 0,$44,$89448955,$00000055 ;finds one sector
dc.l 0,$ff,$ffffffff,$000000ff
;dc.l 0,$44894489,$55000025,$55000029 ;finds first sector after gap
;dc.l 0,$ffffffff,$ff00007f,$ff00007f
_sync_stdls dc.l 0,$44894489,$5500002a,$55000029 ;finds last sector before gap
dc.l 0,$ffffffff,$ff00007f,$ff00007f
_sync_stdf dc.l 0,0,0,$44894489 ;finds one sector
dc.l 0,0,0,$ffffffff
_sync_grem dc.l 0,0,$44894489,$44895555
dc.l 0,0,$ffffffff,$ffffffff
_sync_rob dc.l 0,0,0,$14484891
dc.l 0,0,0,$ffffffff
_sync_twilight dc.l $44894489,$55555500,$55555500,$2aaaaaaa
dc.l $ffffffff,$ffffff00,$ffffff00,$7fffffff
_sync_zzkj dc.l 0,0,$44894489,$2aaaaaaa
dc.l 0,0,$ffffffff,$ffffffff
_sync_zzkjc dc.l $44894489,$2aaaaaaa,$aaaaaaaa,$aaaaaaaa
dc.l $ffffffff,$ffffffff,$ffffffff,$ffffffff
_sync_zzkjd dc.l 0,$4489,$44892aaa,$aaaa0000
dc.l 0,$ffff,$ffffffff,$ffff0055
_sync_calc dc.l 0,0,0,$448a448a
dc.l 0,0,0,$ffffffff
_name_unknown dc.b "unknown",0
_name_raw dc.b "raw",0
_name_std dc.b "dos",0
_name_stdf dc.b "dosf",0
_name_grem dc.b "gremlin",0
_name_rob dc.b "robnorthen",0
_name_twilight1 dc.b "twilight1",0
_name_twilight2 dc.b "twilight2",0
_name_twilight3 dc.b "twilight3",0
_name_zzkja dc.b "zzkja",0
_name_zzkjb dc.b "zzkjb",0
_name_zzkjc dc.b "zzkjc",0
_name_zzkjd dc.b "zzkjd",0
EVEN
;----------------------------------------
; encode a long to mfm
; IN: D2 = ULONG data long to encode
; D3 = ULONG $55555555
; A0 = APTR destination mfm buffer
; OUT: D0/D1 destroyed
; A0 = A0 + 4
CNOP 0,4
_encode_longodd lsr.l #1,d2
_encode_long and.l d3,d2
move.l d2,d0
eor.l d3,d0
move.l d0,d1
add.l d0,d0
lsr.l #1,d1
bset #31,d1
and.l d0,d1
or.l d1,d2
btst #0,-1(a0)
beq .ok
bclr #31,d2
.ok move.l d2,(a0)+
rts
;----------------------------------------
; encode a word to mfm
; IN: D2 = UWORD data word to encode
; D3 = ULONG $55555555
; A0 = APTR destination mfm buffer
; OUT: D0/D1 destroyed
; A0 = A0 + 2
CNOP 0,4
_encode_wordodd lsr.w #1,d2
_encode_word and.w d3,d2
move.w d2,d0
eor.w d3,d0
move.w d0,d1
add.w d0,d0
lsr.w #1,d1
bset #15,d1
and.w d0,d1
or.w d1,d2
btst #0,-1(a0)
beq .ok
bclr #15,d2
.ok move.w d2,(a0)+
rts