
*** SDA (Self-Dissolving compressed Archive)
*** Document revision: 1.4
*** Last updated: March 11, 2004
*** Compiler/Editor: Peter Schepers
*** Contributors/sources: Chris Smeets (source code)

  The name stands for "Self-Dissolving Archive", and thats exactly what  it
does. There is a decompression engine at the beginning of the  file  called
by a BASIC SYS command. It will decompress all the files contained  in  the
archive to whatever device you specify, or disk you select.

  I have  found  two  somewhat  different  SDA  files,  one  has  a  longer
decompression header than the other. They  would  appear  to  be  different
revisions of the decompression engine,  likely  version  1  and  version  2
files, but they all seem to be self-extracting ARC files.  There  are  also
different revisions of the version 2 header, where the newer ones allow for
the decompression of more compressed ARC formats. The HEX dump below  is  a
sample of the shorter version of SDA...

      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F        ASCII
      -----------------------------------------------   ----------------
0000: 01 08 0D 08 0A 00 9E 28 32 30 36 33 29 00 00 00   ....úúž(2063)úúú

  which decodes to...

10 SYS(2063)

  The starting location of  the  first  file  in  an  SDA  archive  can  be
calculated given the BASIC header from above. Here's the steps...

  1. Get the line number of the BASIC SYS statement (here it's 10,  in  the
     longer one its 13)

  2. Subtract 6, and multiply by 254 (result 1016, or $03F8)

  3. If the first number of the SYS call is a 7 (in our  case  it's  a  2),
     then subtract 1 from the previous result. A 7 indicates  it's  a  C128
     archive, a 2 means it's a C64 archive.

  4. You now have the starting position into the SDA archive  to  find  the
     first file.

  From here on, the file has the same layout as an ARC. See the  ARC  topic
for a better description.

  There are some exceptions to the above, expecially with the C128 versions
of files. If the first numeric value of the SYS call is a 7, we have a C128
file. If this is the case, you can assume that the line number value is 15,
rather than using the line number in the BASIC header. Some files I've seen
don't have the proper value for the line number.

  The easiest way the decompress these files is to  use  64COPY.  There  is
also C code available on the High Voltage CD #2 to allow you to  decompress
these files on a PC.

  SDA files can also be decompressed by running it on either a real C64  or
an emulator window, and let the file undo itself to a disk image. ARC files
are decompressable using the C64 program called ARC 2.50.

