- Notifications
You must be signed in to change notification settings - Fork5
agn453/UNZIP-CPM-Z80
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository contains versions of UNZIP and ZIP for various flavoursof CP/M written in Zilog Z80 assembler.
Support has been added for the Deflate compression algorithm so thatdecompression of ZIP archive files created with MS-DOS PKzip 2.04gand Info-ZIP (the open-source version of ZIP that's used byUnix/Linux and included with Microsoft Windows and macOS)can now be extracted.
(Older versions of the CP/M UNZIP program from various CP/M archivesites canonly be used to unpack .ZIP files whose contents wereadded using the Compressed or Stored methods as used byPKZip for MS-DOS Version 1.x.)
The latest UNZIP release is V1.5-7 (for CP/M) or V1.8-7 (with Z-systemenhancements) and may be downloaded in CP/M library file format from -
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip157.lbr
or
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip187.lbr
Simeon Cran's version (UNZIPZ) for Z-system has also been updated as V0.4-1and is available from -
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzipz04.lbr
A utility to create ZIP files natively under CP/M (using the Stored methodand no file compression) was recently added to this repository by JonathonHarston. You can get it from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zip101.lbr
Transfer these .LBR files to your CP/M system, then use a program like NULU1to extract their contents. Some of the extracted files may be compressedas indicated when the second file type character is aQ
(squeezed),Y
(Limpel-Ziv-Welch or LZH compressed) orZ
(crunched).You'll need to use the appropriate decompression tool2 to decompress them.
In reverse chronological order.
Lars Nelson has provided the following updates to Jonathon Harston'sCP/M ZIP file creation utility -
Fixed a problem where the computed CRC for some but not all files wasnot being written into the Local File Header especially on CP/M 2.2 andcompatible systems. This caused a problem for CP/M unzip programs sincethey use the information in the Local File Header to extract files.Lack of a valid CRC causes the unzip programs to skip the file. Note,the central directory was correct so on PCs or Macs all files could beextracted.
Added the ability to get file modification date from CP/M Plus andCP/M 2.2 using routines from the Z-system libraries DSLIB and ZSLIB.This necessitated making the code relocatable.
The updated version is ZIP101. You can download the full distributionfrom the CP/M library file from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zip101.lbr
Or just the binary fromZIP101.COMand the updated source file fromZIP101.Z80.
To rebuild from source you can use Alex Hawley's ZMAC & ZML3 (as opposed tosome other assembler named ZMAC) or Hector Peraza's ZSM44 and standardDigital Research CP/M 3 linker LINK. The libraries DSLIB.REL, ZSLIB.REL andSYSLIB.REL are required to be in the default directory (or modify thesourcecode to explicitly specify their location).
zmac zip101zml zip101
or
zsm4 =zip101.z80link zip101
Stefano has contributed some code optimisations to the CP/M UNZIP program.I've bumped the version number to v1.5-7. If you notice any issues withthis version, please report them.
Minor updates to Jonathon Harston's UNZIP V1.5-6 and the CP/M ZIPv1.00 program to include the date in the usage output (when you runthe programs with no parameters). I've also modified the sourcesso that they can be built using the Microsoft Macro-80 and HectorPeraza's ZSM4 Macro Assemblers.
The CP/M version V1.5-6 has been modified by Jonathon Harston to -
Junk (ignore) file paths (if present in the ZIP file),
Return to the command processor instead of warm-booting on exit,
Added [Q]uiet and [O]verwite options to extract files silently andto overwrite existing files of the same name, and
The sign-on message is now only output when run withoutcommand-line parameters.
In addition, the ZIPDIR utility has been updated to display a 4-digityear for file datestamps, and the CRC as a 32-bit number. This newversion 1.5 is available from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zipdir15.lbr
Jonathon Harston's sourcecode for a CP/M ZIP utility has also beenadded as ZIP100.Z80.
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zip100.lbr
The CP/M version was not checking output filenames to ensure they werein uppercase. This has been fixed, and the version bumped to V1.5-5.
Issue #1 fixes to the Z-System UNZIP by both Lars Nelson and myselfhave resulted in a new V1.8-7 version. The UNZIP187.* files (and thelibrary containing them) have been added.
Some testing has revealed a problem UnDeflating small text files with theZ-System version V1.8-6. Lars has debugged and corrected this issue.The V1.8-6 version files (and the library containing them) have been updated.UNZIPZ V0.4-1 and the V1.5-4 version are not affected.
Lars Nelson has been busy! He's updated Simeon Cran's UNZIPZ to includethe optimised bit manipulation and the table-based CRC routines by RussellMarks to give a significant speed improvement (estimated 45% faster thanthe UNZIPZ V0.3-4 version). This latest version is designated V0.4-1and can be downloaded from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzipz04.lbr
Also, Lars has updated the Z-system version to produce a .ZIP filecontents listing in a format that includes compressed/uncompressedfile size, compression method, modification time-stamp and the 32-bit CRC.
This version V1.8-6 can be downloaded from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip186.lbr
Lars Nelson has migrated the updates into Simeon Cran's UNZIPZ versionso that it also now supports the UnDeflate algorithm. The source filesand a prebuilt CP/M .COM file have been included in the unzip folder.This new version has been designated at V0.3-2. As usual you can grabthese files in the CP/M library file from -
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzipz03.lbr
Lars Nelson has incorporated file datestamping to set each extractedfile's date on CP/M formatted disks with Time-Stamps enabled. This should workwith DateStamper, ZSDOS, CP/M Plus (and ZPM3) and MP/M.
The Z-System aware version number has been bumped to V1.8-5.
There's one remaining issue involving the calculation of a cyclic redundancycheck (CRC) value for files that are not being extracted (i.e. listing contentsof a .ZIP file). In the older V1.5-2 (and later revisions) Martin removedthe CRC calculation when listing a .ZIP file's contents.Lars has tried to restore this code in V1.8-5 but it is calculating thewrong value for files not being extracted. As a work-around, these skippedfiles are now being treated as "Stored" files for now.
You can grab this latest version in a CP/M format library file from -
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip185.lbr
Lars Nelson has fixed an UnDeflate issue as well as added code to strippathnames from filenames and clear bit 7 of filename characters.This version builds with the supplied UNZIP184.SUB (for ZSM4 and DR LINK)or SLR184.SUB (using SLR Z80ASM and SLRNK).
Once again, I've updated the source and library file (still at v1.8-4)so fetch a new copy if you've an older version.
Also a later Z-System version of ZIPDIR has been added. Download fromZIPDIR14.LBR
Lars has fixed the "zero-length file CRC error" for the Z-system v1.8-4version. Updated UNZIP184.Z80, the binary and library for this version only.Also included an updated version ofZIPDIR.LBRto correctly report .ZIP file entries compressed with the Deflate method.
Lars Nelson has ported the v1.5-4 updates to the Z-system version (withthe exception of the >255 character filename check). As usual, theindividual files are in the unzip folder or grab the v1.8-4 versionin a CP/M .LBR file from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip184.lbr
I've also included the Z-system libraries in their original binary distributionformat .LBR files (should you wish to rebuild from source code). They are
LIBS45A.LBR - thelibrary containing .REL versions of SYSLIB, Z3LIB and DSLIB in bothMicrosoft M80/DR LINK and SLRNK file formats.
LBRHL45A.LBR - thehelp files for LIBS45A.LBR
ZSLIB36.LBR - thesupplemental routines for programmers.
For testing, I re-linked UNZIP184.COM natively under Z3PLUS Vers. 1.02(the Z-system variant for CP/M-Plus) using the ZSM4 assembler and DigitalResearch's LINK using the submit file UNZIP184.SUB.
Lars Nelson has ported the v1.5-2 bug fixes and UnDeflate enhancementsto the Z-system (ZCPR 3.x) branch, resulting in v1.8-2.
Based on initial testing, this version (using a 2K buffer and Z-systemlibraries) has better performance than v1.5-2 (and later).
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip182.lbr
Some further speed optimisations by Russell Marks.
Further slight optimisations to bit-readers,
Backport some unzip 1.8 changes (buffer-overrun fixes, bit 7 strip onoutput filenames, less frequent ^C checking, and low-memory message),and add various comments.
Use self-modifying code with an unrolled end loop in rdbybits,and add a "rd1bit" macro, for about a 12% speed improvementon overall extraction time compared to version 1.5-3.
Fix long-filename buffer overrun, for filenames longer than255 characters.
Backport Howard Goldstein's buffer-overrun fixes fromunzip 1.8 - previously, a 255-byte buffer was repeatedly usedto read up-to-65535-byte inputs.
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip154.lbr
Russell Marks has contributed speed optimisations to the UnDeflatealgorithm to significantly boost performance (by more than 30%).
A new routine rdbybits now processes eight or fewer bits.
Checks whether the TPA size is large enough for UNZIP's tables
Use a table-based CRC algorithm. This increases the CP/Mbinary size by about 1Kbyte.
I've bumped the version number to 1.5-3 and the latestupdated sourcefile asUNZIP153.Z80. The source and CP/M binaryare also available in a CP/M format library file from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip153.lbr
Martin has posted some more updates and added support to decompressZIP file entries compressed with the Deflate algorithm.
The changelog is -
Fix extraction of zero-length files.
Skip to the next file header if the compression method is unknown
Fix readbits when a full word (16 bits) is read - in preparationfor implementing the unDeflate algorithm.
Fix mis-ordering of variables. Code makes the assumptionthat "bitbuf" is the byte before "bleft".
Allow the relocation of the input buffer.
Make the output buffer size dynamic.
Implement the UnDeflate algorithm - based on the work byKeir Fraser's HiTech-C code athttps://github.com/keirf/Amiga-Stuff/blob/master/inflate/degzip_portable.c
You'll find the updated sourcefile asUNZIP152.Z80 which youcan also get in a CP/M format library file from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip152.lbr
Recently Martin posted two bug fixes to the unshrink and unimploderoutines in the comp.os.cpm USENET group that fix two long outstandingbugs (1-Jun-2020 and 15-Jun-2020).
I've incorporated Martin's fixes into a new sourcefileUNZIP151.Z80and also updated the original sourcecode for Version 1.2 into a renamedfileUNZIP121.Z80
I've also updated the Z-system Version 1.8 into a renamed source fileUNZIP181.Z80 and rebuilt the corresponding .COM file using theZ-system libraries extracted from LIBS45A.LBR and ZSLIB36.LBR
For a discussion of the fixes - please refer to the followingpostings at the Google Groups archive of the comp.os.cpm newsgroup -
Un-shrink fixhttps://groups.google.com/forum/#!topic/comp.os.cpm/B0A4x59SX44
Un-implode fixhttps://groups.google.com/forum/#!topic/comp.os.cpm/rpjA1Q6RtDc
The new Z80 CP/M executable has been built using Hector Peraza's ZSM4assembler4 and Digital Research's LINK asUNZIP151.COM using thefollowing commands -
zsm4 =unzip151.z80link unzip151
A new library file (without compressed entries) containing the fixesisunzip151.lbr and can be downloaded from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip151.lbr
Also, the new Z-system (ZCPR 3.x) UNZIP Version 1.8-1 is in thelibraryunzip181.lbr and can be downloaded from
https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip181.lbr
The Z-system version has been built using the submit file (also includedasUNZIP181.SUB) -
; Build new version of UNZIP181 using SLR Z80ASM and SLRNK; using Z-System libraries from LIBS45A.LBR and ZSLIB36.LBR;z80asm unzip181/6; Load ASEG after CSEG - verify CSEG size is 0d7b; and use ASEG at 0d7b + 0100 +1 to be sureslrnk /a:0e7c,/p:100,unzip181,unzip181/n/e
Files have been extracted from the following distribution archives -
- UNZIP15.LBR from the Public Domain software library originallydistributed on 1-Jun-1991 as Version 1.5. I obtained this fromthe Walnut Creek CP/M Software CD-ROM at
http://www.classiccmp.org/cpmarchives/cpm/Software/WalnutCD/cpm/utils/arc-lbr/unzip15.lbr
Version 1.5 incorporates modifications by Howard Goldstein on 1-Jun-1991plus those by Bruce Morgan on 16-May-1991 (Version 1.4) and GenePizzetta on 12-May-1991 (version 1.3); and includes the originalVersion 1.2 source-code by David Goodenough dated 3-Jul-1990.
- UNZIP18.LBR has further modifications by Howard Goldstein forZ-system (ZCPR 3.x) with improved file I/O performance and buffering. Itwas obtained from
http://www.classiccmp.org/cpmarchives/cpm/Software/WalnutCD/jsage/znode3/uploads/unzip18.lbr
Other Zilog Z80 assemblers/linkers can also be used (e.g. SLR Z80ASM/SLRNKor even Microsoft M80/L80) - however, they may createa .COM file with data segment storage included.
Also, there are other UNZIP programs for CP/M that use the sameunpacking code derived from the Version 1.2 source-code. Theyarenot fixed.
--
Footnotes
A copy of the CP/M library file extraction tool NULU.COM may be downloadedhereor the full NULU distribution can be downloded from the cpmarchives site asNULU152A.LBR↩
CP/M native tools for decompressing are LT31.COM (which will extract anduncrunch/unsqueeze/unLZH directly from .LBR file members) available inLT31.LBRor UCRLZH20.COM available inCRLZH20.LBR.↩
Alex Hawley's ZMAC & ZML are the traditional mainstay Z80 Assembler and Linker for Z-system program development. You can download a ZIP file distribution of it fromhttp://www.cpm.z80.de/develop/zmac.zip↩
The source-code, documentation and executable for the ZSM4 Z80/Z180/Z280 Macro Assembler may be obtained fromhttps://github.com/hperaza/ZSM4↩↩2
About
UNZIP and ZIP for CP/M Z80