LHWARP 1.40 12th April, 1990 A disk tracker for the Amiga Written by Jonathan Forbes What is Lhwarp? (Pronounced L-H-WARP) Lhwarp is a program which will read tracks directly from your floppy disk, (or any other device), compress them, and output them to a file. The advantages of using Lhwarp are: o The entire disk structure, including the boot block, is preserved. o Lhwarp will always produce a smaller output file than ARC, ZOO or WARP. (note: this is true only when the default compression algorithm is used.) o Lhwarp will only archive sectors which contain data, by using the disk's bitmap (however, Lhwarp will gladly compress every single sector on the disk, if you wish.) o Using Lhwarp is much less hassle than archiving each and every file individually. o The bootblock of any disk being either read or written is displayed, so that bootblock viruses can easily be found. o Other filing system devices (such as ram disks) may be used with Lhwarp, so you are not limited to floppy drives. Lhwarp will produce files which are much smaller than those produced by Warp, since Lhwarp uses a much more efficient compression algorithm (Adaptive Huffman Encoding); the same algorithm used in LHARC. Typically, an Lhwarp file will be 80% of the size of an equivalent Warp file, resulting in quite reasonable hard drive space savings. In addition, Lhwarp will only archive sectors which contain data; deleted information is not archived (unless you explicity request this to be done.) When compressing or decompressing data, sectors which contain data are marked with a '.' character, while sectors which do not contain data are marked with a '_' character. If the -m option is specified, all sectors will be marked with '.' automatically. Algorithms For those who simply must have a faster compression rate, Lhwarp provides two additional compression algorithms; squeezing and vaporising (the latter is the 14 bit version of UNIX Compress.) Both are faster than the LHARC Adaptive Huffman Encoding algorithm (called "freezing.") However, neither of them comes close to the compression ratio of freezing. Even so, the speed increase and reasonable compression rates should appeal to those who are less concerned with compression efficiency, and more concerned with speed. It should be mentioned, however, that the freezing algorithm can hold its own in terms of speed, and is the recommended algorithm for compressing disks. Freezing remains the default compression mode. Using the -c switch will cause the disk to be vaporised (not literally), while the -s switch will cause the disk to be squeezed. The -b option will cause each individual track to be either vaporised or squeezed, depending on which produces the smallest output. The -q option will cause Lhwarp to use its fastest and most reasonable algorithm on the disk. Currently, this is vaporising. If no space is gained from vaporising a track, then the track is squeezed, and if no space is gained from squeezing a track, the track is stored (no compression.) You cannot currently combine freezing with any other algorithm; this is for your own benefit; I have yet to see freezing beaten by vaporising or squeezing for any one track, ever! However, if you find that vaporising and squeezing frequently do compress tracks more efficiently, please inform me. To compress the NewTek DYNAMIC HI-RES demo disk: * - Couldn't be bothered to time this Lhwarp | --- Version 1.40 --- | --- Version 1.31 --- Algorithm | Size Comp Decomp | Size Comp Decomp --------- | ------ ----- ------- | ------- ----- ------ Freezing | 671940 14:50 5:24 | 671630 19:00 12:40 Vaporising | 814052 5:59 1:47 | 869515 6:30 * Squeezing | * * * | 803714 7:30 * Both | 770726 9:38 5:28 | 770722 10:30 * Other programs -------------- Warp 1.11 | 796665 16:53 1:16 (Unwarp 1.0) Viewing Lhwarp also supports viewing; you may see how Lhwarp has compressed a disk (which tracks are contained in the file, which algorithm was used to compress them, the source and destination lengths of each track, the number of sectors compressed, and the sector map of each track.) The viewing option will also display any attached text. After any attached text is displayed, you must press return; this was implemented so that the displaying of the boot block wouldn't scroll the text off the screen. More Information Lhwarp output files have the suffix ".LHW". If the filename you give Lhwarp does not end in ".LHW", Lhwarp will append ".LHW" to it. Please leave the suffix alone, and don't change it to ".WRP". The Adaptive Huffman Encoding algorithm was originally coded by Haruyasu Yoshizaki, and is the same algorithm used in LHARC 1.13c. When the more efficient LHARC 2.0 arrives from Japan, that algorithm will instead be used. Parameters To view Lhwarp's parameters, type "Lhwarp"; they are included within the program. You will be presented with: LHWARP 1.40 - Amiga disk tracker - Written by Jonathan Forbes @ 1:250/642 Copyright © Xenomiga Technology, 1990. Usage: LHWARP [-options] Command Unit Filename Start End [Textfile] Command Options: -m: Ignore disk bitmap -q: Quick compression -s: Squeeze algorithm -c: Compress/14 (Vaporise) algorithm -b: Both Squeeze and Compress -v: View format of output file -n: No prompting for return -dxxx: Use device name 'xxx' Command: Read (disk->file) or Write (file->disk) Unit: Drive number (0 for internal, 1 ... 3 for external) Filename: Output or input filename StartTrack: Track number (0 ... 79) [valid only in read mode] EndTrack: Track number (0 ... 79) [valid only in read mode] TextFile: Attach text in 'TextFile' to output file Examples are: a) Lhwarp READ 0 MyDisk 0 79 This will read tracks 0 to 79 of the disk in drive 0 (i.e. the entire disk), and will output the result to "MyDisk.lhw" Only sectors which contain data will be archived. b) Lhwarp READ 0 MyDisk 0 79 MyText This will read tracks 0 to 79 of the disk in drive 0 (i.e. the entire disk), and will output the result to "MyDisk.lhw". Only sectors which contain data will be archived. The text from the file "MyText" will be imported to the output file. Any text stored in the output file will be displayed when the disk is unarchived. c) Lhwarp -m READ 0 MyDisk 0 79 This will read tracks 0 to 79 of the disk in drive 0 (i.e. the entire disk), and will output the result to "MyDisk.lhw". All sectors will be archived, regardless of whether or not they contain data; the disk's bitmap is ignored with the '-m' option. d) Lhwarp WRITE 1 MyDisk This will output all tracks stored in MyDisk.lhw to drive 1. If any text was in the output file, it will be displayed. e) Lhwarp -c READ 0 MyDisk 0 79 Same as a), except that the disk will be "vaporised." f) Lhwarp -s READ 0 MyDisk 0 79 Same as a), except that the disk will be "squeezed." g) Lhwarp -b READ 0 MyDisk 0 79 Same as a), except that tracks will be either squeezed or vaporisied, depending on which is more efficient. h) Lhwarp -m -c READ 0 MyDisk 0 79 Same as e), except that the bitmap will be ignored. i) Lhwarp -v mydisk View composition of the file "MyDisk.lhw." j) Lhwarp -dramdrive.device READ 0 MyDisk 0 79 Same as a), but read from the ramdrive.device instead of the floppy drive (trackdisk.device.) k) Lhwarp -n READ 0 MyDisk 0 79 Same as a), but don't prompt for return. Please note that you must combine options in the format of: 'Lhwarp -a -b -c ...' Not: 'Lhwarp -abc ...' The latter may have unpredictable results (most probably all options but '-a' will be ignored.) Using other devices If you decide to use the -d option of Lhwarp (i.e. use a non-floppy device such as ramdrive.device), then the device which you use must be a replica of a floppy disk in terms of data layout; it must have a lower track boundary of 0, and an upper track boundary of 79. It must also have 2 heads (surfaces) and 11 blocks per track, (512 bytes per sector are assumed); i.e. it should contain the following mountlist entry lines: Surfaces = 2 BlocksPerTrack = 11 LowCyl = 0; HighCyl = 79 It is very important that the device has exactly the same configuration as a floppy drive; you will, most likely, receive a system message (the "GURU" no longer exists in 1.4) if this is not the case. Do not assume that because you have a 120 track ramdrive.device, an 80 track disk will decompress properly into it; it won't! You cannot mix disk sizes. You CANNOT use Lhwarp to read and write tracks from/to non-80 track devices, even if you read and write from/to the same device; Lhwarp assumes many things, just one of them being that the root block of the device will be at track 40! This may be fixed in a later version, but for now, don't experiment! Obviously you will be unable to "remove and re-insert" the disk as asked after write activity, if the disk is a ram drive. The DISKCHANGE command should instead be used. Virus detection Some people have complained about Warp because it aids the spreading of boot block viruses. It is for this reason that Lhwarp will display the bootblock of any disk it reads or writes, so that one can see what is being Lhwarp'd. Any non-standard looking bootblock should be viewed with suspicion. If you see a non-standard bootblock in read mode, this means that the disk you are reading from might possibly contain a virus. If you see this in write mode, it means that the file you are writing out to your disk may contain a virus. In either case, you should load a virus checker to make sure (such as VirusX 4.0) Specifications Lhwarp uses ETD_READ and ETD_FORMAT to read/write directly from/to the trackdisk.device. The 16 bytes of label information for each sector are preserved in the output file. A 32-bit CRC protects data integrity. Acknowledgements Huffman routines - Haruyasu Yoshizaki (lzhuf.c, v1.13c) Compress - S.Thomas, J.McKie, S.Davies, K.Turkowski, J.Woods, and J.Orost (compress.c) Squeezing - William Swan (sq.c/usq.c) Bitmap information - Leo Schwab (diskmap2.c) This Program Lhwarp is a freely distributable, copyrighted piece of software. You do not have to pay money to use it, and may upload it wherever you choose, but you are not allowed to sell Lhwarp for profit, or include Lhwarp on a disk which is sold for profit, without the author's (Jonathan Forbes) permission. I can be contacted on Canada Remote Systems as "Jonathan Forbes" (isn't that better than some 20 digit ID code?) My BBS (416-921-6638) is currently down, pending completion of Xenolink, a full featured FidoNet-compatible BBS program for the Amiga, which I have almost finished. Disclaimer I am in no way responsible for anything this program does; you are using it entirely at your own risk, so if all of the cats in your neighbourhood cause a nuclear feline revolution, wiping out most of the human population in your part of the world, don't blame me! Stack Size Lhwarp appears to function correctly with a stack size of 10,000 bytes (and maybe even less), but if you have any problems, you should increase it. Release History: 20-Dec-89 V1.00: Initial release (small extended data bug.) 20-Dec-89 V1.01: Fixed extended data bug. 22-Dec-89 V1.02: 32-bit checksum implemented. 28-Dec-89 V1.03: More CHIP memory efficient, and stack size 50k -> 3k. 01-Jan-90 V1.10: 32-bit CRC, compression routines now in assembly language. 16k file i/o buffer, stack size 3k -> 10k. Bitmap used for skipping unused sectors. 02-Jan-90 V1.11: Another speed increase. Sectors are displayed as they are archived. 06-Jan-90 V1.20: Squeezing and Vaporising implemented. Viewing implemented. 08-Jan-90 V1.21: Corrected text file bug in version 1.20. 19-Feb-90 V1.30: Removed track corrupting bug. Other devices supported. Output file length included within output file. 27-Feb-90 V1.31: Removed bug which prevented Lhwarp from uncompressing files produced by earlier versions. Memory leak corrected. Removed bug involving output track data being longer than input track data. 12-Apr-90 V1.40: Incredible speed increases all around. Compression 25% faster, decompression 60% faster (freezing.) Asynchrous disk i/o. Tracks now stored if they cannot be compressed. Corrected bug causing viewing to crash. Added "no prompts" option. Version 1.40 - 12th April, 1990 I moved the assembly language routines from Lhunarc 0.96 (written by me) into Lhwarp, which resulted in some incredible speed increases! Lhwarp also uses asynchrous disk i/o; what this means, is that Lhwarp continues to compress/decompress while the disk is being accessed; thus, Lhwarp no longer has to wait for tracks to be read or written. Nobody ever accused Lhwarp of being fast, but it can certainly no longer be called slow, especially when compared to the other disk compressors available. NewTek DYNAMIC HI-RES Demo Disk: Compress Decompress --------- ---------- Version 1.31 | 19:00 min | 12:40 min Version 1.40 | 14:50 min | 5:24 min Warp 1.1z | 16:53 min | 1:16 min (Unwarp 1.00) If no space is gained by compressing a track, that track is now stored (no compression) instead. Vaporising and Squeezing will now produce smaller files. In addition, the -q (quick intelligent compression) option has now been revised, and no longer functions in the same way as before. Please refer to the updated documentation for more details. The -n option has been added, signifying "no prompts"; Lhwarp won't ask you to hit return if this option is specified. A small bug causing the -v option to crash upon abort has now been fixed. Because of the way in which Lhwarp handles version updates, any files Lhwarp'd with version 1.40 will appear to have been Lhwarp'd with version 1.39 (which doesn't exist.) This is because Lhwarp assumes that a change in the 10^-1 digit of the version number constitutes a change in the output file format, which has been true up to now, but not for this version. I suppose I could have called this version 1.32, but 1.32 gives the impression of a minor update; 1.40 is more ostentatious. In any case, this small workaround will not affect you in any way.