aboutsummaryrefslogtreecommitdiff
path: root/src/alf.1
blob: 46a1ef22383aa2b22f684a5f1627765c59ec3249 (plain)
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
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "ALF" 1 "2025-12-12" "0.4.0" "Urchlay's Atari 8-bit Tools"
.SH NAME
alf \- create Atari 8-bit ALF archives
.\" RST source for alf(1) man page. Convert with:
.
.\" rst2man.py alf.rst > alf.1
.
.SH SYNOPSIS
.sp
alf [\fB\-\-help\fP] | [\fB\-\-version\fP | \fB\-V\fP | [\fB\-a\fP | \fB\-o\fP ] [\fB\-t[dgz]\fP] [\fB\-v\fP] \fIalf\-file\fP \fIfile[=NAME]\fP [\fIfile[=NAME]\fP ...]
.SH DESCRIPTION
.sp
\fBalf\fP creates \fIALF\fP archives.
.sp
\fIALF\fP is a compressed archive format similar to \fBarc\fP(1), though
not compatible with it. It was used on the Atari 8\-bit platform
beginning in the late 1980s. The Atari executables are \fBLZ.COM\fP
for the compressor and \fBDZ.COM\fP for the decompressor. \fBalf\fP is a
rewrite of \fBLZ.COM\fP for modern operating systems, with added features.
.sp
By default, the \fIalf\-file\fP is created, and the \fIfile\fPs are compressed
and added to it. If \fIalf\-file\fP already existed, it is backed up by adding
a \fB~\fP to the filename.
.sp
The \fBALF\fP file format only supports uppercase "8.3" filenames
(Atari DOS or MS\-DOS style), and does not support subdirectories. The
filenames you give will be stored in the \fBALF\fP file uppercased
and truncated to fit the 8.3 scheme. This could result in duplicate
filenames in the archive, if you\(aqre not careful.
.sp
Filenames in the archive can be explicitly set. Each \fIfile\fP can be
given as \fIfile=NAME\fP, where \fINAME\fP will be the file\(aqs name in the
\fIALF\fP archive. The \fINAME\fP is still uppercased and truncated to 8.3.
.SH OPTIONS
.sp
Options can be combined (e.g. \fB\-ov\fP means \fB\-o\fP \fB\-v\fP), though the
\fB\-td\fP, \fB\-tu\fP, \fB\-tz\fP options must appear last (\fB\-tdv\fP would be
an error; \fB\-vtd\fP is OK).
.INDENT 0.0
.TP
.B  \-a
Append to \fIalf\-file\fP\&. The files are added to the end of the archive. Be
careful not to add a file with the same name as as existing member of
the archive. If \fIalf\-file\fP doesn\(aqt exist, it will be created. No backup
is made with \fB\-a\fP\&.
.UNINDENT
.\" append to ALF file.
.
.INDENT 0.0
.TP
.B  \-A
Convert line endings and tabs from ASCII to ATASCII in all input
files. This will corrupt any executables or non\-text data files,
so use with caution. There is no way to autodetect text files,
unlike \fBunalf\fP\&.
.UNINDENT
.\" convert EOLs and tabs in all input files.
.
.INDENT 0.0
.TP
.B  \-h\fP,\fB  \-\-help
Show built\-in help message.
.UNINDENT
.\" show this help message.
.
.INDENT 0.0
.TP
.B  \-o
Overwrite \fIalf\-file\fP if it exists; do not make a \fB~\fP backup.
.UNINDENT
.\" overwrite ALF file if it exists (don't create file~ backup).
.
.INDENT 0.0
.TP
.B  \-q
Quiet operation. \fBalf\fP won\(aqt print any messages on standard
output. Errors and warnings will still be printed to standard
error.
.UNINDENT
.\" quiet.
.
.INDENT 0.0
.TP
.B \fB\-td\fP
Use default \fBLZ.COM\fP timestamps (8 Dec 82  12:24).
.UNINDENT
.\" use default LZ.COM timestamps.
.
.INDENT 0.0
.TP
.B \fB\-tu\fP
Use UTC for timestamps (default is local timezone).
.UNINDENT
.\" use UTC timestamps.
.
.INDENT 0.0
.TP
.B \fB\-tz\fP
Use zero for timestamps. \fBunalf\fP will display \fI<none>\fP for the
date and midnight for the time.
.UNINDENT
.\" use zero timestamps.
.
.INDENT 0.0
.TP
.B  \-v
Verbose operation. Shows more information about what \fBalf\fP
is doing. Can be given twice to dump the token tables (\fIlots\fP of
output; for debugging only).
.UNINDENT
.\" verbose (-vv: debug).
.
.INDENT 0.0
.TP
.B  \-V\fP,\fB  \-\-version
Show \fBalf\fP version number and exit.
.UNINDENT
.\" show version number.
.
.INDENT 0.0
.TP
.B \-\-
End of options. The next argument is treated as the \fIalf\-file\fP and
any further options are files to add to the archive.
.UNINDENT
.\" end of options (next arg is alf-file).
.
.\" ENDOPTS
.
.SH EXIT STATUS
.INDENT 0.0
.TP
.B 0
Success.
.TP
.B 1
Fatal error (I/O or bad command\-line arguments).
.UNINDENT
.SH DIAGNOSTICS
.sp
Besides the standard error messages such as "no such file or
directory":
.SS Filenames
.INDENT 0.0
.TP
.B \fBfilename has underscore, OK on Sparta/MyDOS, not Atari DOS 2.x\fP
Not an actual problem, unless you try to extract this ALF file on
an Atari running Atari DOS 2.0/2.5, or any other DOS that doesn\(aqt
allow underscores in filenames.
.TP
.B \fBbad Atari filename\fP \fI<filename>\fP \fI<reason>\fP
The filename stored in the ALF header doesn\(aqt follow the rules for
Atari DOS filenames. \fI<reason>\fP will be something like "doesn\(aqt start
with A\-Z" or "invalid character". The filename will be printed with
any unprintable characters as hex values (e.g. \fB$01\fP).
.UNINDENT
.sp
With either of the above, the resulting \fIALF\fP archive will extract
with \fBunalf\fP, but will have problems with \fBDZ.COM\fP running on an
Atari. Or you can just rename the files so they comply with Atari DOS
filename restrictions.
.INDENT 0.0
.TP
.B \fBduplicate Atari filename\fP \fI<filename>\fP
You gave the same filename twice, or you gave two (or more) filenames that
convert to the same "8.3" Atari filename. Example: \fIfoo.bar\fP and \fIfoo.barf\fP
both get stored as \fIFOO.BAR\fP\&. You can avoid this by using the \fIfile=NAME\fP
syntax, e.g.:
.INDENT 7.0
.INDENT 3.5
.sp
.nf
.ft C
$ alf ARCHIVE.ALF foo.bar foo.barf=FOO.BRF
.ft P
.fi
.UNINDENT
.UNINDENT
.UNINDENT
.SS File Size
.INDENT 0.0
.TP
.B \fBthis file is too large; only compressing the first 16MB.\fP
The \fIALF\fP file format doesn\(aqt support files larger than
16MB. Actually the \fIfile format\fP does, but the decompressor
(either \fBDZ.COM\fP or \fBunalf\fP) does not.
.UNINDENT
.SH NOTES
.SS Compatibility
.sp
This \fBalf\fP is \fIintended\fP to be 100% compatible with the original
Atari \fBLZ.COM\fP aka \fBALF.COM\fP, with the following differences:
.INDENT 0.0
.IP \(bu 2
There is no interactive mode. The file to create and the files to add
must be given as command\-line arguments.
.IP \(bu 2
\fBLZ.COM\fP always appends to a file that already exists. This \fBalf\fP
overwrites (making a backup) by default, and can append with the \fB\-a\fP
option.
.IP \(bu 2
\fBLZ.COM\fP doesn\(aqt handle 0\-byte (empty) files correctly, but \fBalf\fP
does. Not that this is very useful.
.IP \(bu 2
Turning the screen off for speed makes no sense on modern operating
systems, so there\(aqs no option for that.
.UNINDENT
.sp
Note that \fBalf\fP is a complete reverse\-engineered rewrite in C, \fInot\fP
a port of the original 6502 code as \fBunalf\fP is. It\(aqs still being
tested, and may still contain bugs.
.sp
A note about the Atari filenames: \fBDZ.COM\fP is sometimes found on
old disk images as \fBUNALF.COM\fP, and \fBLZ.COM\fP is sometimes called
\fBALF.COM\fP or \fBALFER.COM\fP\&. I\(aqve used the original names partly
out of respect for the original author, and partly to avoid confusion
between my \fBalf\fP/\fBunalf\fP and his Atari ones.
.SS Compression Characteristics
.sp
Larger files compress better than smaller ones. Very small files
will get larger when compressed. Files with lots of entropy (random
garbage, files that are already compressed) will also get larger.
.sp
For text files, compression is usually around 45% to 50%, which
is comparable with \fBarc\fP\&. For SAVEd Atari BASIC, the average is
a little worse: 35% to 40%. For executables, it seems to average
around 30%... unless the executables are already compressed (e.g.
self\-decompressing), in which case they\(aqll get bigger when compressed
with \fBalf\fP\&.
.SS File Size Limits
.sp
\fBalf\fP (and \fBLZ.COM\fP) have a 16MB file size limit. This applies to
both the input file size, and the compressed size (in case of files
that grow when compressed, e.g. random data).
.sp
Real Atari 8\-bit files are never this large anyway, so it\(aqs a
pathological case. A real Atari would take hours or even days to
compress/decompress such files, and you\(aqd have to have a hard disk and
a DOS capable of handling multi\-megabyte files...
.SS Performance
.sp
Performance is pretty good, as of alftools\-0.4.0. For small files
like you\(aqd use on an Atari (up to 50KB), it\(aqs basically instantaneous
(0.008 seconds) on the author\(aqs modest i7 workstation. For a 1MB text
file, it takes 0.022 sec (faster than \fBarc\fP!). For 1MB of random
garbage, it\(aqs 0.03 sec (and the resulting ALF file is 36% larger than
the garbage).
.sp
By comparison, \fBzip\fP takes 0.06 seconds to compress the 1MB text file,
and 0.03 sec for the 1MB randomness (and the compressed file is still
larger than the input, but only by 312 bytes). \fBarc\fP
compresses the text file in 0.03s, and it\(aqs smart enough to \fInot\fP
compress the random garbage (it uses the \(aqstore\(aq method, which \fBalf\fP
doesn\(aqt have).
.SS Timestamps
.sp
The date/time stamps stored in the archive are the \fBmtime\fPs of the
files (which is the same time \fBls\fP(1) shows, by default), and your
local timezone is assumed (but see the \fB\-td\fP, \fB\-tu\fP, \fB\-tz\fP
options above). There\(aqs no way to store timezone or daylight savings
info in the \fIALF\fP file.
.sp
The year stored in the \fIALF\fP file doesn\(aqt have a Y2K problem. It does,
however, have a Y2108 problem: the range is from 1980 to 2107. Files
with timestamps outside this range will have a zero (invalid) date in the
\fIALF\fP header, and \fBunalf\fP will display the date as \fI<none>\fP\&.
.sp
The timestamp only has 2\-second resolution. Files with odd\-numbered
seconds in the \fImtime\fP will have the number before that (1 => 0, 31 =>
30, etc). This is a limitation of the \fIALF\fP file format. Also of the
\fIARC\fP format (I didn\(aqt know that, did you?)
.SH COPYRIGHT
.sp
The original AlfCrunch (\fBDZ.COM\fP and \fBLZ.COM\fP) for the Atari 8\-bit
was released into the Public Domain. \fBalf\fP contains no code from
AlfCrunch.
.sp
\fBalf\fP is released under the WTPFL: Do WTF you want with this.
.SH AUTHOR
.sp
The original AlfCrunch for the Atari 8\-bit was written by Alfred, who
can be reached via the AtariAge.com forums with the username "Alfred".
.sp
This \fBalf\fP was written by B. Watson <\fI\%urchlay@slackware.uk\fP>.
.SH SEE ALSO
.sp
\fBunalf\fP(1), \fBalfsum\fP(1)
.sp
The git repository for \fBalftools\fP:
.INDENT 0.0
.INDENT 3.5
\fI\%https://slackware.uk/~urchlay/repos/alftools\fP
.UNINDENT
.UNINDENT
.sp
Other Atari\-related projects by the author, including \fBbw\-atari8\-tools\fP
and \fBunmac65\fP:
.INDENT 0.0
.INDENT 3.5
\fI\%https://slackware.uk/~urchlay/repos/\fP
.UNINDENT
.UNINDENT
.\" Generated by docutils manpage writer.
.