*** DISCLAIMER: The information on these pages is not an official instruction or documentation. No responsibility will be taken. Use at your own risk. ***
Showing posts with label lha. Show all posts
Showing posts with label lha. Show all posts

Sunday, March 8, 2020

How do you convert lha to ADF?

The contents of the files are completely different:

  • lha file is a compressed image of one or more files (files, folders)
  • ADF is a raw, fixed size (DD floppy = 880KB) track-by-track image of an AmigaDOS formatted floppy disk (that might, or might not be bootable)

To use the contents of an lha file from an ADF ("convert to ADF"), you have to extract the lha file, and write its contents to an ADF.  
(This implies that the contents of the lha file must fit onto a floppy disk - if they don't, extra work is required, which is beyond the scope of this article.)

You can do so for example by inserting some ADF (preferably a copy, or an empty one!) to your Amiga emulator. Make sure your emulator settings allow for writing to ADF files. Format the disk (ADF) if required, then extract lha to that disk. Example:

> format drive df0: name my_floppy_disk
> lha x myarchive.lha df0:

Note that every good archive - if it contains more than one file - should contain a root folder. Let's assume your archive is a good one, and let's assume the name of the root folder inside the archive is "rootfolder". For your disk (ADF), you probably want the disk itself to be the root folder. So instead of the above steps, directly extracting your lha file to disk, you might want to extract, then copy folder contents. Example:

> format drive df0: name my_floppy_disk
> makedir RAM:adfdir
> lha x myarchive.lha RAM:adfdir
> copy RAM:adfdir/rootfolder/#? df0: all clone


If you're using an emulator, you're done. The contents of your lha archive are now stored in an ADF file. Quit emulator, use ADF as desired.

Using a hardware Amiga with a physical or emulated floppy drive, the procedure is the same, but you'll obviously end up with a floppy disk, not an ADF. You can then use transadf from AmiNet, or any other ADF-reading tool, to create your ADF. Example:

> transadf df0: my_adf.adf

(Here's a floppy emulator that runs on all AmigaOS versions: http://aminet.net/package/disk/misc/fms_20)



To make the disk (ADF) bootable:

Run "install" from a shell. Example:

> install df0:

Then create a text file "s/startup-sequence" that contains the commands to be run on boot - you can use AmigaOS's ed, or any other text editor. Example:

> ed df0:s/startup-sequence

Example: If you want to run "mygame" from folder "myfolder", put this line into the "startup-sequence" file:

myfolder/mygame

Thursday, February 27, 2020

How do I create Amiga-compatible lha archives on other platforms (Linux)?

Problem

You've created an lha archive, e.g. on Linux, and your Amiga's lha is unable to decompress it.

Error message: "ERROR on file '...' : Unknown compression"

Possible reason

The lha version used to create the archive is newer than your Amiga's lha version, and/or uses a different default compression method.

You might have obtained your Amiga lha binaries from AmiNet, by downloading the self-extracting lha archive which contains them, and have used these to extract other lha archives from AmiNet.
http://aminet.net/search?query=lha.run
Depending on when you did so, these binaries might be quite old, and have different options than the lha version you're using e.g. on your Linux machine, including compression method settings.

Solution

Manually set compression method when creating archive - V2 lh5 will probably the best supported. Here's a quick overview of some lha versions, and the most commonly available compression methods:

Linux "LHa for UNIX version 1.14i-ac20081023"
(This version does not support lh4 compression.)

 lha a -o5 filename.lha myfile
      use lh5 compression (default)

lha a -o6 filename.lha myfile
      use lh6 compression

Amiga "LhA Evaluation V1.38 - Copyright (c) 1991,92 Stefan Boberg"
Amiga "LhA Evaluation V1.54 - Copyright (c) 1993 by Stefan Boberg"
(These versions do not support lh6 compression.)

lha a -1 filename.lha myfile
      use lh4 compression

lha a -2 filename.lha myfile
      use lh5 compression

Amiga "LhA Freeware Version 2.12"
Amiga "LhA Freeware Version 2.15"
(These versions do not support lh4 compression.)

lha a -2 filename.lha myfile
      use lh5 compression (default)

lha a -3 filename.lha myfile
      use lh6 compression


To check an archive's compression method, use "vv":

lha vv filename.lha

See lha's man page / info / help / version texts for detailed info about more compression options (lh1, lh7, ...).