*** DISCLAIMER: The information on these pages is not an official instruction or documentation. No responsibility will be taken. Use at your own risk. ***

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

4 comments:

  1. too bad that many of the most valuable 'modern' lha files are large, over 880K, and there's no good way to get them onto .adf to use in a gotek drive. catch-22 for those of us who don't have large storage external devices on Amigas....

    ReplyDelete
  2. not very helpful considering this doesn't cover how to get the LHA archive into the emulator in the first place since the emulator mounts ADF and other disk image formats (not LHA files), maybe your particular emulator lets you directly mount LHA files? is fo what emulator did you use? I was trying WinUAE

    ReplyDelete
    Replies
    1. indeed, moving files from/to Amiga(Emu) is not the subject of this article. there are lots of options. if you're using WinUAE, the easiest probably is to create a directory on the host OS, then create a harddisc in WinUAE pointing to that directory, then move your .lha file to that directory on the host OS, then access it from within WinUAE.

      Delete
    2. P.S.: "create a harddisc in WinUAE pointing to that directory" meaning: create one in WinUAE preferences by selecting that directory

      Delete

Your comment will published after it has been reviewed.