
*** SFX (SelF-eXtracting LHA/LZH compressed files)
*** Document revision 1.1

  These  files  are  actually  LHA  archives,  except  there  they  have  a
decompressor program prepended to the file,  capable  of  decompressing  on
either a C64 or a C128, independant of the load address. The  beginning  of
the file is a BASIC program (with an unusual load address):

       00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
       -----------------------------------------------
00000: 01 1C 28 1C C6 07 97 32 30 2C 30 3A 8B C2 28 32 <-Note load address
00010: 30 29 B2 30 A7 FE 02 30 3A 9E C2 28 34 36 29 AC
00020: 32 35 36 AA 36 36 3A 80 00 3C 1C D0 07 9E C2 28
00030: 34 34 29 AC 32 35 36 AA 36 36 3A 80 00 00 00 ..

which when decoded looks like this:

1990 POKE20,0:IFPEEK(20)=0THEN<254><2>0:SYSPEEK(46)*256+66:END
2000 SYSPEEK(44)*256+66:END

  This was decoded on a C64... the two codes in line 1990,  the  <254>  and
<2>0 are not decodable on the C64, but are on  the  C128.  The  first  line
checks for whether it is running on a C64 or a 128. If it is a C64, it will
execute the SYS call line 2000, otherwise it executes the SYS on line 1990.

  Later on in the header, we have the copyright  message.  Any  SFX  should
have this message.

       00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F        ASCII
       -----------------------------------------------   ----------------
00D20: .. .. .. .. .. .. .. .. .. .. .. 43 36 34 2F 43   ...........C64/C
00D30: 31 32 38 20 53 45 4C 46 20 45 58 54 52 41 43 54   128 SELF EXTRACT
00D40: 49 4E 47 20 4C 48 41 52 43 48 49 56 45 0D 43 4F   ING LHARCHIVE.CO
00D50: 50 59 52 49 47 48 54 20 31 39 39 30 20 2D 20 43   PYRIGHT 1990 - C
00D60: 2E 53 4D 45 45 54 53 0D 54 4F 52 4F 4E 54 4F 2C   .SMEETS.TORONTO,
00D70: 43 41 4E 41 44 41 .. .. .. .. .. .. .. .. .. ..   CANADA..

  At address $0E89 (3721 bytes into the file) you will find  the  beginning
of the LHA archive, denoted by two bytes and the signature '-LH1-'.

00E80: .. .. .. .. .. .. .. .. .. 1E B6 2D 6C 68 31 2D   ...........-LH1-

  *ALL* LHA/LZH archives  have  this  type  of  signature  string  in  them
('-lhx-', where x is the type of compression used, with C64 archives  being
1, and most PC archives being 5). The actual archive starts 2 bytes  before
this string is found, and goes to the end of  the  file.  If  you  want  to
convert them to LHA, you can chop the front end off the  file  (up  to  two
bytes before the -lhx- string), and rename it to an LHA. It will then be  a
normal LHA file.

  Another way to handle SFX's is  to  extract  them  with  Star  LHA.  This
program handles both LHA and SFX formats, as they are basically  the  same.
Extract them as you would an LHA file (StarLHA -x xxxxxxxx.SFX).  For  more
information on the LHA/LZH layout, refer to the LHA topic.

