aboutsummaryrefslogtreecommitdiff
path: root/doc/fileformat.txt
blob: 5c33f2afc7082fc76912cfe1deddead576e24cfb (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
An ALF archive is laid out exactly like an ARC version 2 or greater
archive, with a 29-byte header for each file, followed by the
compressed data, followed by either EOF or the next file's header.

See the file Arcinfo for the original ARC file format. For ALF files,
"Byte 2: Compression version" will always be $0F.

The differences are:

- ALF files use $0F for the 'compression type' (Byte 1), whereas
  ARC files use compression types 2 through 8 (or 1, for ARC v1).

- The actual compressed data is incompatible with any of the
  compression types supported by ARC. Although ALF uses an
  implementation of Lempel-Zev, it's not the same implementation
  as any of the ones that ARC uses.

- For ARC, the last file's compressed data is followed by a 0 byte
  (in place of the $1A header), to signal "end of archive". For
  ALF, there's no data after the last byte of the last compressed
  file.

- Because ALF doesn't use a 0 byte to signal end-of-archive, it's
  possible to append two ALF archives together; the result is also
  a valid ALF archive... unless there's "junk at EOF" on the first
  file.

Other things caused by the limitations of the Atari:

- Not really a file format difference, but the dates stored inside
  ALF files might be wrong or gibberish, if they were created on
  an Atari OS other than SpartaDOS (or, on SpartaDOS, but without
  the time set correctly).

- Atari filenames are generally limited to 12 characters, e.g.
  PROGRAM1.BAS, so the filename field (Bytes 3-15, 13 bytes long)
  will never be completely filled. ALF uses a null (0) byte for
  the filename terminator, and any remaining bytes in the field
  will be set to $20 (ASCII spaces, *not* more nulls).

- Atari filenames with no extensions (e.g. "FOO") are stored with
  a trailing period (e.g. "FOO.") in the ALF header. Upon extraction,
  Atari DOSes will remove the period, so the file will be called
  "FOO" again. I'm not sure whether the ARC for the Atari shares this
  behaviour, but ARC on MS-DOS or Linux doesn't do this.

- ALF files are never embedded inside a self-extracting executable,
  so the first file's header always starts at the first byte of
  the file.

- ARC and ALF both store the compressed and uncompressed file lengths
  as 32-bit unsigned integers... but the Atari can't deal with really
  large files. From examining the disassembled code of UNALF14.COM,
  it looks like the highest byte isn't even looked at, meaning the
  maximum size for a single file is 16MB. I have actually tested the
  Atari ALF and UNALF programs with an emulator (and emulated hard
  drive) with a file of 200KB in size, and it worked fine.