├── .gitattributes ├── LICENSE ├── README.md └── unzip ├── CPMZIP.TXT ├── DATESTR.LIB ├── LBRHL45A.LBR ├── LIBS45A.LBR ├── SLR184.SUB ├── SLR185.SUB ├── SLR186.SUB ├── SLR187.SUB ├── UDATZI.Z80 ├── UNZIP12.DOC ├── UNZIP12.Z80 ├── UNZIP121.Z80 ├── UNZIP15.DOC ├── UNZIP15.Z80 ├── UNZIP151.COM ├── UNZIP151.Z80 ├── UNZIP152.COM ├── UNZIP152.Z80 ├── UNZIP153.COM ├── UNZIP153.Z80 ├── UNZIP154.COM ├── UNZIP154.Z80 ├── UNZIP155.COM ├── UNZIP155.Z80 ├── UNZIP156.COM ├── UNZIP156.Z80 ├── UNZIP157.COM ├── UNZIP157.Z80 ├── UNZIP18.DOC ├── UNZIP18.FOR ├── UNZIP18.Z80 ├── UNZIP181.COM ├── UNZIP181.SUB ├── UNZIP181.Z80 ├── UNZIP182.COM ├── UNZIP182.DOC ├── UNZIP182.FOR ├── UNZIP182.SUB ├── UNZIP182.Z80 ├── UNZIP184.COM ├── UNZIP184.DOC ├── UNZIP184.FOR ├── UNZIP184.SLR ├── UNZIP184.SUB ├── UNZIP184.Z80 ├── UNZIP185.COM ├── UNZIP185.DOC ├── UNZIP185.FOR ├── UNZIP185.SUB ├── UNZIP185.Z80 ├── UNZIP186.COM ├── UNZIP186.DOC ├── UNZIP186.FOR ├── UNZIP186.SUB ├── UNZIP186.Z80 ├── UNZIP187.COM ├── UNZIP187.DOC ├── UNZIP187.FOR ├── UNZIP187.SUB ├── UNZIP187.Z80 ├── UNZIPEQU.LIB ├── UNZIPZ.COM ├── UNZIPZ.DOC ├── UNZIPZ.Z80 ├── UNZIPZ4.COM ├── UNZIPZ4.DOC ├── UNZIPZ4.Z80 ├── ZIP100.COM ├── ZIP100.Z80 ├── ZIP101.COM ├── ZIP101.Z80 ├── ZIPDIR.COM ├── ZIPDIR.Z80 ├── ZIPDIR14.COM ├── ZIPDIR14.FOR ├── ZIPDIR14.Z80 ├── ZIPDIR15.COM ├── ZIPDIR15.Z80 ├── ZSLIB36.LBR ├── unzip15.for ├── unzip15.lbr ├── unzip15.toc ├── unzip151.lbr ├── unzip152.lbr ├── unzip153.lbr ├── unzip154.lbr ├── unzip155.lbr ├── unzip156.lbr ├── unzip157.lbr ├── unzip18.lbr ├── unzip18.toc ├── unzip181.lbr ├── unzip182.lbr ├── unzip184.lbr ├── unzip185.lbr ├── unzip186.lbr ├── unzip187.lbr ├── unzipz03.lbr ├── unzipz04.lbr ├── zip100.lbr ├── zip101.lbr ├── zipdir.lbr ├── zipdir14.lbr └── zipdir15.lbr /.gitattributes: -------------------------------------------------------------------------------- 1 | # Default is to keep crlf line endings 2 | text=auto 3 | 4 | README.md text eol=crlf 5 | *.DOC text eof=crlf 6 | *.Z80 text eol=crlf linguist-language=Assembly 7 | *.COM binary 8 | *.SUB text eol=crlf 9 | *.lbr binary 10 | *.LBR binary 11 | *.for text eof=crlf linguist-language=Assembly 12 | *.FOR text eof=crlf linguist-language=Assembly 13 | *.prn text eof=crlf 14 | *.toc text eof=crlf 15 | *.TXT text eof=crlf 16 | *.SLR text eof=crlf 17 | *.LIB text eof=crlf 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UNZIP and ZIP for CP/M Z80 2 | 3 | This repository contains versions of UNZIP and ZIP for various flavours 4 | of CP/M written in Zilog Z80 assembler. 5 | 6 | Support has been added for the Deflate compression algorithm so that 7 | decompression of ZIP archive files created with MS-DOS PKzip 2.04g 8 | and Info-ZIP (the open-source version of ZIP that's used by 9 | Unix/Linux and included with Microsoft Windows and macOS) 10 | can now be extracted. 11 | 12 | (Older versions of the CP/M UNZIP program from various CP/M archive 13 | sites can _only_ be used to unpack .ZIP files whose contents were 14 | added using the Compressed or Stored methods as used by 15 | PKZip for MS-DOS Version 1.x.) 16 | 17 | The latest UNZIP release is V1.5-7 (for CP/M) or V1.8-7 (with Z-system 18 | enhancements) and may be downloaded in CP/M library file format from - 19 | 20 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip157.lbr 21 | 22 | or 23 | 24 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip187.lbr 25 | 26 | Simeon Cran's version (UNZIPZ) for Z-system has also been updated as V0.4-1 27 | and is available from - 28 | 29 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzipz04.lbr 30 | 31 | A utility to create ZIP files natively under CP/M (using the Stored method 32 | and no file compression) was recently added to this repository by Jonathon 33 | Harston. You can get it from 34 | 35 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zip101.lbr 36 | 37 | Transfer these .LBR files to your CP/M system, then use a program like NULU[^3] 38 | to extract their contents. Some of the extracted files may be compressed 39 | as indicated when the second file type character is a ```Q``` (squeezed), 40 | ```Y``` (Limpel-Ziv-Welch or LZH compressed) or ```Z``` (crunched). 41 | You'll need to use the appropriate decompression tool[^4] to decompress them. 42 | 43 | 44 | ## Bug Fixes and Enhancements 45 | 46 | In reverse chronological order. 47 | 48 | ### December 28, 2023 49 | 50 | Lars Nelson has provided the following updates to Jonathon Harston's 51 | CP/M ZIP file creation utility - 52 | 53 | * Fixed a problem where the computed CRC for some but not all files was 54 | not being written into the Local File Header especially on CP/M 2.2 and 55 | compatible systems. This caused a problem for CP/M unzip programs since 56 | they use the information in the Local File Header to extract files. 57 | Lack of a valid CRC causes the unzip programs to skip the file. Note, 58 | the central directory was correct so on PCs or Macs all files could be 59 | extracted. 60 | 61 | * Added the ability to get file modification date from CP/M Plus and 62 | CP/M 2.2 using routines from the Z-system libraries DSLIB and ZSLIB. 63 | This necessitated making the code relocatable. 64 | 65 | The updated version is ZIP101. You can download the full distribution 66 | from the CP/M library file from 67 | 68 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zip101.lbr 69 | 70 | Or just the binary from 71 | [ZIP101.COM](https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/ZIP101.COM) 72 | and the updated source file from 73 | [ZIP101.Z80](https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/ZIP101.Z80). 74 | 75 | To rebuild from source you can use Alex Hawley's ZMAC & ZML[^2] (as opposed to 76 | some other assembler named ZMAC) or Hector Peraza's ZSM4[^1] and standard 77 | Digital Research CP/M 3 linker LINK. The libraries DSLIB.REL, ZSLIB.REL and 78 | SYSLIB.REL are required to be in the default directory (or modify the 79 | sourcecode to explicitly specify their location). 80 | 81 | ``` 82 | zmac zip101 83 | zml zip101 84 | ``` 85 | 86 | or 87 | 88 | ``` 89 | zsm4 =zip101.z80 90 | link zip101 91 | ``` 92 | 93 | 94 | ### October 22, 2023 95 | 96 | Stefano has contributed some code optimisations to the CP/M UNZIP program. 97 | I've bumped the version number to v1.5-7. If you notice any issues with 98 | this version, please report them. 99 | 100 | 101 | ### October 13, 2023 102 | 103 | Minor updates to Jonathon Harston's UNZIP V1.5-6 and the CP/M ZIP 104 | v1.00 program to include the date in the usage output (when you run 105 | the programs with no parameters). I've also modified the sources 106 | so that they can be built using the Microsoft Macro-80 and Hector 107 | Peraza's ZSM4 Macro Assemblers. 108 | 109 | 110 | ### August 31. 2023 111 | 112 | The CP/M version V1.5-6 has been modified by Jonathon Harston to - 113 | 114 | * Junk (ignore) file paths (if present in the ZIP file), 115 | 116 | * Return to the command processor instead of warm-booting on exit, 117 | 118 | * Added [Q]uiet and [O]verwite options to extract files silently and 119 | to overwrite existing files of the same name, and 120 | 121 | * The sign-on message is now only output when run without 122 | command-line parameters. 123 | 124 | In addition, the ZIPDIR utility has been updated to display a 4-digit 125 | year for file datestamps, and the CRC as a 32-bit number. This new 126 | version 1.5 is available from 127 | 128 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zipdir15.lbr 129 | 130 | Jonathon Harston's sourcecode for a CP/M ZIP utility has also been 131 | added as ZIP100.Z80. 132 | 133 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zip100.lbr 134 | 135 | 136 | ### September 19, 2021 137 | 138 | The CP/M version was not checking output filenames to ensure they were 139 | in uppercase. This has been fixed, and the version bumped to V1.5-5. 140 | 141 | 142 | ### June 14, 2021 143 | 144 | Issue #1 fixes to the Z-System UNZIP by both Lars Nelson and myself 145 | have resulted in a new V1.8-7 version. The UNZIP187.* files (and the 146 | library containing them) have been added. 147 | 148 | 149 | ### December 23, 2020 150 | 151 | Some testing has revealed a problem UnDeflating small text files with the 152 | Z-System version V1.8-6. Lars has debugged and corrected this issue. 153 | The V1.8-6 version files (and the library containing them) have been updated. 154 | UNZIPZ V0.4-1 and the V1.5-4 version are not affected. 155 | 156 | 157 | ### December 9, 2020 158 | 159 | Lars Nelson has been busy! He's updated Simeon Cran's UNZIPZ to include 160 | the optimised bit manipulation and the table-based CRC routines by Russell 161 | Marks to give a significant speed improvement (estimated 45% faster than 162 | the UNZIPZ V0.3-4 version). This latest version is designated V0.4-1 163 | and can be downloaded from 164 | 165 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzipz04.lbr 166 | 167 | Also, Lars has updated the Z-system version to produce a .ZIP file 168 | contents listing in a format that includes compressed/uncompressed 169 | file size, compression method, modification time-stamp and the 32-bit CRC. 170 | 171 | This version V1.8-6 can be downloaded from 172 | 173 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip186.lbr 174 | 175 | 176 | ### November 30, 2020 177 | 178 | Lars Nelson has migrated the updates into Simeon Cran's UNZIPZ version 179 | so that it also now supports the UnDeflate algorithm. The source files 180 | and a prebuilt CP/M .COM file have been included in the unzip folder. 181 | This new version has been designated at V0.3-2. As usual you can grab 182 | these files in the CP/M library file from - 183 | 184 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzipz03.lbr 185 | 186 | 187 | ### November 18, 2020 188 | 189 | Lars Nelson has incorporated file datestamping to set each extracted 190 | file's date on CP/M formatted disks with Time-Stamps enabled. This should work 191 | with DateStamper, ZSDOS, CP/M Plus (and ZPM3) and MP/M. 192 | 193 | The Z-System aware version number has been bumped to V1.8-5. 194 | 195 | There's one remaining issue involving the calculation of a cyclic redundancy 196 | check (CRC) value for files that are not being extracted (i.e. listing contents 197 | of a .ZIP file). In the older V1.5-2 (and later revisions) Martin removed 198 | the CRC calculation when listing a .ZIP file's contents. 199 | Lars has tried to restore this code in V1.8-5 but it is calculating the 200 | wrong value for files not being extracted. As a work-around, these skipped 201 | files are now being treated as "Stored" files for now. 202 | 203 | You can grab this latest version in a CP/M format library file from - 204 | 205 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip185.lbr 206 | 207 | 208 | ### November 11, 2020 209 | 210 | Lars Nelson has fixed an UnDeflate issue as well as added code to strip 211 | pathnames from filenames and clear bit 7 of filename characters. 212 | This version builds with the supplied UNZIP184.SUB (for ZSM4 and DR LINK) 213 | or SLR184.SUB (using SLR Z80ASM and SLRNK). 214 | 215 | Once again, I've updated the source and library file (still at v1.8-4) 216 | so fetch a new copy if you've an older version. 217 | 218 | Also a later Z-System version of ZIPDIR has been added. Download from 219 | [ZIPDIR14.LBR](https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zipdir14.lbr) 220 | 221 | 222 | ### November 4, 2020 223 | 224 | Lars has fixed the "zero-length file CRC error" for the Z-system v1.8-4 225 | version. Updated UNZIP184.Z80, the binary and library for this version only. 226 | Also included an updated version of 227 | [ZIPDIR.LBR](https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/zipdir.lbr) 228 | to correctly report .ZIP file entries compressed with the Deflate method. 229 | 230 | 231 | ### October 31, 2020 232 | 233 | Lars Nelson has ported the v1.5-4 updates to the Z-system version (with 234 | the exception of the >255 character filename check). As usual, the 235 | individual files are in the unzip folder or grab the v1.8-4 version 236 | in a CP/M .LBR file from 237 | 238 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip184.lbr 239 | 240 | I've also included the Z-system libraries in their original binary distribution 241 | format .LBR files (should you wish to rebuild from source code). They are 242 | 243 | * [LIBS45A.LBR](https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/LIBS45A.LBR) - the 244 | library containing .REL versions of SYSLIB, Z3LIB and DSLIB in both 245 | Microsoft M80/DR LINK and SLRNK file formats. 246 | 247 | * [LBRHL45A.LBR](https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/LBRHL45A.LBR) - the 248 | help files for LIBS45A.LBR 249 | 250 | * [ZSLIB36.LBR](https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/ZSLIB36.LBR) - the 251 | supplemental routines for programmers. 252 | 253 | For testing, I re-linked UNZIP184.COM natively under Z3PLUS Vers. 1.02 254 | (the Z-system variant for CP/M-Plus) using the ZSM4 assembler and Digital 255 | Research's LINK using the submit file UNZIP184.SUB. 256 | 257 | 258 | ### October 30, 2020 259 | 260 | Lars Nelson has ported the v1.5-2 bug fixes and UnDeflate enhancements 261 | to the Z-system (ZCPR 3.x) branch, resulting in v1.8-2. 262 | 263 | Based on initial testing, this version (using a 2K buffer and Z-system 264 | libraries) has better performance than v1.5-2 (and later). 265 | 266 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip182.lbr 267 | 268 | 269 | ### October 18, 2020 270 | 271 | Some further speed optimisations by Russell Marks. 272 | 273 | * Further slight optimisations to bit-readers, 274 | 275 | * Backport some unzip 1.8 changes (buffer-overrun fixes, bit 7 strip on 276 | output filenames, less frequent ^C checking, and low-memory message), 277 | and add various comments. 278 | 279 | * Use self-modifying code with an unrolled end loop in rdbybits, 280 | and add a "rd1bit" macro, for about a 12% speed improvement 281 | on overall extraction time compared to version 1.5-3. 282 | 283 | * Fix long-filename buffer overrun, for filenames longer than 284 | 255 characters. 285 | 286 | * Backport Howard Goldstein's buffer-overrun fixes from 287 | unzip 1.8 - previously, a 255-byte buffer was repeatedly used 288 | to read up-to-65535-byte inputs. 289 | 290 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip154.lbr 291 | 292 | 293 | ### October 15, 2020 294 | 295 | Russell Marks has contributed speed optimisations to the UnDeflate 296 | algorithm to significantly boost performance (by more than 30%). 297 | 298 | * A new routine rdbybits now processes eight or fewer bits. 299 | 300 | * Checks whether the TPA size is large enough for UNZIP's tables 301 | 302 | * Use a table-based CRC algorithm. This increases the CP/M 303 | binary size by about 1Kbyte. 304 | 305 | I've bumped the version number to 1.5-3 and the latest 306 | updated sourcefile as *UNZIP153.Z80*. The source and CP/M binary 307 | are also available in a CP/M format library file from 308 | 309 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip153.lbr 310 | 311 | 312 | ### September 2020 313 | 314 | Martin has posted some more updates and added support to decompress 315 | ZIP file entries compressed with the Deflate algorithm. 316 | 317 | The changelog is - 318 | 319 | * Fix extraction of zero-length files. 320 | 321 | * Skip to the next file header if the compression method is unknown 322 | 323 | * Fix readbits when a full word (16 bits) is read - in preparation 324 | for implementing the unDeflate algorithm. 325 | 326 | * Fix mis-ordering of variables. Code makes the assumption 327 | that "bitbuf" is the byte before "bleft". 328 | 329 | * Allow the relocation of the input buffer. 330 | 331 | * Make the output buffer size dynamic. 332 | 333 | * Implement the UnDeflate algorithm - based on the work by 334 | Keir Fraser's HiTech-C code at 335 | https://github.com/keirf/Amiga-Stuff/blob/master/inflate/degzip_portable.c 336 | 337 | You'll find the updated sourcefile as *UNZIP152.Z80* which you 338 | can also get in a CP/M format library file from 339 | 340 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip152.lbr 341 | 342 | 343 | ### June 2020 344 | 345 | Recently Martin posted two bug fixes to the unshrink and unimplode 346 | routines in the comp.os.cpm USENET group that fix two long outstanding 347 | bugs (1-Jun-2020 and 15-Jun-2020). 348 | 349 | I've incorporated Martin's fixes into a new sourcefile *UNZIP151.Z80* 350 | and also updated the original sourcecode for Version 1.2 into a renamed 351 | file *UNZIP121.Z80* 352 | 353 | I've also updated the Z-system Version 1.8 into a renamed source file 354 | *UNZIP181.Z80* and rebuilt the corresponding .COM file using the 355 | Z-system libraries extracted from LIBS45A.LBR and ZSLIB36.LBR 356 | 357 | For a discussion of the fixes - please refer to the following 358 | postings at the Google Groups archive of the comp.os.cpm newsgroup - 359 | 360 | * Un-shrink fix https://groups.google.com/forum/#!topic/comp.os.cpm/B0A4x59SX44 361 | 362 | * Un-implode fix https://groups.google.com/forum/#!topic/comp.os.cpm/rpjA1Q6RtDc 363 | 364 | The new Z80 CP/M executable has been built using Hector Peraza's ZSM4 365 | assembler[^1] and Digital Research's LINK as *UNZIP151.COM* using the 366 | following commands - 367 | 368 | ``` 369 | zsm4 =unzip151.z80 370 | link unzip151 371 | ``` 372 | 373 | A new library file (without compressed entries) containing the fixes 374 | is _unzip151.lbr_ and can be downloaded from 375 | 376 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip151.lbr 377 | 378 | 379 | Also, the new Z-system (ZCPR 3.x) UNZIP Version 1.8-1 is in the 380 | library _unzip181.lbr_ and can be downloaded from 381 | 382 | https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/master/unzip/unzip181.lbr 383 | 384 | The Z-system version has been built using the submit file (also included 385 | as _UNZIP181.SUB_) - 386 | 387 | ``` 388 | ; Build new version of UNZIP181 using SLR Z80ASM and SLRNK 389 | ; using Z-System libraries from LIBS45A.LBR and ZSLIB36.LBR 390 | ; 391 | z80asm unzip181/6 392 | ; Load ASEG after CSEG - verify CSEG size is 0d7b 393 | ; and use ASEG at 0d7b + 0100 +1 to be sure 394 | slrnk /a:0e7c,/p:100,unzip181,unzip181/n/e 395 | ``` 396 | 397 | 398 | ## Background 399 | 400 | Files have been extracted from the following distribution archives - 401 | 402 | * UNZIP15.LBR from the Public Domain software library originally 403 | distributed on 1-Jun-1991 as Version 1.5. I obtained this from 404 | the Walnut Creek CP/M Software CD-ROM at 405 | 406 | http://www.classiccmp.org/cpmarchives/cpm/Software/WalnutCD/cpm/utils/arc-lbr/unzip15.lbr 407 | 408 | Version 1.5 incorporates modifications by Howard Goldstein on 1-Jun-1991 409 | plus those by Bruce Morgan on 16-May-1991 (Version 1.4) and Gene 410 | Pizzetta on 12-May-1991 (version 1.3); and includes the original 411 | Version 1.2 source-code by David Goodenough dated 3-Jul-1990. 412 | 413 | * UNZIP18.LBR has further modifications by Howard Goldstein for 414 | Z-system (ZCPR 3.x) with improved file I/O performance and buffering. It 415 | was obtained from 416 | 417 | http://www.classiccmp.org/cpmarchives/cpm/Software/WalnutCD/jsage/znode3/uploads/unzip18.lbr 418 | 419 | 420 | ## Notes 421 | 422 | Other Zilog Z80 assemblers/linkers can also be used (e.g. SLR Z80ASM/SLRNK 423 | or even Microsoft M80/L80) - however, they may create 424 | a .COM file with data segment storage included. 425 | 426 | Also, there are other UNZIP programs for CP/M that use the same 427 | unpacking code derived from the Version 1.2 source-code. They 428 | are _not fixed_. 429 | 430 | -- 431 | 432 | [^1]: The source-code, documentation and executable for the ZSM4 Z80/Z180/Z280 Macro Assembler may be obtained from 433 | https://github.com/hperaza/ZSM4 434 | 435 | [^2]: 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 from 436 | http://www.cpm.z80.de/develop/zmac.zip 437 | 438 | [^3]: A copy of the CP/M library file extraction tool NULU.COM may be downloaded 439 | [here](https://raw.githubusercontent.com/agn454/Z280RC/master/utilities/NULU.COM) 440 | or the full NULU distribution can be downloded from the cpmarchives site as 441 | [NULU152A.LBR](http://cpmarchives.classiccmp.org/cpm/Software/WalnutCD/cpm/utils/arc-lbr/nulu152a.lbr) 442 | 443 | [^4]: CP/M native tools for decompressing are LT31.COM (which will extract and 444 | uncrunch/unsqueeze/unLZH directly from .LBR file members) available in 445 | [LT31.LBR](http://cpmarchives.classiccmp.org/cpm/Software/WalnutCD/cpm/utils/arc-lbr/lt31.lbr) 446 | or UCRLZH20.COM available in 447 | [CRLZH20.LBR](http://www.classiccmp.org/cpm/Software/WalnutCD/cpm/utils/squsq/crlzh20.lbr). 448 | 449 | -------------------------------------------------------------------------------- /unzip/CPMZIP.TXT: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | ZIP archiving is probably the most common method of archiving files, and 4 | one of the most common methods of file compression. CPMZip consists of 5 | programs that allow you to create, extract and examine ZIP archives. 6 | 7 | The supplied programs are ZIP, UNZIP and ZIPDIR. They perform the following 8 | actions: 9 | 10 | ZIPDIR - v1.50 - Lists the contents of a ZIP file 11 | UNZIP - v1.56 - Extracts stored files from a ZIP file 12 | ZIP - v1.00 - Creates ZIP file, storing files 13 | 14 | Brief usage details 15 | ------------------- 16 | ZIPDIR [options] 17 | ? Display the ZIPDIR command and usage information. 18 | 19 | UNZIP [options] 20 | exspec Directory into which files will be extracted. 21 | ? Display the UNZIP command and usage information. 22 | O Overwrite any existing files. 23 | Q Quiet mode. 24 | 25 | ZIP [options] 26 | infiles Wildcarded specification of files to include. 27 | ? Display the ZIP command and usage information. 28 | O Overwrite any existing output file. 29 | Q Quiet mode. 30 | 31 | If a command is run without any parameters, the usage information is displayed. 32 | Options are supplied in [square brackets]. 33 | 34 | ZIPDIR will pause every 23 lines and wait for a keypress. SPACE will display one 35 | more line, CTRL-C will abort, any other key will display another 23 lines. 36 | 37 | Examples 38 | -------- 39 | ZIPDIR CPMZIP.ZIP - list the entries in CPMZIP.ZIP, with information 40 | about each file. Any directories are stripped 41 | from the filenames, entries that are directories 42 | are listed suffixed with '/' and stored as "Dir.". 43 | 44 | UNZIP SAMPLES.ZIP - lists the files in SAMPLES.ZIP. Note this is 45 | different to the default on other platforms. 46 | UNZIP SAMPLES.ZIP A: - extracts from SAMPLES.ZIP and writes them to 47 | drive A. Any existing files will not be 48 | overwritten. The filenames are listed as they 49 | are extracted. 50 | UNZIP SAMPLES.ZIP *.* - extracts to the current drive. 51 | UNZIP SAMPLES.ZIP B:*.TXT - extract to drive B: files that match *.TXT. 52 | UNZIP SAMPLES.ZIP A: [O] - extracts from SAMPLES.ZIP and overwrites any 53 | existing files. 54 | UNZIP SAMPLES.ZIP A: [OQ] - extracts from SAMPLES.ZIP and overwrites any 55 | existing files, and display no output. 56 | 57 | ZIP A:DEMO.ZIP B:*.TXT - create the ZIP archive A:DEMO.ZIP with the 58 | files that match B:*.TXT. The filenames are 59 | listed as they are included. 60 | ZIP A:DEMO.ZIP B:*.TXT [Q] - as above, but performed silently. 61 | ZIP A:DEMO.ZIP B:*.* [OQ] - zip everything on drive B, overwriting any 62 | pre-existing A:DEMO.ZIP file, acting silently. 63 | 64 | Technical Details 65 | ----------------- 66 | A ZIP file consists of a series of entries in the following format: 67 | 68 | local file header signature 4 bytes "PK",&03,&04 69 | version needed to extract 2 bytes 70 | general purpose bit flag 2 bytes 71 | compression method 2 bytes 72 | last modification time 2 bytes in MS-DOS format 73 | last modification date 2 bytes in MS-DOS format 74 | crc-32 4 bytes 75 | compressed size 4 bytes 76 | uncompressed size 4 bytes 77 | filename length 2 bytes 78 | extra field length 2 bytes 79 | filename (variable size) 80 | extra field (variable size) 81 | data (variable size) 82 | 83 | CP/M does not support subdirectories, so on extracting files and path 84 | is junked as though with the the InfoZip -j option. Filenames are 85 | forced to upper case and truncated to 8.3 filenames. 86 | 87 | CP/M does not support time/date stamps, so these are ignored. CPMZIP3 88 | supports time/date stamps on CP/M systems with date support such as 89 | ZSDOS and CP/M Plus. 90 | 91 | Version History 92 | --------------- 93 | ZIPDIR was originally written by S. Greenberg with updates by Bruce Morgen, 94 | Howard Goldstein, Lars Nelson and Jonathan Harston. 95 | 96 | UNZIP was originally written by David P. Goodenough with updates by Gene 97 | Pizzetta, Bruce Morgen, Howard Goldstein, Martin, Russell Marks, Tony 98 | Nicholson and Jonathan Harston. 99 | 100 | ZIP was written by Jonathan Harston. 101 | -------------------------------------------------------------------------------- /unzip/DATESTR.LIB: -------------------------------------------------------------------------------- 1 | .xlist ; Suppress listing of this MACLIB 2 | 3 | ; convert day, month, year to date string in dd-mmm-yyyy format 4 | datestr macro ?dd,?mm,?yyyy 5 | defb '0'+(?dd / 10),'0'+(?dd mod 10),'-' 6 | if (?mm lt 1) or (?mm gt 12) 7 | defb 'xxx' 8 | else 9 | if ?mm eq 1 10 | defb 'Jan' 11 | endif 12 | if ?mm eq 2 13 | defb 'Feb' 14 | endif 15 | if ?mm eq 3 16 | defb 'Mar' 17 | endif 18 | if ?mm eq 4 19 | defb 'Apr' 20 | endif 21 | if ?mm eq 5 22 | defb 'May' 23 | endif 24 | if ?mm eq 6 25 | defb 'Jun' 26 | endif 27 | if ?mm eq 7 28 | defb 'Jul' 29 | endif 30 | if ?mm eq 8 31 | defb 'Aug' 32 | endif 33 | if ?mm eq 9 34 | defb 'Sep' 35 | endif 36 | if ?mm eq 10 37 | defb 'Oct' 38 | endif 39 | if ?mm eq 11 40 | defb 'Nov' 41 | endif 42 | if ?mm eq 12 43 | defb 'Dec' 44 | endif 45 | endif 46 | defb '-','0'+((?yyyy / 1000) mod 10),'0'+((?yyyy / 100) mod 10) 47 | defb '0'+((?yyyy / 10) mod 10),'0'+(?yyyy mod 10) 48 | endm 49 | 50 | .list 51 | -------------------------------------------------------------------------------- /unzip/LBRHL45A.LBR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/LBRHL45A.LBR -------------------------------------------------------------------------------- /unzip/LIBS45A.LBR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/LIBS45A.LBR -------------------------------------------------------------------------------- /unzip/SLR184.SUB: -------------------------------------------------------------------------------- 1 | ; Build new version of UNZIP184 using SLR Z80ASM and SLRNK 2 | ; using Z-System libraries from LIB45A.LBR and ZSLIB36.LBR 3 | ; 4 | ; (I use the M80 versions of the libraries - so strip 5 | ; symbols to 6 characters) 6 | z80asm unzip184/6 7 | ; Load ASEG after CSEG - verify CSEG size is 1684h 8 | ; and use ASEG at 1684h + 0100h + 1 to be sure 9 | slrnk /a:1785,/p:0100,unzip184,unzip184/n/e 10 | -------------------------------------------------------------------------------- /unzip/SLR185.SUB: -------------------------------------------------------------------------------- 1 | z80asm unzip185/6 2 | slrnk /a:1eb3,/p:0100,unzip185,unzip185/n/e 3 | -------------------------------------------------------------------------------- /unzip/SLR186.SUB: -------------------------------------------------------------------------------- 1 | z80asm unzip186/6 2 | slrnk /a:2213,/p:0100,unzip186,unzip186/n/e 3 | -------------------------------------------------------------------------------- /unzip/SLR187.SUB: -------------------------------------------------------------------------------- 1 | z80asm unzip187/6 2 | slrnk /a:1D72,/p:0100,unzip187,unzip187/n/e 3 | -------------------------------------------------------------------------------- /unzip/UDATZI.Z80: -------------------------------------------------------------------------------- 1 | ; 2 | public IPuser,OPuser 3 | public mode,junk,lfh,gpbf,cm,lmft 4 | public lmfd,crc,cs,ucs,fnl,efl 5 | public endlfh,lfhsiz,opfcb,opfn,opext,bitbuf,vars 6 | public bleft,wrtpt,outpos,crc32,curmode,opbuf 7 | public L_table,D_shift,V,nchar,lchar,ExState 8 | public Len,ltp,mml,dictb,noswps,entrs 9 | public lbl,treep,lenp,nodes,nrsym,nnode,bcode,bmask 10 | public blcnt,ncode,hlit,hdist,inbps,rdpts 11 | public lenld,cltr,littr,disttr,bitbs,blfts 12 | public oldcode,offset,codesize,maxcode,free_ent 13 | public finchar,stackp,incode,code,outbuf,suffix_of 14 | public prefix_of,Slen,lit_tree,len_tree,dist_tre,followers,stack 15 | public fcb2sav,eodata,locstk,nomtch 16 | 17 | dseg 18 | 19 | ; Unitialised data for UNZIPZ 20 | 21 | maclib UNZIPEQU.LIB ; Equates - M80 needs caps 22 | 23 | ;lfhsiz equ (endlfh-lfh) ; This equate added to facilitate assembly 24 | 25 | DSEG 26 | 27 | IPuser equ $ ; User number for input file 28 | OPuser equ IPuser+1 ; User number for output file 29 | fcb2sav equ OPuser+1 ; Buffer to hold copy of filename in FCB2 30 | mode equ fcb2sav+11 ; 0 if extracting, NZ if checking 31 | nomtch equ mode+1 ; 'no match' FLAG, 0 if match, NZ if no match 32 | junk equ nomtch+1 ; General buffer 33 | 34 | lfh equ junk+STRSIZ ; 2 bytes 35 | gpbf equ lfh+2 ; 2 bytes 36 | cm equ lfh+4 ; Compression type. 0=Stored 37 | ; 1=Shrunk 38 | ; 2-5=Reduced 39 | ; 6=Implode 40 | ; 7=Token 41 | ; 8=Deflate 42 | lmft equ lfh+6 43 | lmfd equ lfh+8 44 | crc equ lfh+10 ; 32 bit CRC (four bytes) 45 | cs equ lfh+14 ; Length of file as stored (32 bit) 46 | ucs equ lfh+18 ; Length of file after extraction (32 bit) 47 | fnl equ lfh+22 ; Length of the filename 48 | efl equ lfh+24 ; Length of other stuff 49 | endlfh equ lfh+26 50 | lfhsiz equ (endlfh-lfh) ; This equate added to facilitate assembly 51 | 52 | opfcb equ lfh+27 ; Output FCB 53 | opfn equ lfh+28 ; Output filename 54 | opext equ lfh+36 ; Output type 55 | 56 | bitbuf equ opext+3+4+16+1 57 | vars equ bitbuf+1 58 | bleft equ vars 59 | wrtpt equ vars+1 60 | outpos equ wrtpt+1 61 | crc32 equ outpos+4 62 | curmode equ crc32+4 63 | opbuf equ curmode+1 64 | L_table equ opbuf+128 65 | D_shift equ L_table+1 66 | 67 | V equ D_shift+1 68 | nchar equ V+1 69 | lchar equ nchar+1 70 | ExState equ lchar+1 71 | Len equ ExState+1 72 | ltp equ Len+2 73 | mml equ ltp+1 74 | dictb equ mml+1 75 | noswps equ dictb+1 76 | entrs equ noswps+1 77 | lbl equ entrs+2 ;ds 1 78 | treep equ lbl+1 ;ds 2 79 | lenp equ treep+2 ;ds 2 80 | nodes equ lenp+2 ;ds 2 81 | nrsym equ nodes+2 ;ds 2 82 | nnode equ nrsym+2 ;ds 2 83 | bcode equ nnode+2 ;ds 2 84 | bmask equ bcode+2 ;ds 2 85 | blcnt equ bmask+2 ;ds 2 * maxcl + 2 86 | ncode equ blcnt+(2*maxcl+2) ;ds 2 * maxcl + 2 87 | hlit equ ncode+(2*maxcl+2) ;ds 2 88 | hdist equ hlit+2 ;ds 1 89 | inbps equ hdist+1 ;ds 2 90 | rdpts equ inbps+2 ;ds 1 91 | bitbs equ rdpts+1 ;ds 1 92 | blfts equ bitbs+1 ;ds 1 93 | lenld equ blfts+1 ;ds (nrlit+nrdist) 94 | cltr equ lenld+(nrlit+nrdist) ;ds (4*nrcl) 95 | littr equ cltr+(4*nrcl) ;ds (4*nrlit) 96 | disttr equ littr+(4*nrlit) ;ds (4*nrdist) 97 | oldcode equ disttr+(4*nrdist) 98 | offset equ oldcode+2 99 | codesize equ offset+2 100 | maxcode equ codesize+1 101 | free_ent equ maxcode+2 102 | finchar equ free_ent+2 103 | stackp equ finchar+1 104 | incode equ stackp+2 105 | code equ incode+2 106 | outbuf equ code+2 107 | suffix_of equ outbuf 108 | prefix_of equ outbuf+8192 109 | Slen equ prefix_of 110 | lit_tree equ prefix_of 111 | len_tree equ lit_tree + _sf_tree_ 112 | dist_tre equ len_tree + _sf_tree_ 113 | followers equ dist_tre + _sf_tree_ + 16384 + 2 - (3 * _sf_tree_) 114 | stack equ followers 115 | locstk equ stack + 8192 + 60 116 | eodata equ locstk 117 | end 118 | -------------------------------------------------------------------------------- /unzip/UNZIP12.DOC: -------------------------------------------------------------------------------- 1 | UNZIP 2 | ===== 3 | 4 | A small, lean and mean CP/M unzipper. This only has two modes of operation: 5 | 6 | A>UNZIP FOO 7 | 8 | will check the CRC for all files in foo.zip, but it does not extract. 9 | 10 | A>UNZIP FOO E 11 | 12 | will extract all files from foo.zip - there is no selective extract. Note 13 | that UNZIP assumes a .ZIP extension, and adds one if it is not present. 14 | 15 | Source is provided, hack on it if you feel like it. Nice things to add would 16 | be a selective extract, a list option that uses the compressed size (cs:) 17 | field to seek through the file without having to read it all, and maybe a 18 | print to screen or printer option. User number support wouldn't go too far 19 | astray either. 20 | 21 | dg 7-3-90 22 | 23 | UUCP: .....!harvard!xait!pallio!dg 24 | Internet: dg%pallio.uucp@xait.xerox.com 25 | GEnie: D.GOODENOUGH 26 | Q-link: Delta G 27 | BBS's David Goodenough on all 28 | 29 | (617) 825-3135 30 | (617) 965-7046 31 | -------------------------------------------------------------------------------- /unzip/UNZIP12.Z80: -------------------------------------------------------------------------------- 1 | ; UNZIP.Z80 2 | ; 3 | ; Version 1.2 -- July 3, 1990 -- David P. Goodenough 4 | ; 5 | ; This file has been converted to assemble with SLR's Z80ASM, resulting 6 | ; in a COM file identical to the 1.2 release version. 7 | ; Gene Pizzetta, May 11, 1991 8 | ; 9 | CR equ 0Dh 10 | LF equ 0Ah 11 | CtrlZ equ 1Ah 12 | 13 | STRSIZ equ 256 14 | EXTRACT equ 'E' 15 | bdos equ 5 16 | open equ 0fh 17 | close equ 10h 18 | read equ 14h 19 | write equ 15h 20 | create equ 16h 21 | setdma equ 1ah 22 | infcb equ 5ch 23 | DLE equ 144 24 | max_bits equ 13 25 | init_bits equ 9 26 | hsize equ 8192 27 | first_ent equ 257 28 | clear equ 256 29 | maxcmax equ 1 << max_bits 30 | 31 | maxSF equ 256 32 | 33 | _code equ 0 34 | _value equ 2 35 | _bitlength equ 3 36 | 37 | _entries equ 0 38 | _maxlength equ 2 39 | _entry equ 4 40 | 41 | _sf_tree_ equ 4 + 4 * maxSF 42 | 43 | 44 | jr start 45 | db CR 46 | usage: db 'Usage: UNZIP ZIPFILE [E]',CR,LF 47 | db 'E - extract files',CR,LF 48 | db ' default is to just list files',CR,LF,0,CtrlZ 49 | start: ld sp,(6) ; set the stack pointer 50 | call ilprt 51 | db 'UNZIP V1.2 - DPG 1990',CR,LF,LF,0 52 | ld a,(5dh) ; filename? 53 | cp ' ' 54 | jr nz,wasfil 55 | ld hl,usage 56 | call pstr 57 | rst 0 58 | wasfil: ld a,(6dh) ; option letter? 59 | ;.cseg 60 | xor EXTRACT ; 'E' for extract 61 | ld (mode),a ; set the mode 62 | ld a,(65h) 63 | cp 20h 64 | jr nz,wasext 65 | ld hl,['I' << 8] + 'Z' 66 | ld (65h),hl 67 | ld a,'P' 68 | ld (67h),a ; install .ZIP extent 69 | wasext: ld de,5ch 70 | ld c,open 71 | call bdos ; try and open it 72 | inc a 73 | jr nz,openok ; ok 74 | call ilprt 75 | db 'Couldn''t find ZIP file',CR,LF,0 76 | rst 0 ; complain and exit 77 | sigerr: call ilprt 78 | db 'Bad signature in ZIP file',CR,LF,0 79 | rst 0 80 | openok: call getword 81 | ld de,-[['K' << 8] + 'P'] 82 | add hl,de 83 | ld a,h 84 | or l 85 | jr nz,sigerr 86 | call getword 87 | dec l 88 | jr nz,nocfhs 89 | dec h 90 | dec h 91 | jr nz,sigerr 92 | call pcfh 93 | jr openok 94 | nocfhs: dec l 95 | dec l 96 | jr nz,nolfhs 97 | ld a,h 98 | sub 4 99 | jr nz,sigerr 100 | call plfh 101 | jr openok 102 | nolfhs: dec l 103 | dec l 104 | jr nz,sigerr 105 | ld a,h 106 | sub 6 107 | jr nz,sigerr 108 | call pecd 109 | rst 0 110 | 111 | pcfh: ld b,12 112 | pcfhl1: push bc 113 | call getword 114 | pop bc 115 | djnz pcfhl1 116 | call getword 117 | push hl 118 | call getword 119 | push hl 120 | call getword 121 | pop de 122 | pop bc 123 | push hl 124 | push de 125 | push bc 126 | ld b,6 127 | pcfhl2: push bc 128 | call getword 129 | pop bc 130 | djnz pcfhl2 131 | pop hl 132 | ld de,junk 133 | ;.cseg 134 | call getstring 135 | pop hl 136 | ld de,junk 137 | call getstring 138 | pop hl 139 | ld de,junk 140 | call getstring 141 | ret 142 | 143 | pecd: ld b,8 144 | pecdl: push bc 145 | call getword 146 | pop bc 147 | djnz pecdl 148 | call getword 149 | ld de,junk 150 | call getstring 151 | ret 152 | 153 | ;.cseg 154 | 155 | plfh: ld de,lfh 156 | ld hl,endlfh-lfh 157 | ; ld hl,{endlfh - lfh} 158 | call getstring 159 | ld hl,opfcb 160 | ld de,opfcb + 1 161 | ld bc,32 162 | ld (hl),b 163 | ldir 164 | ;.cseg 165 | ld de,junk 166 | ld hl,(fnl) 167 | call getstring 168 | ld de,junk + 20 169 | ld hl,(efl) 170 | call getstring 171 | ld de,junk 172 | ld hl,opfn 173 | ld b,8 174 | call scanfn 175 | ld a,(de) 176 | cp '.' 177 | jr nz,nodot 178 | inc de 179 | nodot: ld b,3 180 | call scanfn 181 | ld hl,init 182 | ld de,vars 183 | ld bc,endinit-init 184 | ; ld bc,{endinit - init} 185 | ldir 186 | ;.cseg 187 | 188 | ld a,(mode) 189 | resmod: ld (curmode),a 190 | or a 191 | jr nz,extrct 192 | ld de,opfcb 193 | ld c,0fh 194 | call bdos 195 | inc a 196 | jr z,creok 197 | ld hl,junk 198 | call pstr 199 | call ilprt 200 | db ' already exists',0 201 | noex: call ilprt 202 | db ' -- not extracting',0 203 | ld a,0ffh 204 | jr resmod 205 | extrct: xor a 206 | ld (zipeof),a 207 | ld a,(curmode) 208 | dec a 209 | jp m,doext 210 | call ilprt 211 | db 'Checking ',0 212 | jr pjunk 213 | creok: ld de,opfcb 214 | ld c,create 215 | call bdos 216 | inc a 217 | jr nz,opnok1 218 | call ilprt 219 | db 'Error creating ',0 220 | ld hl,junk 221 | call pstr 222 | jr noex 223 | opnok1: call ilprt 224 | db 'Extracting ',0 225 | pjunk: ld hl,junk 226 | call pstr 227 | doext: call ilprt 228 | db ' -- ',0 229 | ld hl,counting 230 | inc (hl) 231 | ld a,(cm) 232 | or a 233 | jr nz,case1 234 | case0w: ld a,(zipeof) 235 | and 1 236 | jr nz,closeo 237 | savcs0: call getbyte 238 | call outbyte 239 | jr case0w 240 | case1: dec a 241 | jr nz,case2p 242 | call unshrink 243 | jr closeo 244 | case2p: dec a 245 | cp 4 246 | jr nc,tryimp 247 | call unreduce 248 | jr closeo 249 | tryimp: jr nz,badzip 250 | call unimplode 251 | jr closeo 252 | badzip: call ilprt 253 | db 'Unknown compression method',CR,LF,0 254 | ret 255 | closeo: ld hl,zipeof 256 | dec (hl) 257 | inc hl 258 | dec (hl) 259 | ld a,(mode) 260 | or a 261 | jr nz,nocls 262 | ld hl,wrtpt 263 | ld a,(hl) 264 | or a 265 | jr z,noflsh 266 | ld de,opbuf 267 | ;.cseg 268 | ld c,setdma 269 | call bdos 270 | ld de,opfcb 271 | ld c,write 272 | call bdos 273 | noflsh: ld de,opfcb 274 | ld c,close 275 | call bdos 276 | nocls: ld hl,crc32 277 | ld de,crc 278 | scf 279 | ld bc,4 << 8 280 | crcclp: ld a,(de) 281 | adc a,(hl) 282 | push af 283 | or c 284 | ld c,a 285 | pop af 286 | inc hl 287 | inc de 288 | djnz crcclp 289 | ld a,c 290 | or a 291 | jr z,crcok 292 | call ilprt 293 | db 'CRC error',CR,LF,0 294 | ret 295 | crcok: call ilprt 296 | db 'CRC OK',CR,LF,0 297 | ret 298 | 299 | getchla: 300 | call getcode 301 | ld (code),hl 302 | ld a,(zipeof) 303 | and 1 304 | ret 305 | 306 | savstk: 307 | ld hl,(stackp) 308 | dec hl 309 | ld (stackp),hl 310 | ld (hl),a 311 | ret 312 | 313 | getcode: 314 | ld a,(codesize) 315 | readbits: 316 | ld hl,8000h 317 | bitlp: push af 318 | push hl 319 | getbit: ld hl,bleft 320 | dec (hl) 321 | jp m,readbt 322 | dec hl 323 | rr (hl) 324 | pop hl 325 | rr h 326 | rr l 327 | pop af 328 | dec a 329 | jr nz,bitlp 330 | finbit: srl h 331 | rr l 332 | jr nc,finbit 333 | ld a,l 334 | ret 335 | readbt: push hl 336 | call getbyte 337 | pop hl 338 | ld (hl),8 339 | dec hl 340 | ld (hl),a 341 | jr getbit 342 | 343 | scanfn: ld a,(de) 344 | cp '.' 345 | jr z,nocopy 346 | or a 347 | jr z,nocopy 348 | inc de 349 | dec b 350 | jp m,scanfn 351 | ld (hl),a 352 | inc hl 353 | jr scanfn 354 | nocopy: dec b 355 | ret m 356 | ld (hl),' ' 357 | inc hl 358 | jr nocopy 359 | 360 | ilprt: pop hl 361 | call pstr 362 | jp (hl) 363 | 364 | pstr: ld a,(hl) 365 | or a 366 | ret z 367 | push hl 368 | ld e,a 369 | ld c,2 370 | call bdos 371 | pop hl 372 | inc hl 373 | jr pstr 374 | 375 | getstring: 376 | ld a,h 377 | or l 378 | ld (de),a 379 | ret z 380 | push de 381 | push hl 382 | call getbyte 383 | pop hl 384 | pop de 385 | ld (de),a 386 | inc de 387 | dec hl 388 | jr getstring 389 | 390 | getword: 391 | call getbyte 392 | push af 393 | call getbyte 394 | pop hl 395 | ld l,h 396 | ld h,a 397 | ret 398 | 399 | getbyte: 400 | ld a,(zipeof) 401 | and 1 402 | ld a,CtrlZ 403 | ret nz 404 | ld a,(counting) 405 | or a 406 | jr z,skpdci 407 | ld hl,(cs) 408 | ld de,(cs + 2) 409 | ld a,d 410 | or e 411 | or h 412 | or l 413 | jr nz,noteof 414 | ld hl,zipeof 415 | inc (hl) 416 | ld a,CtrlZ 417 | ret 418 | noteof: ld a,h 419 | or l 420 | dec hl 421 | ld (cs),hl 422 | jr nz,skpdci 423 | dec de 424 | ld (cs + 2),de 425 | skpdci: ld hl,readpt 426 | ;.cseg 427 | ld a,(hl) 428 | or a 429 | jr nz,ptok 430 | ld de,80h 431 | ld (hl),e 432 | push hl 433 | ld c,setdma 434 | call bdos 435 | ld de,infcb 436 | ld c,read 437 | call bdos 438 | or a 439 | pop hl 440 | jr nz,ateof 441 | ptok: ld a,(hl) 442 | inc (hl) 443 | ld l,a 444 | ld h,0 445 | ld a,(hl) 446 | ret 447 | ateof: ld a,CtrlZ 448 | ret 449 | 450 | outb: 451 | ld hl,(outpos) 452 | push hl 453 | push af 454 | ld a,h 455 | and 1fh 456 | ld h,a 457 | pop af 458 | ld de,outbuf 459 | add hl,de 460 | ld (hl),a 461 | pop hl 462 | inc hl 463 | ld (outpos),hl 464 | push af 465 | ld a,h 466 | or l 467 | jr nz,nopos 468 | ld hl,(outpos + 2) 469 | inc hl 470 | ld (outpos + 2),hl 471 | nopos: pop af 472 | 473 | outbyte: 474 | push af 475 | call updcrc 476 | ld hl,(ucs) 477 | ld de,(ucs + 2) 478 | ld a,h 479 | or l 480 | dec hl 481 | ld (ucs),hl 482 | jr nz,tsthl0 483 | dec de 484 | ld (ucs + 2),de 485 | tsthl0: ld a,h 486 | or l 487 | or d 488 | or e 489 | jr nz,noeof 490 | ld hl,zipeof 491 | inc (hl) 492 | noeof: ld a,(mode) 493 | or a 494 | jr nz,popret 495 | ld hl,wrtpt 496 | ld a,(hl) 497 | add a,a 498 | jr nc,wptok 499 | ld de,opbuf 500 | ld c,setdma 501 | call bdos 502 | ld de,opfcb 503 | ld c,write 504 | call bdos 505 | or a 506 | jr z,wptok 507 | ld (mode),a 508 | call ilprt 509 | db 'Write Error',CR,LF,0 510 | popret: pop af 511 | ret 512 | wptok: jr nz,nofilb 513 | ld hl,opbuf 514 | ld de,opbuf + 1 515 | ld bc,127 516 | ld (hl),CtrlZ 517 | ldir 518 | xor a 519 | ld (wrtpt),a 520 | nofilb: pop af 521 | ld hl,wrtpt 522 | inc (hl) 523 | ld l,(hl) 524 | ld h,0 525 | ld de,opbuf - 1 526 | add hl,de 527 | ld (hl),a 528 | ret 529 | 530 | updcrc: ld hl,(crc32) 531 | ld de,(crc32 + 2) 532 | ld c,a 533 | ld b,8 534 | crclp: ld a,l 535 | xor c 536 | srl c 537 | srl d 538 | rr e 539 | rr h 540 | rr l 541 | rra 542 | jr nc,noxor 543 | ld a,d 544 | xor 0edh 545 | ld d,a 546 | ld a,e 547 | xor 0b8h 548 | ld e,a 549 | ld a,h 550 | xor 83h 551 | ld h,a 552 | ld a,l 553 | xor 20h 554 | ld l,a 555 | noxor: djnz crclp 556 | ld (crc32),hl 557 | ld (crc32 + 2),de 558 | ret 559 | 560 | unshrink: 561 | ld a,init_bits 562 | ld (codesize),a 563 | ld hl,[1 << init_bits] - 1; 564 | ld (maxcode),hl 565 | ld hl,first_ent 566 | ld (free_ent),hl 567 | ld hl,prefix_of 568 | ld de,prefix_of + 1 569 | ld bc,512 570 | ld (hl),c 571 | ldir 572 | ld bc,16386 - 512 573 | ld (hl),-1 574 | ldir 575 | ld hl,suffix_of 576 | sol: ld (hl),c 577 | inc hl 578 | inc c 579 | jr nz,sol 580 | call getchla 581 | ld (oldcode),hl 582 | ret nz 583 | ld a,l 584 | ld (finchar),a 585 | call outbyte 586 | unshlp: ld hl,stack + 8192 587 | ld (stackp),hl 588 | ld a,(zipeof) 589 | and 1 590 | ret nz 591 | clrlp: call z,getchla 592 | ret nz 593 | ld a,h 594 | dec a 595 | or l 596 | jr nz,noclr 597 | call getchla 598 | ld a,h 599 | or a 600 | jr nz,clrlp 601 | dec l 602 | jr z,bumpcs 603 | dec l 604 | call z,partial_clear 605 | jr clrlp 606 | bumpcs: ld hl,codesize 607 | inc (hl) 608 | ld a,(hl) 609 | cp max_bits 610 | ld hl,maxcmax 611 | jr z,atmax 612 | ld hl,1 613 | maxclp: add hl,hl 614 | dec a 615 | jr nz,maxclp 616 | dec hl 617 | atmax: ld (maxcode),hl 618 | jr clrlp 619 | noclr: ld (incode),hl 620 | add hl,hl 621 | ld de,prefix_of 622 | add hl,de 623 | ld a,(hl) 624 | inc hl 625 | and (hl) 626 | inc a 627 | ld hl,(code) 628 | jr nz,noKwKw 629 | ld a,(finchar) 630 | call savstk 631 | ld hl,(oldcode) 632 | noKwKw: ex de,hl 633 | staklp: ld hl,suffix_of 634 | add hl,de 635 | ld a,(hl) 636 | call savstk 637 | ld hl,100h 638 | or a 639 | sbc hl,de 640 | jr nc,unstak 641 | ld hl,prefix_of 642 | add hl,de 643 | add hl,de 644 | ld e,(hl) 645 | inc hl 646 | ld d,(hl) 647 | jr staklp 648 | unstak: ld (finchar),a 649 | ld de,(stackp) 650 | unslp: ld hl,stack + 8192 651 | or a 652 | sbc hl,de 653 | jr z,newent 654 | ld a,(de) 655 | inc de 656 | push de 657 | call outbyte 658 | pop de 659 | jr unslp 660 | newent: ld hl,(free_ent) 661 | ld (code),hl 662 | ex de,hl 663 | ld hl,1fffh 664 | or a 665 | sbc hl,de 666 | jr c,full 667 | ld hl,prefix_of 668 | add hl,de 669 | add hl,de 670 | ld bc,(oldcode) 671 | ld (hl),c 672 | inc hl 673 | ld (hl),b 674 | ld hl,suffix_of 675 | add hl,de 676 | ld a,(finchar) 677 | ld (hl),a 678 | getfre: inc de 679 | ld hl,1fffh 680 | or a 681 | sbc hl,de 682 | jr c,full1 683 | ld hl,prefix_of 684 | add hl,de 685 | add hl,de 686 | ld a,(hl) 687 | inc hl 688 | and (hl) 689 | inc a 690 | jr nz,getfre 691 | full1: ld (free_ent),de 692 | full: ld hl,(incode) 693 | ld (oldcode),hl 694 | jp unshlp 695 | 696 | partial_clear: 697 | ld de,first_ent 698 | l8: ld hl,(free_ent) 699 | or a 700 | sbc hl,de 701 | jr z,br8 702 | ld hl,prefix_of + 1 703 | add hl,de 704 | add hl,de 705 | set 7,(hl) 706 | inc de 707 | jr l8 708 | br8: ld de,first_ent 709 | l9: ld hl,(free_ent) 710 | or a 711 | sbc hl,de 712 | jr z,br9 713 | ld hl,prefix_of 714 | add hl,de 715 | add hl,de 716 | push de 717 | ld e,(hl) 718 | inc hl 719 | ld d,(hl) 720 | res 7,d 721 | ld hl,first_ent - 1 722 | or a 723 | sbc hl,de 724 | jr nc,ei10 725 | ld hl,prefix_of + 1 726 | add hl,de 727 | add hl,de 728 | res 7,(hl) 729 | ei10: pop de 730 | inc de 731 | jr l9 732 | br9: ld de,first_ent 733 | l10: ld hl,(free_ent) 734 | or a 735 | sbc hl,de 736 | jr z,br10 737 | ld hl,prefix_of + 1 738 | add hl,de 739 | add hl,de 740 | bit 7,(hl) 741 | jr z,ei11 742 | ld (hl),-1 743 | dec hl 744 | ld (hl),-1 745 | ei11: inc de 746 | jr l10 747 | br10: ld de,first_ent 748 | l11: ld hl,maxcmax 749 | or a 750 | sbc hl,de 751 | jr z,br11 752 | ld hl,prefix_of 753 | add hl,de 754 | add hl,de 755 | ld a,(hl) 756 | inc hl 757 | and (hl) 758 | inc a 759 | jr z,br11 760 | inc de 761 | jr l11 762 | br11: ld (free_ent),de 763 | ret 764 | 765 | loadfollowers: 766 | ld hl,Slen + 255 767 | ld b,0 768 | lflp: push bc 769 | push hl 770 | ld a,6 771 | call readbits 772 | pop hl 773 | pop de 774 | ld (hl),a 775 | push de 776 | push hl 777 | dec d 778 | ld hl,followers 779 | call shftadd 780 | ld b,a 781 | or a 782 | jr z,nofoll 783 | ldfllp: push hl 784 | push bc 785 | ld a,8 786 | call readbits 787 | pop bc 788 | pop hl 789 | ld (hl),a 790 | inc hl 791 | djnz ldfllp 792 | nofoll: pop hl 793 | pop bc 794 | dec hl 795 | djnz lflp 796 | ret 797 | ;.cseg 798 | 799 | unreduce: 800 | 801 | ;.cseg 802 | ld e,a 803 | ld d,0 804 | ld hl,_L_table 805 | add hl,de 806 | ld a,(hl) 807 | ld (L_table),a 808 | ld hl,_D_shift 809 | add hl,de 810 | ld a,(hl) 811 | ld (D_shift),a 812 | xor a 813 | ld (ExState),a 814 | ld (lchar),a 815 | call loadfollowers 816 | ur1: ld a,(zipeof) 817 | and 1 818 | ret nz 819 | call slenlch 820 | or a 821 | jr nz,ur2 822 | ur4: ld a,8 823 | call readbits 824 | jr ur3 825 | ur2: ld a,1 826 | call readbits 827 | dec l 828 | jr z,ur4 829 | call slenlch 830 | dec a 831 | or 1 832 | ld l,a 833 | xor a 834 | btlp: inc a 835 | srl l 836 | jr nz,btlp 837 | call readbits 838 | ld de,followers 839 | add hl,de 840 | ld de,(lchar - 1) 841 | call shftadd 842 | ld a,(hl) 843 | ur3: ld (nchar),a 844 | ld l,a 845 | ld a,(ExState) 846 | or a 847 | jr nz,ur5 848 | ld a,l 849 | cp DLE 850 | jr nz,ur9 851 | ld a,1 852 | ld (ExState),a 853 | jr ur6 854 | ur5: dec a 855 | jr nz,ur7 856 | ld a,l 857 | or a 858 | jr z,ur10 859 | ld (V),a 860 | ld a,(L_table) 861 | ld h,a 862 | and l 863 | cp h 864 | ld l,a 865 | ld h,0 866 | ld (Len),hl 867 | jr nz,ur12 868 | ld a,2 869 | jr ur11 870 | ur10: ld (ExState),a 871 | ld a,DLE 872 | ur9: call outb 873 | jr ur6 874 | ur7: dec a 875 | jr nz,ur8 876 | ld a,l 877 | ld hl,Len 878 | add a,(hl) 879 | ld (hl),a 880 | jr nc,ur12 881 | inc hl 882 | inc (hl) 883 | ur12: ld a,3 884 | jr ur11 885 | ur8: dec a 886 | jr nz,ur13 887 | ld a,(D_shift) 888 | ld b,a 889 | ld a,(V) 890 | ur14: srl a 891 | djnz ur14 892 | ld h,a 893 | inc hl 894 | ld bc,(Len) 895 | inc bc 896 | inc bc 897 | inc bc 898 | call callback 899 | ur13: xor a 900 | ur11: ld (ExState),a 901 | ur6: ld a,(nchar) 902 | ld (lchar),a 903 | jp ur1 904 | 905 | slenlch: 906 | ld hl,(lchar) 907 | ld h,0 908 | ld de,Slen 909 | add hl,de 910 | ld a,(hl) 911 | ret 912 | 913 | shftadd: 914 | ld e,0 915 | srl d 916 | rr e 917 | srl d 918 | rr e 919 | add hl,de 920 | ret 921 | 922 | callback: 923 | push bc 924 | push hl 925 | ld hl,(outpos) 926 | ld de,(outpos + 2) 927 | pop bc 928 | or a 929 | sbc hl,bc 930 | jr nc,cb2 931 | dec de 932 | cb2: pop bc 933 | cb3: bit 7,d 934 | jr z,cb4 935 | ld a,b 936 | or c 937 | jr z,cb4 938 | xor a 939 | call outbp 940 | inc hl 941 | ld a,h 942 | or l 943 | jr nz,cb5 944 | inc de 945 | cb5: dec bc 946 | jr cb3 947 | cb4: ex de,hl 948 | cb6: ld a,b 949 | or c 950 | ret z 951 | ld a,d 952 | and 1fh 953 | ld d,a 954 | ld hl,outbuf 955 | add hl,de 956 | ld a,(hl) 957 | call outbp 958 | inc de 959 | dec bc 960 | jr cb6 961 | 962 | outbp: push hl 963 | push de 964 | push bc 965 | call outb 966 | pop bc 967 | pop de 968 | pop hl 969 | ret 970 | 971 | ;.cseg 972 | 973 | readlengths: 974 | ld a,8 975 | call readbits 976 | ld d,h 977 | ld e,d 978 | inc hl 979 | ld b,h 980 | ld c,l 981 | ld (ix + _maxlength),e 982 | ld (ix + _maxlength + 1),d 983 | push ix 984 | pop hl 985 | inc hl 986 | inc hl 987 | inc hl 988 | rl1: ld a,b 989 | or c 990 | ret z 991 | push bc 992 | push de 993 | push hl 994 | ld a,4 995 | call readbits 996 | inc a 997 | push af 998 | ld a,4 999 | call readbits 1000 | inc a 1001 | ld b,a 1002 | pop af 1003 | ld c,a 1004 | pop hl 1005 | pop de 1006 | ld a,(ix + _maxlength) 1007 | cp c 1008 | jr nc,rl2 1009 | ld (ix + _maxlength),c 1010 | rl2: inc hl 1011 | inc hl 1012 | inc hl 1013 | ld (hl),e 1014 | inc hl 1015 | ld (hl),c 1016 | inc e 1017 | djnz rl2 1018 | pop bc 1019 | dec bc 1020 | jr rl1 1021 | 1022 | sortlengths: 1023 | ld h,(ix + _entries + 1) 1024 | ld l,(ix + _entries) 1025 | ld b,h 1026 | ld c,l 1027 | ld (entrs),hl 1028 | ;.cseg 1029 | sl7: srl b 1030 | rr c 1031 | sl1: ld a,b 1032 | or c 1033 | ret z 1034 | ld (noswps),a 1035 | push ix 1036 | ld de,4 1037 | add ix,de 1038 | push ix 1039 | pop iy 1040 | add iy,bc 1041 | add iy,bc 1042 | add iy,bc 1043 | add iy,bc 1044 | ld hl,(entrs) 1045 | or a 1046 | sbc hl,bc 1047 | sl2: ld a,(ix + _bitlength) 1048 | cp (iy + _bitlength) 1049 | jr c,sl4 1050 | jr nz,sl3 1051 | ld a,(iy + _value) 1052 | cp (ix + _value) 1053 | jr nc,sl4 1054 | sl3: ld d,e 1055 | sl5: ld a,(ix) 1056 | push af 1057 | ld a,(iy) 1058 | ld (ix),a 1059 | pop af 1060 | ld (iy),a 1061 | inc ix 1062 | inc iy 1063 | dec d 1064 | jr nz,sl5 1065 | ld a,d 1066 | ld (noswps),a 1067 | jr sl6 1068 | sl4: add ix,de 1069 | add iy,de 1070 | sl6: dec hl 1071 | ld a,h 1072 | or l 1073 | jr nz,sl2 1074 | pop ix 1075 | ld a,(noswps) 1076 | or a 1077 | jr nz,sl7 1078 | jr sl1 1079 | 1080 | ;.cseg 1081 | 1082 | generatetrees: 1083 | ld l,(ix + _entries) 1084 | ld h,(ix + _entries + 1) 1085 | ld c,l 1086 | ld b,h 1087 | push ix 1088 | pop de 1089 | add hl,hl 1090 | add hl,hl 1091 | add hl,de 1092 | push hl 1093 | pop iy 1094 | xor a 1095 | ld d,a 1096 | ld e,a 1097 | ld h,a 1098 | ld l,a 1099 | ld (lbl),a 1100 | gt1: ld a,b 1101 | or c 1102 | ret z 1103 | dec bc 1104 | add hl,de 1105 | ld a,(lbl) 1106 | cp (iy + _bitlength) 1107 | jr z,gt2 1108 | ld a,(iy + _bitlength) 1109 | ld (lbl),a 1110 | sub 16 1111 | ex de,hl 1112 | ld hl,1 1113 | jr z,gt3 1114 | gt4: add hl,hl 1115 | inc a 1116 | jr nz,gt4 1117 | gt3: ex de,hl 1118 | gt2: ld (iy + _code),l 1119 | ld (iy + _code + 1),h 1120 | push de 1121 | ld de,-4 1122 | add iy,de 1123 | pop de 1124 | jr gt1 1125 | 1126 | ldtrees: 1127 | ld a,(gpbf) 1128 | rra 1129 | ld l,a 1130 | and 1 1131 | add a,6 1132 | ld (dictb),a 1133 | ld a,l 1134 | rra 1135 | and 1 1136 | ld (ltp),a 1137 | set 1,a 1138 | ld (mml),a 1139 | ld ix,lit_tree 1140 | ld hl,256 1141 | call nz,ld_tree 1142 | ld hl,64 1143 | ld ix,len_tree 1144 | call ld_tree 1145 | ld hl,64 1146 | ld ix,dist_tre 1147 | 1148 | ld_tree: 1149 | ld (ix + _entries),l 1150 | ld (ix + _entries + 1),h 1151 | call readlengths 1152 | call sortlengths 1153 | call generatetrees 1154 | 1155 | reversebits: 1156 | push ix 1157 | pop hl 1158 | ld e,(hl) 1159 | inc hl 1160 | ld d,(hl) 1161 | rb1: inc hl 1162 | inc hl 1163 | inc hl 1164 | ld c,(hl) 1165 | ld b,8 1166 | rb2: srl c 1167 | adc a,a 1168 | djnz rb2 1169 | push af 1170 | inc hl 1171 | ld c,(hl) 1172 | ld b,8 1173 | rb3: srl c 1174 | adc a,a 1175 | djnz rb3 1176 | dec hl 1177 | ld (hl),a 1178 | pop af 1179 | inc hl 1180 | ld (hl),a 1181 | dec de 1182 | ld a,d 1183 | or e 1184 | jr nz,rb1 1185 | ret 1186 | 1187 | readtree: 1188 | push ix 1189 | pop iy 1190 | ld de,4 1191 | add iy,de 1192 | ld b,d 1193 | ld e,d 1194 | ld h,d 1195 | ld l,d 1196 | rt1: push hl 1197 | push de 1198 | push bc 1199 | ld a,1 1200 | call readbits 1201 | pop af 1202 | push af 1203 | or a 1204 | jr z,rt2 1205 | rt3: add hl,hl 1206 | dec a 1207 | jr nz,rt3 1208 | rt2: pop bc 1209 | pop de 1210 | add hl,de 1211 | ex de,hl 1212 | inc b 1213 | pop hl 1214 | rt4: ld a,(iy + _bitlength) 1215 | cp b 1216 | jr nc,rt5 1217 | push de 1218 | ld de,4 1219 | add iy,de 1220 | pop de 1221 | inc hl 1222 | ld a,(ix + _entries) 1223 | sub l 1224 | jr nz,rt4 1225 | ld a,(ix + _entries + 1) 1226 | sub h 1227 | jr nz,rt4 1228 | rt6: dec a 1229 | ret 1230 | rt5: ld a,(iy + _bitlength) 1231 | cp b 1232 | jr nz,rt1 1233 | ld a,(iy + _code) 1234 | cp e 1235 | jr nz,rt7 1236 | ld a,(iy + _code + 1) 1237 | cp d 1238 | jr nz,rt7 1239 | ld a,(iy + _value) 1240 | ret 1241 | rt7: push de 1242 | ld de,4 1243 | add iy,de 1244 | pop de 1245 | inc hl 1246 | ld a,(ix + _entries) 1247 | sub l 1248 | jr nz,rt5 1249 | ld a,(ix + _entries + 1) 1250 | sub h 1251 | jr nz,rt5 1252 | jr rt6 1253 | 1254 | unimplode: 1255 | call ldtrees 1256 | ui1: ld a,(zipeof) 1257 | and 1 1258 | ret nz 1259 | inc a 1260 | call readbits 1261 | or a 1262 | jr z,ui2 1263 | ld a,(ltp) 1264 | or a 1265 | jr z,ui3 1266 | ld ix,lit_tree 1267 | call readtree 1268 | jr ui4 1269 | ui3: ld a,8 1270 | call readbits 1271 | ui4: call outb 1272 | jr ui1 1273 | ui2: ld a,(dictb) 1274 | call readbits 1275 | push hl 1276 | ld ix,dist_tre 1277 | call readtree 1278 | ld bc,(dictb - 1) 1279 | ui5: add hl,hl 1280 | djnz ui5 1281 | pop bc 1282 | add hl,bc 1283 | push hl 1284 | ld ix,len_tree 1285 | call readtree 1286 | ld l,a 1287 | ld h,0 1288 | cp 63 1289 | jr nz,ui6 1290 | push hl 1291 | ld a,8 1292 | call readbits 1293 | pop de 1294 | add hl,de 1295 | ui6: ld de,(mml) 1296 | ld d,0 1297 | add hl,de 1298 | ld b,h 1299 | ld c,l 1300 | pop hl 1301 | inc hl 1302 | call callback 1303 | jr ui1 1304 | 1305 | ;====================== 1306 | ; DSEG 1307 | ;.dseg 1308 | zipeof: db 2 1309 | counting: 1310 | db 0 1311 | ;.dseg 1312 | init: 1313 | ;.dseg 1314 | db 0 1315 | ;.dseg 1316 | db 0 1317 | ;.dseg 1318 | dw 0,0 1319 | ;.dseg 1320 | dw -1,-1 1321 | endinit: 1322 | ;.dseg 1323 | readpt: db 0 1324 | ;.dseg 1325 | _L_table: 1326 | db 7fh, 3fh, 1fh, 0fh 1327 | 1328 | _D_shift: 1329 | db 07h, 06h, 05h, 04h 1330 | 1331 | 1332 | 1333 | 1334 | ;.useg 1335 | mode: ds 1 1336 | ;.useg 1337 | junk: ds STRSIZ 1338 | ;.useg 1339 | lfh: 1340 | vnte: ds 2 1341 | gpbf: ds 2 1342 | cm: ds 2 1343 | lmft: ds 2 1344 | lmfd: ds 2 1345 | crc: ds 4 1346 | cs: ds 4 1347 | ucs: ds 4 1348 | fnl: ds 2 1349 | efl: ds 2 1350 | endlfh: 1351 | ds 1 1352 | ;.useg 1353 | opfcb: ds 1 1354 | opfn: ds 8 1355 | opext: ds 3 1356 | ds 4 + 16 + 1 1357 | ;.useg 1358 | bitbuf: ds 1 1359 | 1360 | ;.useg 1361 | vars: 1362 | ;.useg 1363 | bleft: ds 1 1364 | ;.useg 1365 | wrtpt: ds 1 1366 | ;.useg 1367 | outpos: ds 4 1368 | ;.useg 1369 | crc32: 1370 | ds 4 1371 | ;.useg 1372 | curmode: 1373 | ds 1 1374 | ;.useg 1375 | opbuf: ds 128 1376 | ;.useg 1377 | L_table: 1378 | ds 1 1379 | D_shift: 1380 | ds 1 1381 | 1382 | ;.useg 1383 | V: ds 1 1384 | nchar: ds 1 1385 | lchar: ds 1 1386 | ExState: 1387 | ds 1 1388 | Len: ds 2 1389 | ;.useg 1390 | ltp: ds 1 1391 | mml: ds 1 1392 | dictb: ds 1 1393 | noswps: ds 1 1394 | ;.useg 1395 | entrs: ds 2 1396 | ;.useg 1397 | lbl: ds 1 1398 | 1399 | 1400 | 1401 | 1402 | ;.useg 1403 | oldcode: 1404 | ds 2 1405 | offset: 1406 | ds 2 1407 | codesize: 1408 | ds 1 1409 | maxcode: 1410 | ds 2 1411 | free_ent: 1412 | ds 2 1413 | finchar: 1414 | ds 1 1415 | stackp: 1416 | ds 2 1417 | incode: 1418 | ds 2 1419 | code: 1420 | ds 2 1421 | 1422 | outbuf: 1423 | suffix_of: 1424 | ds 8192 1425 | 1426 | prefix_of: 1427 | Slen: 1428 | lit_tree: 1429 | ds _sf_tree_ 1430 | len_tree: 1431 | ds _sf_tree_ 1432 | dist_tre: 1433 | ds _sf_tree_ 1434 | 1435 | ds 16384 + 2 - [3 * _sf_tree_] 1436 | 1437 | followers: 1438 | stack: 1439 | ds 16384 1440 | -------------------------------------------------------------------------------- /unzip/UNZIP121.Z80: -------------------------------------------------------------------------------- 1 | ; UNZIP.Z80 2 | ; 3 | ; Version 1.2-1 -- June 17, 2020 -- Martin 4 | ; 5 | ; In postings to the USENET newsgroup comp.os.cpm, flaws in both 6 | ; the un-implode and un-shrink routines have been reported and 7 | ; fixed. 8 | ; 9 | ; For un-implode, the algorithm is essentially a translation 10 | ; of the PKZ101 MS-DOS algorithm in C that has been hand-optimized 11 | ; into Z80 assemble language. However, the readtree() function 12 | ; was incorrectly returning a buye value in the A register, when 13 | ; the shift routine at label ui5 was expecting a 16-bit value in HL. 14 | ; 15 | ; For un-shrink, these was a race condition with the handling of the 16 | ; "KwKwK" case that was omitted from the routine. 17 | ; 18 | ; Both updates are flagged with ;;v1.2-1 comments, and the version 19 | ; sign-on message now includes this revision number. 20 | 21 | 22 | ; Version 1.2 -- July 3, 1990 -- David P. Goodenough 23 | ; 24 | ; This file has been converted to assemble with SLR's Z80ASM, resulting 25 | ; in a COM file identical to the 1.2 release version. 26 | ; Gene Pizzetta, May 11, 1991 27 | ; 28 | CR equ 0Dh 29 | LF equ 0Ah 30 | CtrlZ equ 1Ah 31 | 32 | STRSIZ equ 256 33 | EXTRACT equ 'E' 34 | bdos equ 5 35 | open equ 0fh 36 | close equ 10h 37 | read equ 14h 38 | write equ 15h 39 | create equ 16h 40 | setdma equ 1ah 41 | infcb equ 5ch 42 | DLE equ 144 43 | max_bits equ 13 44 | init_bits equ 9 45 | hsize equ 8192 46 | first_ent equ 257 47 | clear equ 256 48 | maxcmax equ 1 shl max_bits 49 | 50 | maxSF equ 256 51 | 52 | _code equ 0 53 | _value equ 2 54 | _bitlength equ 3 55 | 56 | _entries equ 0 57 | _maxlength equ 2 58 | _entry equ 4 59 | 60 | _sf_tree_ equ 4 + 4 * maxSF 61 | 62 | 63 | jr start 64 | db CR 65 | usage: db 'Usage: UNZIP ZIPFILE [E]',CR,LF 66 | db 'E - extract files',CR,LF 67 | db ' default is to just list files',CR,LF,0,CtrlZ 68 | start: ld sp,(6) ; set the stack pointer 69 | call ilprt 70 | db 'UNZIP V1.2-1 - DPG 1990',CR,LF,LF,0 ;;v1.2-1 71 | ld a,(5dh) ; filename? 72 | cp ' ' 73 | jr nz,wasfil 74 | ld hl,usage 75 | call pstr 76 | rst 0 77 | wasfil: ld a,(6dh) ; option letter? 78 | ;.cseg 79 | xor EXTRACT ; 'E' for extract 80 | ld (mode),a ; set the mode 81 | ld a,(65h) 82 | cp 20h 83 | jr nz,wasext 84 | ld hl,'Z' + ('I' shl 8) ;;v1.2-1 'IZ' in HL 85 | ld (65h),hl 86 | ld a,'P' 87 | ld (67h),a ; install .ZIP extent 88 | wasext: ld de,5ch 89 | ld c,open 90 | call bdos ; try and open it 91 | inc a 92 | jr nz,openok ; ok 93 | call ilprt 94 | db 'Couldn''t find ZIP file',CR,LF,0 95 | rst 0 ; complain and exit 96 | sigerr: call ilprt 97 | db 'Bad signature in ZIP file',CR,LF,0 98 | rst 0 99 | openok: call getword 100 | ld de,-(('K' shl 8) + 'P') 101 | add hl,de 102 | ld a,h 103 | or l 104 | jr nz,sigerr 105 | call getword 106 | dec l 107 | jr nz,nocfhs 108 | dec h 109 | dec h 110 | jr nz,sigerr 111 | call pcfh 112 | jr openok 113 | nocfhs: dec l 114 | dec l 115 | jr nz,nolfhs 116 | ld a,h 117 | sub 4 118 | jr nz,sigerr 119 | call plfh 120 | jr openok 121 | nolfhs: dec l 122 | dec l 123 | jr nz,sigerr 124 | ld a,h 125 | sub 6 126 | jr nz,sigerr 127 | call pecd 128 | rst 0 129 | 130 | pcfh: ld b,12 131 | pcfhl1: push bc 132 | call getword 133 | pop bc 134 | djnz pcfhl1 135 | call getword 136 | push hl 137 | call getword 138 | push hl 139 | call getword 140 | pop de 141 | pop bc 142 | push hl 143 | push de 144 | push bc 145 | ld b,6 146 | pcfhl2: push bc 147 | call getword 148 | pop bc 149 | djnz pcfhl2 150 | pop hl 151 | ld de,junk 152 | ;.cseg 153 | call getstring 154 | pop hl 155 | ld de,junk 156 | call getstring 157 | pop hl 158 | ld de,junk 159 | call getstring 160 | ret 161 | 162 | pecd: ld b,8 163 | pecdl: push bc 164 | call getword 165 | pop bc 166 | djnz pecdl 167 | call getword 168 | ld de,junk 169 | call getstring 170 | ret 171 | 172 | ;.cseg 173 | 174 | plfh: ld de,lfh 175 | ld hl,endlfh-lfh 176 | ; ld hl,{endlfh - lfh} 177 | call getstring 178 | ld hl,opfcb 179 | ld de,opfcb + 1 180 | ld bc,32 181 | ld (hl),b 182 | ldir 183 | ;.cseg 184 | ld de,junk 185 | ld hl,(fnl) 186 | call getstring 187 | ld de,junk + 20 188 | ld hl,(efl) 189 | call getstring 190 | ld de,junk 191 | ld hl,opfn 192 | ld b,8 193 | call scanfn 194 | ld a,(de) 195 | cp '.' 196 | jr nz,nodot 197 | inc de 198 | nodot: ld b,3 199 | call scanfn 200 | ld hl,init 201 | ld de,vars 202 | ld bc,endinit-init 203 | ; ld bc,{endinit - init} 204 | ldir 205 | ;.cseg 206 | 207 | ld a,(mode) 208 | resmod: ld (curmode),a 209 | or a 210 | jr nz,extrct 211 | ld de,opfcb 212 | ld c,0fh 213 | call bdos 214 | inc a 215 | jr z,creok 216 | ld hl,junk 217 | call pstr 218 | call ilprt 219 | db ' already exists',0 220 | noex: call ilprt 221 | db ' -- not extracting',0 222 | ld a,0ffh 223 | jr resmod 224 | extrct: xor a 225 | ld (zipeof),a 226 | ld a,(curmode) 227 | dec a 228 | jp m,doext 229 | call ilprt 230 | db 'Checking ',0 231 | jr pjunk 232 | creok: ld de,opfcb 233 | ld c,create 234 | call bdos 235 | inc a 236 | jr nz,opnok1 237 | call ilprt 238 | db 'Error creating ',0 239 | ld hl,junk 240 | call pstr 241 | jr noex 242 | opnok1: call ilprt 243 | db 'Extracting ',0 244 | pjunk: ld hl,junk 245 | call pstr 246 | doext: call ilprt 247 | db ' -- ',0 248 | ld hl,counting 249 | inc (hl) 250 | ld a,(cm) 251 | or a 252 | jr nz,case1 253 | case0w: ld a,(zipeof) 254 | and 1 255 | jr nz,closeo 256 | savcs0: call getbyte 257 | call outbyte 258 | jr case0w 259 | case1: dec a 260 | jr nz,case2p 261 | call unshrink 262 | jr closeo 263 | case2p: dec a 264 | cp 4 265 | jr nc,tryimp 266 | call unreduce 267 | jr closeo 268 | tryimp: jr nz,badzip 269 | call unimplode 270 | jr closeo 271 | badzip: call ilprt 272 | db 'Unknown compression method',CR,LF,0 273 | ret 274 | closeo: ld hl,zipeof 275 | dec (hl) 276 | inc hl 277 | dec (hl) 278 | ld a,(mode) 279 | or a 280 | jr nz,nocls 281 | ld hl,wrtpt 282 | ld a,(hl) 283 | or a 284 | jr z,noflsh 285 | ld de,opbuf 286 | ;.cseg 287 | ld c,setdma 288 | call bdos 289 | ld de,opfcb 290 | ld c,write 291 | call bdos 292 | noflsh: ld de,opfcb 293 | ld c,close 294 | call bdos 295 | nocls: ld hl,crc32 296 | ld de,crc 297 | scf 298 | ld bc,4 shl 8 299 | crcclp: ld a,(de) 300 | adc a,(hl) 301 | push af 302 | or c 303 | ld c,a 304 | pop af 305 | inc hl 306 | inc de 307 | djnz crcclp 308 | ld a,c 309 | or a 310 | jr z,crcok 311 | call ilprt 312 | db 'CRC error',CR,LF,0 313 | ret 314 | crcok: call ilprt 315 | db 'CRC OK',CR,LF,0 316 | ret 317 | 318 | getchla: 319 | call getcode 320 | ld (code),hl 321 | ld a,(zipeof) 322 | and 1 323 | ret 324 | 325 | savstk: 326 | ld hl,(stackp) 327 | dec hl 328 | ld (stackp),hl 329 | ld (hl),a 330 | ret 331 | 332 | getcode: 333 | ld a,(codesize) 334 | readbits: 335 | ld hl,8000h 336 | bitlp: push af 337 | push hl 338 | getbit: ld hl,bleft 339 | dec (hl) 340 | jp m,readbt 341 | dec hl 342 | rr (hl) 343 | pop hl 344 | rr h 345 | rr l 346 | pop af 347 | dec a 348 | jr nz,bitlp 349 | finbit: srl h 350 | rr l 351 | jr nc,finbit 352 | ld a,l 353 | ret 354 | readbt: push hl 355 | call getbyte 356 | pop hl 357 | ld (hl),8 358 | dec hl 359 | ld (hl),a 360 | jr getbit 361 | 362 | scanfn: ld a,(de) 363 | cp '.' 364 | jr z,nocopy 365 | or a 366 | jr z,nocopy 367 | inc de 368 | dec b 369 | jp m,scanfn 370 | ld (hl),a 371 | inc hl 372 | jr scanfn 373 | nocopy: dec b 374 | ret m 375 | ld (hl),' ' 376 | inc hl 377 | jr nocopy 378 | 379 | ilprt: pop hl 380 | call pstr 381 | jp (hl) 382 | 383 | pstr: ld a,(hl) 384 | or a 385 | ret z 386 | push hl 387 | ld e,a 388 | ld c,2 389 | call bdos 390 | pop hl 391 | inc hl 392 | jr pstr 393 | 394 | getstring: 395 | ld a,h 396 | or l 397 | ld (de),a 398 | ret z 399 | push de 400 | push hl 401 | call getbyte 402 | pop hl 403 | pop de 404 | ld (de),a 405 | inc de 406 | dec hl 407 | jr getstring 408 | 409 | getword: 410 | call getbyte 411 | push af 412 | call getbyte 413 | pop hl 414 | ld l,h 415 | ld h,a 416 | ret 417 | 418 | getbyte: 419 | ld a,(zipeof) 420 | and 1 421 | ld a,CtrlZ 422 | ret nz 423 | ld a,(counting) 424 | or a 425 | jr z,skpdci 426 | ld hl,(cs) 427 | ld de,(cs + 2) 428 | ld a,d 429 | or e 430 | or h 431 | or l 432 | jr nz,noteof 433 | ld hl,zipeof 434 | inc (hl) 435 | ld a,CtrlZ 436 | ret 437 | noteof: ld a,h 438 | or l 439 | dec hl 440 | ld (cs),hl 441 | jr nz,skpdci 442 | dec de 443 | ld (cs + 2),de 444 | skpdci: ld hl,readpt 445 | ;.cseg 446 | ld a,(hl) 447 | or a 448 | jr nz,ptok 449 | ld de,80h 450 | ld (hl),e 451 | push hl 452 | ld c,setdma 453 | call bdos 454 | ld de,infcb 455 | ld c,read 456 | call bdos 457 | or a 458 | pop hl 459 | jr nz,ateof 460 | ptok: ld a,(hl) 461 | inc (hl) 462 | ld l,a 463 | ld h,0 464 | ld a,(hl) 465 | ret 466 | ateof: ld a,CtrlZ 467 | ret 468 | 469 | outb: 470 | ld hl,(outpos) 471 | push hl 472 | push af 473 | ld a,h 474 | and 1fh 475 | ld h,a 476 | pop af 477 | ld de,outbuf 478 | add hl,de 479 | ld (hl),a 480 | pop hl 481 | inc hl 482 | ld (outpos),hl 483 | push af 484 | ld a,h 485 | or l 486 | jr nz,nopos 487 | ld hl,(outpos + 2) 488 | inc hl 489 | ld (outpos + 2),hl 490 | nopos: pop af 491 | 492 | outbyte: 493 | push af 494 | call updcrc 495 | ld hl,(ucs) 496 | ld de,(ucs + 2) 497 | ld a,h 498 | or l 499 | dec hl 500 | ld (ucs),hl 501 | jr nz,tsthl0 502 | dec de 503 | ld (ucs + 2),de 504 | tsthl0: ld a,h 505 | or l 506 | or d 507 | or e 508 | jr nz,noeof 509 | ld hl,zipeof 510 | inc (hl) 511 | noeof: ld a,(mode) 512 | or a 513 | jr nz,popret 514 | ld hl,wrtpt 515 | ld a,(hl) 516 | add a,a 517 | jr nc,wptok 518 | ld de,opbuf 519 | ld c,setdma 520 | call bdos 521 | ld de,opfcb 522 | ld c,write 523 | call bdos 524 | or a 525 | jr z,wptok 526 | ld (mode),a 527 | call ilprt 528 | db 'Write Error',CR,LF,0 529 | popret: pop af 530 | ret 531 | wptok: jr nz,nofilb 532 | ld hl,opbuf 533 | ld de,opbuf + 1 534 | ld bc,127 535 | ld (hl),CtrlZ 536 | ldir 537 | xor a 538 | ld (wrtpt),a 539 | nofilb: pop af 540 | ld hl,wrtpt 541 | inc (hl) 542 | ld l,(hl) 543 | ld h,0 544 | ld de,opbuf - 1 545 | add hl,de 546 | ld (hl),a 547 | ret 548 | 549 | updcrc: ld hl,(crc32) 550 | ld de,(crc32 + 2) 551 | ld c,a 552 | ld b,8 553 | crclp: ld a,l 554 | xor c 555 | srl c 556 | srl d 557 | rr e 558 | rr h 559 | rr l 560 | rra 561 | jr nc,noxor 562 | ld a,d 563 | xor 0edh 564 | ld d,a 565 | ld a,e 566 | xor 0b8h 567 | ld e,a 568 | ld a,h 569 | xor 83h 570 | ld h,a 571 | ld a,l 572 | xor 20h 573 | ld l,a 574 | noxor: djnz crclp 575 | ld (crc32),hl 576 | ld (crc32 + 2),de 577 | ret 578 | 579 | unshrink: 580 | ld a,init_bits 581 | ld (codesize),a 582 | ld hl,-1 + (1 shl init_bits) 583 | ld (maxcode),hl 584 | ld hl,first_ent 585 | ld (free_ent),hl 586 | ld hl,prefix_of 587 | ld de,prefix_of + 1 588 | ld bc,512 589 | ld (hl),c 590 | ldir 591 | ld bc,16386 - 512 592 | ld (hl),-1 593 | ldir 594 | ld hl,suffix_of 595 | sol: ld (hl),c 596 | inc hl 597 | inc c 598 | jr nz,sol 599 | call getchla 600 | ld (oldcode),hl 601 | ret nz 602 | ld a,l 603 | ld (finchar),a 604 | call outbyte 605 | unshlp: ld hl,stack + 8192 606 | ld (stackp),hl 607 | ld a,(zipeof) 608 | and 1 609 | ret nz 610 | clrlp: call z,getchla 611 | ret nz 612 | ld a,h 613 | dec a 614 | or l 615 | jr nz,noclr 616 | call getchla 617 | ld a,h 618 | or a 619 | jr nz,clrlp 620 | dec l 621 | jr z,bumpcs 622 | dec l 623 | call z,partial_clear 624 | jr clrlp 625 | bumpcs: ld hl,codesize 626 | inc (hl) 627 | ld a,(hl) 628 | cp max_bits 629 | ld hl,maxcmax 630 | jr z,atmax 631 | ld hl,1 632 | maxclp: add hl,hl 633 | dec a 634 | jr nz,maxclp 635 | dec hl 636 | atmax: ld (maxcode),hl 637 | jr clrlp 638 | ; 639 | noclr: ld (incode),hl ;;v1.2-1 start unshrink fix 640 | add hl,hl 641 | ld de,prefix_of 642 | add hl,de 643 | ld a,(hl) 644 | inc hl 645 | and (hl) 646 | inc a 647 | ld hl,(code) 648 | jr nz,noKwKw 649 | ld a,(finchar) 650 | call savstk 651 | ld hl,(oldcode) 652 | noKwKw: ex de,hl 653 | ; 654 | staklp: ld hl,100h 655 | or a 656 | sbc hl,de 657 | jr nc,unstak 658 | ld hl,prefix_of 659 | add hl,de 660 | add hl,de 661 | ld a,(hl) 662 | inc hl 663 | and (hl) 664 | inc a 665 | jr nz,noKw2 666 | ld a,(finchar) 667 | call savstk 668 | ld de,(oldcode) 669 | jr staklp 670 | ; 671 | noKw2: ld hl,suffix_of 672 | add hl,de 673 | ld a,(hl) 674 | call savstk 675 | ld hl,prefix_of 676 | add hl,de 677 | add hl,de 678 | ld e,(hl) 679 | inc hl 680 | ld d,(hl) 681 | jr staklp 682 | ; 683 | unstak: ld hl,suffix_of 684 | add hl,de 685 | ld a,(hl) 686 | call savstk 687 | ld (finchar),a ;;v1.2-1 end of unshrink fix 688 | ld de,(stackp) 689 | unslp: ld hl,stack + 8192 690 | or a 691 | sbc hl,de 692 | jr z,newent 693 | ld a,(de) 694 | inc de 695 | push de 696 | call outbyte 697 | pop de 698 | jr unslp 699 | newent: ld hl,(free_ent) 700 | ld (code),hl 701 | ex de,hl 702 | ld hl,1fffh 703 | or a 704 | sbc hl,de 705 | jr c,full 706 | ld hl,prefix_of 707 | add hl,de 708 | add hl,de 709 | ld bc,(oldcode) 710 | ld (hl),c 711 | inc hl 712 | ld (hl),b 713 | ld hl,suffix_of 714 | add hl,de 715 | ld a,(finchar) 716 | ld (hl),a 717 | getfre: inc de 718 | ld hl,1fffh 719 | or a 720 | sbc hl,de 721 | jr c,full1 722 | ld hl,prefix_of 723 | add hl,de 724 | add hl,de 725 | ld a,(hl) 726 | inc hl 727 | and (hl) 728 | inc a 729 | jr nz,getfre 730 | full1: ld (free_ent),de 731 | full: ld hl,(incode) 732 | ld (oldcode),hl 733 | jp unshlp 734 | 735 | partial_clear: 736 | ld de,first_ent 737 | l8: ld hl,(free_ent) 738 | or a 739 | sbc hl,de 740 | jr z,br8 741 | ld hl,prefix_of + 1 742 | add hl,de 743 | add hl,de 744 | set 7,(hl) 745 | inc de 746 | jr l8 747 | br8: ld de,first_ent 748 | l9: ld hl,(free_ent) 749 | or a 750 | sbc hl,de 751 | jr z,br9 752 | ld hl,prefix_of 753 | add hl,de 754 | add hl,de 755 | push de 756 | ld e,(hl) 757 | inc hl 758 | ld d,(hl) 759 | res 7,d 760 | ld hl,first_ent - 1 761 | or a 762 | sbc hl,de 763 | jr nc,ei10 764 | ld hl,prefix_of + 1 765 | add hl,de 766 | add hl,de 767 | res 7,(hl) 768 | ei10: pop de 769 | inc de 770 | jr l9 771 | br9: ld de,first_ent 772 | l10: ld hl,(free_ent) 773 | or a 774 | sbc hl,de 775 | jr z,br10 776 | ld hl,prefix_of + 1 777 | add hl,de 778 | add hl,de 779 | bit 7,(hl) 780 | jr z,ei11 781 | ld (hl),-1 782 | dec hl 783 | ld (hl),-1 784 | ei11: inc de 785 | jr l10 786 | br10: ld de,first_ent 787 | l11: ld hl,maxcmax 788 | or a 789 | sbc hl,de 790 | jr z,br11 791 | ld hl,prefix_of 792 | add hl,de 793 | add hl,de 794 | ld a,(hl) 795 | inc hl 796 | and (hl) 797 | inc a 798 | jr z,br11 799 | inc de 800 | jr l11 801 | br11: ld (free_ent),de 802 | ret 803 | 804 | loadfollowers: 805 | ld hl,Slen + 255 806 | ld b,0 807 | lflp: push bc 808 | push hl 809 | ld a,6 810 | call readbits 811 | pop hl 812 | pop de 813 | ld (hl),a 814 | push de 815 | push hl 816 | dec d 817 | ld hl,followers 818 | call shftadd 819 | ld b,a 820 | or a 821 | jr z,nofoll 822 | ldfllp: push hl 823 | push bc 824 | ld a,8 825 | call readbits 826 | pop bc 827 | pop hl 828 | ld (hl),a 829 | inc hl 830 | djnz ldfllp 831 | nofoll: pop hl 832 | pop bc 833 | dec hl 834 | djnz lflp 835 | ret 836 | ;.cseg 837 | 838 | unreduce: 839 | 840 | ;.cseg 841 | ld e,a 842 | ld d,0 843 | ld hl,_L_table 844 | add hl,de 845 | ld a,(hl) 846 | ld (L_table),a 847 | ld hl,_D_shift 848 | add hl,de 849 | ld a,(hl) 850 | ld (D_shift),a 851 | xor a 852 | ld (ExState),a 853 | ld (lchar),a 854 | call loadfollowers 855 | ur1: ld a,(zipeof) 856 | and 1 857 | ret nz 858 | call slenlch 859 | or a 860 | jr nz,ur2 861 | ur4: ld a,8 862 | call readbits 863 | jr ur3 864 | ur2: ld a,1 865 | call readbits 866 | dec l 867 | jr z,ur4 868 | call slenlch 869 | dec a 870 | or 1 871 | ld l,a 872 | xor a 873 | btlp: inc a 874 | srl l 875 | jr nz,btlp 876 | call readbits 877 | ld de,followers 878 | add hl,de 879 | ld de,(lchar - 1) 880 | call shftadd 881 | ld a,(hl) 882 | ur3: ld (nchar),a 883 | ld l,a 884 | ld a,(ExState) 885 | or a 886 | jr nz,ur5 887 | ld a,l 888 | cp DLE 889 | jr nz,ur9 890 | ld a,1 891 | ld (ExState),a 892 | jr ur6 893 | ur5: dec a 894 | jr nz,ur7 895 | ld a,l 896 | or a 897 | jr z,ur10 898 | ld (V),a 899 | ld a,(L_table) 900 | ld h,a 901 | and l 902 | cp h 903 | ld l,a 904 | ld h,0 905 | ld (Len),hl 906 | jr nz,ur12 907 | ld a,2 908 | jr ur11 909 | ur10: ld (ExState),a 910 | ld a,DLE 911 | ur9: call outb 912 | jr ur6 913 | ur7: dec a 914 | jr nz,ur8 915 | ld a,l 916 | ld hl,Len 917 | add a,(hl) 918 | ld (hl),a 919 | jr nc,ur12 920 | inc hl 921 | inc (hl) 922 | ur12: ld a,3 923 | jr ur11 924 | ur8: dec a 925 | jr nz,ur13 926 | ld a,(D_shift) 927 | ld b,a 928 | ld a,(V) 929 | ur14: srl a 930 | djnz ur14 931 | ld h,a 932 | inc hl 933 | ld bc,(Len) 934 | inc bc 935 | inc bc 936 | inc bc 937 | call callback 938 | ur13: xor a 939 | ur11: ld (ExState),a 940 | ur6: ld a,(nchar) 941 | ld (lchar),a 942 | jp ur1 943 | 944 | slenlch: 945 | ld hl,(lchar) 946 | ld h,0 947 | ld de,Slen 948 | add hl,de 949 | ld a,(hl) 950 | ret 951 | 952 | shftadd: 953 | ld e,0 954 | srl d 955 | rr e 956 | srl d 957 | rr e 958 | add hl,de 959 | ret 960 | 961 | callback: 962 | push bc 963 | push hl 964 | ld hl,(outpos) 965 | ld de,(outpos + 2) 966 | pop bc 967 | or a 968 | sbc hl,bc 969 | jr nc,cb2 970 | dec de 971 | cb2: pop bc 972 | cb3: bit 7,d 973 | jr z,cb4 974 | ld a,b 975 | or c 976 | jr z,cb4 977 | xor a 978 | call outbp 979 | inc hl 980 | ld a,h 981 | or l 982 | jr nz,cb5 983 | inc de 984 | cb5: dec bc 985 | jr cb3 986 | cb4: ex de,hl 987 | cb6: ld a,b 988 | or c 989 | ret z 990 | ld a,d 991 | and 1fh 992 | ld d,a 993 | ld hl,outbuf 994 | add hl,de 995 | ld a,(hl) 996 | call outbp 997 | inc de 998 | dec bc 999 | jr cb6 1000 | 1001 | outbp: push hl 1002 | push de 1003 | push bc 1004 | call outb 1005 | pop bc 1006 | pop de 1007 | pop hl 1008 | ret 1009 | 1010 | ;.cseg 1011 | 1012 | readlengths: 1013 | ld a,8 1014 | call readbits 1015 | ld d,h 1016 | ld e,d 1017 | inc hl 1018 | ld b,h 1019 | ld c,l 1020 | ld (ix + _maxlength),e 1021 | ld (ix + _maxlength + 1),d 1022 | push ix 1023 | pop hl 1024 | inc hl 1025 | inc hl 1026 | inc hl 1027 | rl1: ld a,b 1028 | or c 1029 | ret z 1030 | push bc 1031 | push de 1032 | push hl 1033 | ld a,4 1034 | call readbits 1035 | inc a 1036 | push af 1037 | ld a,4 1038 | call readbits 1039 | inc a 1040 | ld b,a 1041 | pop af 1042 | ld c,a 1043 | pop hl 1044 | pop de 1045 | ld a,(ix + _maxlength) 1046 | cp c 1047 | jr nc,rl2 1048 | ld (ix + _maxlength),c 1049 | rl2: inc hl 1050 | inc hl 1051 | inc hl 1052 | ld (hl),e 1053 | inc hl 1054 | ld (hl),c 1055 | inc e 1056 | djnz rl2 1057 | pop bc 1058 | dec bc 1059 | jr rl1 1060 | 1061 | sortlengths: 1062 | ld h,(ix + _entries + 1) 1063 | ld l,(ix + _entries) 1064 | ld b,h 1065 | ld c,l 1066 | ld (entrs),hl 1067 | ;.cseg 1068 | sl7: srl b 1069 | rr c 1070 | sl1: ld a,b 1071 | or c 1072 | ret z 1073 | ld (noswps),a 1074 | push ix 1075 | ld de,4 1076 | add ix,de 1077 | push ix 1078 | pop iy 1079 | add iy,bc 1080 | add iy,bc 1081 | add iy,bc 1082 | add iy,bc 1083 | ld hl,(entrs) 1084 | or a 1085 | sbc hl,bc 1086 | sl2: ld a,(ix + _bitlength) 1087 | cp (iy + _bitlength) 1088 | jr c,sl4 1089 | jr nz,sl3 1090 | ld a,(iy + _value) 1091 | cp (ix + _value) 1092 | jr nc,sl4 1093 | sl3: ld d,e 1094 | sl5: ld a,(ix) 1095 | push af 1096 | ld a,(iy) 1097 | ld (ix),a 1098 | pop af 1099 | ld (iy),a 1100 | inc ix 1101 | inc iy 1102 | dec d 1103 | jr nz,sl5 1104 | ld a,d 1105 | ld (noswps),a 1106 | jr sl6 1107 | sl4: add ix,de 1108 | add iy,de 1109 | sl6: dec hl 1110 | ld a,h 1111 | or l 1112 | jr nz,sl2 1113 | pop ix 1114 | ld a,(noswps) 1115 | or a 1116 | jr nz,sl7 1117 | jr sl1 1118 | 1119 | ;.cseg 1120 | 1121 | generatetrees: 1122 | ld l,(ix + _entries) 1123 | ld h,(ix + _entries + 1) 1124 | ld c,l 1125 | ld b,h 1126 | push ix 1127 | pop de 1128 | add hl,hl 1129 | add hl,hl 1130 | add hl,de 1131 | push hl 1132 | pop iy 1133 | xor a 1134 | ld d,a 1135 | ld e,a 1136 | ld h,a 1137 | ld l,a 1138 | ld (lbl),a 1139 | gt1: ld a,b 1140 | or c 1141 | ret z 1142 | dec bc 1143 | add hl,de 1144 | ld a,(lbl) 1145 | cp (iy + _bitlength) 1146 | jr z,gt2 1147 | ld a,(iy + _bitlength) 1148 | ld (lbl),a 1149 | sub 16 1150 | ex de,hl 1151 | ld hl,1 1152 | jr z,gt3 1153 | gt4: add hl,hl 1154 | inc a 1155 | jr nz,gt4 1156 | gt3: ex de,hl 1157 | gt2: ld (iy + _code),l 1158 | ld (iy + _code + 1),h 1159 | push de 1160 | ld de,-4 1161 | add iy,de 1162 | pop de 1163 | jr gt1 1164 | 1165 | ldtrees: 1166 | ld a,(gpbf) 1167 | rra 1168 | ld l,a 1169 | and 1 1170 | add a,6 1171 | ld (dictb),a 1172 | ld a,l 1173 | rra 1174 | and 1 1175 | ld (ltp),a 1176 | set 1,a 1177 | ld (mml),a 1178 | ld ix,lit_tree 1179 | ld hl,256 1180 | call nz,ld_tree 1181 | ld hl,64 1182 | ld ix,len_tree 1183 | call ld_tree 1184 | ld hl,64 1185 | ld ix,dist_tre 1186 | 1187 | ld_tree: 1188 | ld (ix + _entries),l 1189 | ld (ix + _entries + 1),h 1190 | call readlengths 1191 | call sortlengths 1192 | call generatetrees 1193 | 1194 | reversebits: 1195 | push ix 1196 | pop hl 1197 | ld e,(hl) 1198 | inc hl 1199 | ld d,(hl) 1200 | rb1: inc hl 1201 | inc hl 1202 | inc hl 1203 | ld c,(hl) 1204 | ld b,8 1205 | rb2: srl c 1206 | adc a,a 1207 | djnz rb2 1208 | push af 1209 | inc hl 1210 | ld c,(hl) 1211 | ld b,8 1212 | rb3: srl c 1213 | adc a,a 1214 | djnz rb3 1215 | dec hl 1216 | ld (hl),a 1217 | pop af 1218 | inc hl 1219 | ld (hl),a 1220 | dec de 1221 | ld a,d 1222 | or e 1223 | jr nz,rb1 1224 | ret 1225 | 1226 | readtree: 1227 | push ix 1228 | pop iy 1229 | ld de,4 1230 | add iy,de 1231 | ld b,d 1232 | ld e,d 1233 | ld h,d 1234 | ld l,d 1235 | rt1: push hl 1236 | push de 1237 | push bc 1238 | ld a,1 1239 | call readbits 1240 | pop af 1241 | push af 1242 | or a 1243 | jr z,rt2 1244 | rt3: add hl,hl 1245 | dec a 1246 | jr nz,rt3 1247 | rt2: pop bc 1248 | pop de 1249 | add hl,de 1250 | ex de,hl 1251 | inc b 1252 | pop hl 1253 | rt4: ld a,(iy + _bitlength) 1254 | cp b 1255 | jr nc,rt5 1256 | push de 1257 | ld de,4 1258 | add iy,de 1259 | pop de 1260 | inc hl 1261 | ld a,(ix + _entries) 1262 | sub l 1263 | jr nz,rt4 1264 | ld a,(ix + _entries + 1) 1265 | sub h 1266 | jr nz,rt4 1267 | rt6: dec a 1268 | ret 1269 | rt5: ld a,(iy + _bitlength) 1270 | cp b 1271 | jr nz,rt1 1272 | ld a,(iy + _code) 1273 | cp e 1274 | jr nz,rt7 1275 | ld a,(iy + _code + 1) 1276 | cp d 1277 | jr nz,rt7 1278 | ld a,(iy + _value) 1279 | ret 1280 | rt7: push de 1281 | ld de,4 1282 | add iy,de 1283 | pop de 1284 | inc hl 1285 | ld a,(ix + _entries) 1286 | sub l 1287 | jr nz,rt5 1288 | ld a,(ix + _entries + 1) 1289 | sub h 1290 | jr nz,rt5 1291 | jr rt6 1292 | 1293 | unimplode: 1294 | call ldtrees 1295 | ui1: ld a,(zipeof) 1296 | and 1 1297 | ret nz 1298 | inc a 1299 | call readbits 1300 | or a 1301 | jr z,ui2 1302 | ld a,(ltp) 1303 | or a 1304 | jr z,ui3 1305 | ld ix,lit_tree 1306 | call readtree 1307 | jr ui4 1308 | ui3: ld a,8 1309 | call readbits 1310 | ui4: call outb 1311 | jr ui1 1312 | ui2: ld a,(dictb) 1313 | call readbits 1314 | push hl 1315 | ld ix,dist_tre 1316 | call readtree 1317 | ld l,a ;; v1.2-1 unimplode fix 1318 | ld h,0 ;; v1.2-1 1319 | ld bc,(dictb - 1) 1320 | ui5: add hl,hl 1321 | djnz ui5 1322 | pop bc 1323 | add hl,bc 1324 | push hl 1325 | ld ix,len_tree 1326 | call readtree 1327 | ld l,a 1328 | ld h,0 1329 | cp 63 1330 | jr nz,ui6 1331 | push hl 1332 | ld a,8 1333 | call readbits 1334 | pop de 1335 | add hl,de 1336 | ui6: ld de,(mml) 1337 | ld d,0 1338 | add hl,de 1339 | ld b,h 1340 | ld c,l 1341 | pop hl 1342 | inc hl 1343 | call callback 1344 | jr ui1 1345 | 1346 | ;====================== 1347 | ; DSEG 1348 | ;.dseg 1349 | zipeof: db 2 1350 | counting: 1351 | db 0 1352 | ;.dseg 1353 | init: 1354 | ;.dseg 1355 | db 0 1356 | ;.dseg 1357 | db 0 1358 | ;.dseg 1359 | dw 0,0 1360 | ;.dseg 1361 | dw -1,-1 1362 | endinit: 1363 | ;.dseg 1364 | readpt: db 0 1365 | ;.dseg 1366 | _L_table: 1367 | db 7fh, 3fh, 1fh, 0fh 1368 | 1369 | _D_shift: 1370 | db 07h, 06h, 05h, 04h 1371 | 1372 | 1373 | 1374 | 1375 | ;.useg 1376 | mode: ds 1 1377 | ;.useg 1378 | junk: ds STRSIZ 1379 | ;.useg 1380 | lfh: 1381 | vnte: ds 2 1382 | gpbf: ds 2 1383 | cm: ds 2 1384 | lmft: ds 2 1385 | lmfd: ds 2 1386 | crc: ds 4 1387 | cs: ds 4 1388 | ucs: ds 4 1389 | fnl: ds 2 1390 | efl: ds 2 1391 | endlfh: 1392 | ds 1 1393 | ;.useg 1394 | opfcb: ds 1 1395 | opfn: ds 8 1396 | opext: ds 3 1397 | ds 4 + 16 + 1 1398 | ;.useg 1399 | bitbuf: ds 1 1400 | 1401 | ;.useg 1402 | vars: 1403 | ;.useg 1404 | bleft: ds 1 1405 | ;.useg 1406 | wrtpt: ds 1 1407 | ;.useg 1408 | outpos: ds 4 1409 | ;.useg 1410 | crc32: 1411 | ds 4 1412 | ;.useg 1413 | curmode: 1414 | ds 1 1415 | ;.useg 1416 | opbuf: ds 128 1417 | ;.useg 1418 | L_table: 1419 | ds 1 1420 | D_shift: 1421 | ds 1 1422 | 1423 | ;.useg 1424 | V: ds 1 1425 | nchar: ds 1 1426 | lchar: ds 1 1427 | ExState: 1428 | ds 1 1429 | Len: ds 2 1430 | ;.useg 1431 | ltp: ds 1 1432 | mml: ds 1 1433 | dictb: ds 1 1434 | noswps: ds 1 1435 | ;.useg 1436 | entrs: ds 2 1437 | ;.useg 1438 | lbl: ds 1 1439 | 1440 | 1441 | 1442 | 1443 | ;.useg 1444 | oldcode: 1445 | ds 2 1446 | offset: 1447 | ds 2 1448 | codesize: 1449 | ds 1 1450 | maxcode: 1451 | ds 2 1452 | free_ent: 1453 | ds 2 1454 | finchar: 1455 | ds 1 1456 | stackp: 1457 | ds 2 1458 | incode: 1459 | ds 2 1460 | code: 1461 | ds 2 1462 | 1463 | outbuf: 1464 | suffix_of: 1465 | ds 8192 1466 | 1467 | prefix_of: 1468 | Slen: 1469 | lit_tree: 1470 | ds _sf_tree_ 1471 | len_tree: 1472 | ds _sf_tree_ 1473 | dist_tre: 1474 | ds _sf_tree_ 1475 | 1476 | ds 16384 + 2 - (3 * _sf_tree_) 1477 | 1478 | followers: 1479 | stack: 1480 | ds 16384 1481 | 1482 | end 1483 | -------------------------------------------------------------------------------- /unzip/UNZIP15.DOC: -------------------------------------------------------------------------------- 1 | 2 | UNZIP 3 | Version 1.3 4 | 5 | Gene Pizzetta 6 | May 12, 1991 7 | 8 | 9 | UNZIP dissolves MS-DOS ZIP files. This version incorporates some 10 | quick and dirty mods to make a more useful utility. The original 11 | by David Goodenough has to be the most God-awful source code I've 12 | ever come across. It was totally uncommented, and I have no idea 13 | what kind of strange assembler it was written for. This code now 14 | assembles with SLR's Z80ASM and it's a little more orderly. 15 | 16 | USAGE: 17 | 18 | UNZIP {dir:}zipfile {dir:} 19 | 20 | Under ZCPR3 "dir" can be a DU or DIR spec. Under vanilla CP/M 21 | only a drive is recognized. 22 | 23 | If a destination drive is given, member files are extracted to 24 | it. With no destination given, member files are merely checked 25 | and listed to the screen...slowly. 26 | 27 | You can now abort this thing with ^C (and the partial output 28 | file, if any, will be closed and erased). The usage screen now 29 | responds to "//". 30 | 31 | UNZIP still needs a lot of work. It really ought to be possible 32 | to extract member files selectively, but it's all or nothing at 33 | present. In addition, listing files should be a lot faster; 34 | checking CRC's in that mode seems unnecessary. Typing a member 35 | file to the screen would also be a nice enhancement. I have only 36 | limited use for an UNZIP utility, so my purpose here was to do 37 | just enough to make its operation acceptable. Maybe someone else 38 | will interested in going further. In the meantime, Steve 39 | Greenberg's ZIPDIR and Carson Wilson's ZTYPE can fill the gap. 40 | 41 | This version is probably not bullet-proof. Testing has been very 42 | limited, and frankly I don't understand much of the code, but so 43 | far it seems to work. 44 | 45 | Gene Pizzetta 46 | 481 Revere St. 47 | Revere, MA 02151 48 | 49 | Voice: (617) 284-0891 50 | Newton Centre Z-Node: (617) 965-7259 51 | Ladera Z-Node Central: (213) 670-9465 52 | 53 | Version 1.4 modifications by Bruce Morgen, 5/16/91 54 | 55 | In addition to fixing a bug in the ZCPR3 detection code at 56 | "setusr," Version 1.4 adds output filename specification with 57 | wildcards. Now the use of an output d:/dir: and/or an output 58 | filename will trigger extract mode. If the output filespec 59 | contains no wildcards (a d:/dir: alone is equivalent to "*.*"), 60 | UNZIP will now exit after the first extraction (made sense to me, 61 | any objections?). And no, Gene, I am NOT "adopting" UNZIP -- I 62 | just tweaked it far enough that it ceased to annoy me 63 | significantly in the very limited use I have for it... 64 | 65 | Version 1.5 modifications by Howard Goldstein, 6/1/91 66 | 67 | This release contains no new features or options. Its purpose is 68 | merely to correct some serious bugs that were introduced in the 69 | previous version. See the source file for details. 70 | 71 | Like Bruce and Gene, I have no intention of doing any further 72 | develompment on this program. I will, however, attempt to fix 73 | anything that does not work as documented. 74 | -------------------------------------------------------------------------------- /unzip/UNZIP151.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/UNZIP151.COM -------------------------------------------------------------------------------- /unzip/UNZIP152.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/UNZIP152.COM -------------------------------------------------------------------------------- /unzip/UNZIP153.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/UNZIP153.COM -------------------------------------------------------------------------------- /unzip/UNZIP154.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/UNZIP154.COM -------------------------------------------------------------------------------- /unzip/UNZIP155.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/UNZIP155.COM -------------------------------------------------------------------------------- /unzip/UNZIP156.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/UNZIP156.COM -------------------------------------------------------------------------------- /unzip/UNZIP157.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/UNZIP157.COM -------------------------------------------------------------------------------- /unzip/UNZIP18.DOC: -------------------------------------------------------------------------------- 1 | 2 | UNZIP 3 | Version 1.3 4 | 5 | Gene Pizzetta 6 | May 12, 1991 7 | 8 | 9 | UNZIP dissolves MS-DOS ZIP files. This version incorporates some 10 | quick and dirty mods to make a more useful utility. The original 11 | by David Goodenough has to be the most God-awful source code I've 12 | ever come across. It was totally uncommented, and I have no idea 13 | what kind of strange assembler it was written for. This code now 14 | assembles with SLR's Z80ASM and it's a little more orderly. 15 | 16 | USAGE: 17 | 18 | UNZIP {dir:}zipfile {dir:} 19 | 20 | Under ZCPR3 "dir" can be a DU or DIR spec. Under vanilla CP/M 21 | only a drive is recognized. 22 | 23 | If a destination drive is given, member files are extracted to 24 | it. With no destination given, member files are merely checked 25 | and listed to the screen...slowly. 26 | 27 | You can now abort this thing with ^C (and the partial output 28 | file, if any, will be closed and erased). The usage screen now 29 | responds to "//". 30 | 31 | UNZIP still needs a lot of work. It really ought to be possible 32 | to extract member files selectively, but it's all or nothing at 33 | present. In addition, listing files should be a lot faster; 34 | checking CRC's in that mode seems unnecessary. Typing a member 35 | file to the screen would also be a nice enhancement. I have only 36 | limited use for an UNZIP utility, so my purpose here was to do 37 | just enough to make its operation acceptable. Maybe someone else 38 | will interested in going further. In the meantime, Steve 39 | Greenberg's ZIPDIR and Carson Wilson's ZTYPE can fill the gap. 40 | 41 | This version is probably not bullet-proof. Testing has been very 42 | limited, and frankly I don't understand much of the code, but so 43 | far it seems to work. 44 | 45 | Gene Pizzetta 46 | 481 Revere St. 47 | Revere, MA 02151 48 | 49 | Voice: (617) 284-0891 50 | Newton Centre Z-Node: (617) 965-7259 51 | Ladera Z-Node Central: (213) 670-9465 52 | 53 | Version 1.4 modifications by Bruce Morgen, 5/16/91 54 | 55 | In addition to fixing a bug in the ZCPR3 detection code at 56 | "setusr," Version 1.4 adds output filename specification with 57 | wildcards. Now the use of an output d:/dir: and/or an output 58 | filename will trigger extract mode. If the output filespec 59 | contains no wildcards (a d:/dir: alone is equivalent to "*.*"), 60 | UNZIP will now exit after the first extraction (made sense to me, 61 | any objections?). And no, Gene, I am NOT "adopting" UNZIP -- I 62 | just tweaked it far enough that it ceased to annoy me 63 | significantly in the very limited use I have for it... 64 | 65 | Version 1.5 modifications by Howard Goldstein, 6/1/91 66 | 67 | This release contains no new features or options. Its purpose is 68 | merely to correct some serious bugs that were introduced in the 69 | previous version. See the source file for details. 70 | 71 | Like Bruce and Gene, I have no intention of doing any further 72 | develompment on this program. I will, however, attempt to fix 73 | anything that does not work as documented. 74 | 75 | Version 1.6 modifications by Howard Goldstein, 4/3/92 76 | 77 | OK, I lied. 78 | 79 | I began using UNZIP a bit more recently and found it to be much 80 | too slow. I therefore took Gene's suggestion and changed the 81 | program so it no longer expands a file and checks its CRC when 82 | that file is not being extracted. I also replaceed the disk read 83 | and write routines. The old ones could handle only 128 bytes at 84 | a time; the new ones, from ZSLIB, can handle much larger 85 | buffers. This increases speeed and decreases wear and tear on 86 | the drives. 87 | 88 | 89 | Version 1.7 modifications by Howard Goldstein, 4/8/92 90 | 91 | This version corrects a couple of bugs that were noticed 92 | shortly after version 1.6 was released. The program now works 93 | correctly on files containing long ZIP comments. A typo in the 94 | usage screen was also fixed. 95 | 96 | Version 1.8 modifications by Howard Goldstein, 4/16/92 97 | Another bug fix, (the last, I hope). In version 1.6 I managed to 98 | break the section of the program that expands "reduced" files. 99 | Version 1.8 fixes it. 100 | -------------------------------------------------------------------------------- /unzip/UNZIP18.FOR: -------------------------------------------------------------------------------- 1 | UNZIP dissolves MS-DOS ZIP files. Accepts DU and DIR specs for ZIP 2 | file and as destination for extracted files. Output filenames are 3 | supported. Can be aborted with ^C without leaving partial files on 4 | disk. Version 1.6 has much faster disk I/O and no longer checks 5 | CRC's when listing names of files not being extracted. Version 1.8 6 | corrects a few bugs. 7 | -- Howard Goldstein, 4/16/92 8 | -------------------------------------------------------------------------------- /unzip/UNZIP181.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/UNZIP181.COM -------------------------------------------------------------------------------- /unzip/UNZIP181.SUB: -------------------------------------------------------------------------------- 1 | ; Build new version of UNZIP181 using SLR Z80ASM and SLRNK 2 | ; using Z-System libraries from LIBS45A.LBR and ZSLIB36.LBR 3 | ; 4 | z80asm unzip181/6 5 | ; Load ASEG after CSEG - verify CSEG size is 0d7b 6 | ; and use ASEG at 0d7b + 0100 +1 to be sure 7 | slrnk /a:0e7c,/p:100,unzip181,unzip181/n/e 8 | -------------------------------------------------------------------------------- /unzip/UNZIP182.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/UNZIP182.COM -------------------------------------------------------------------------------- /unzip/UNZIP182.DOC: -------------------------------------------------------------------------------- 1 | 2 | UNZIP 3 | Version 1.82 4 | 5 | This version of UNZIP now can extract all files from MS-DOS ZIP files. The 6 | addition of the UnDeflate decompression method make this possible since 7 | previous versions could not handle Deflated files. 8 | 9 | Usage Syntax: 10 | 11 | UNZIP {dir:}zipfile {dir:}{afn} 12 | 13 | Under ZCPR3 "dir" can be a DU or DIR spec; otherwise, just a drive. If no 14 | destination is given, member files are checked and listed. If a destination 15 | is given, member files are extracted that match "afn" if given, otherwise all 16 | member files are extracted. 17 | 18 | You can abort UNZIP at any time with ^C (and the partial output file, if 19 | any, will be closed and erased). 20 | 21 | Help on useage is available by entering "//". This program still needs a 22 | lot of work. It's probably not bullet-proof and testing has been very 23 | limited, but it seems to work. 24 | 25 | Production: 26 | 27 | Best results are obtained by using ZMAC/ZML or M80/L80 since SLRNK seems to 28 | have problems trying to link the COM file. ZMAC is the assembler of 29 | choice. Use the following commands to produce a COM file is SYSLIB, Z3LIB 30 | and ZSLIB are present in the default directory: 31 | 32 | ZMAC UNZIP182 33 | ZML UNZIP182 34 | 35 | These libraries are included in the library or archive as a covenience. 36 | 37 | Revision History: 38 | 39 | Version 1.2 -- July 3, 1990 -- David P. Goodenough 40 | 41 | Version 1.3 -- Gene Pizzetta - May 12, 1991 42 | 43 | UNZIP dissolves MS-DOS ZIP files. This version incorporates some quick and 44 | dirty mods to make a more useful utility. The original by David Goodenough 45 | has to be the most God-awful source code I've ever come across. It was 46 | totally uncommented, and I have no idea what kind of strange assembler it 47 | was written for. This code now assembles with SLR's Z80ASM and it's a 48 | little more orderly. 49 | 50 | You can now abort this thing with ^C (and the partial output file, if any, 51 | will be closed and erased). The usage screen now responds to "//". 52 | 53 | UNZIP still needs a lot of work. It really ought to be possible to extract 54 | member files selectively, but it's all or nothing at present. In addition, 55 | listing files should be a lot faster checking CRC's in that mode seems 56 | unnecessary. Typing a member file to the screen would also be a nice 57 | enhancement. I have only limited use for an UNZIP utility, so my purpose 58 | here was to do just enough to make its operation acceptable. Maybe 59 | someone else will interested in going further. In the meantime, Steve 60 | Greenberg's ZIPDIR and Carson Wilson's ZTYPE can fill the gap. 61 | 62 | This version is probably not bullet-proof. Testing has been very limited, 63 | and frankly I don't understand much of the code, but so far it seems to work. 64 | 65 | Gene Pizzetta 66 | 481 Revere St. 67 | Revere, MA 02151 68 | 69 | Voice: (617) 284-0891 70 | Newton Centre Z-Node: (617) 965-7259 71 | Ladera Z-Node Central: (213) 670-9465 72 | 73 | Version 1.4 modifications by Bruce Morgen, 5/16/91 74 | 75 | In addition to fixing a bug in the ZCPR3 detection code at "setusr," Version 76 | 1.4 adds output filename specification with wildcards. Now the use of an 77 | output d:/dir: and/or an output filename will trigger extract mode. If the 78 | output filespec contains no wildcards (a d:/dir: alone is equivalent to 79 | "*.*"), UNZIP will now exit after the first extraction (made sense to me, any 80 | objections?). And no, Gene, I am NOT "adopting" UNZIP -- I just tweaked 81 | it far enough that it ceased to annoy me significantly in the very limited 82 | use I have for it... 83 | 84 | Version 1.5 modifications by Howard Goldstein, 6/1/91 85 | 86 | This release contains no new features or options. Its purpose is merely to 87 | correct some serious bugs that were introduced in the previous version. 88 | See the source file for details. 89 | 90 | Like Bruce and Gene, I have no intention of doing any further 91 | develompment on this program. I will, however, attempt to fix anything 92 | that does not work as documented. 93 | 94 | Version 1.6 modifications by Howard Goldstein, 4/3/92 95 | 96 | OK, I lied. 97 | 98 | I began using UNZIP a bit more recently and found it to be much too slow. 99 | I therefore took Gene's suggestion and changed the program so it no longer 100 | expands a file and checks its CRC when that file is not being extracted. I 101 | also replaceed the disk read and write routines. The old ones could handle 102 | only 128 bytes at a time; the new ones, from ZSLIB, can handle much larger 103 | buffers. This increases speeed and decreases wear and tear on the drives. 104 | 105 | 106 | Version 1.7 modifications by Howard Goldstein, 4/8/92 107 | 108 | This version corrects a couple of bugs that were noticed shortly after 109 | version 1.6 was released. The program now works correctly on files 110 | containing long ZIP comments. A typo in the usage screen was also fixed. 111 | 112 | Version 1.8 modifications by Howard Goldstein, 4/16/92 113 | 114 | Another bug fix, (the last, I hope). In version 1.6 I managed to break the 115 | section of the program that expands "reduced" files. Version 1.8 fixes it. 116 | 117 | Version 1.8-1 -- June 17, 2020 -- Martin 118 | 119 | As postied to USENET newsgroup comp.os.cpm, a flaws in both the un- 120 | implode and un-shrink routines was found to be causing CRC errors or 121 | program crashes were discovered. 122 | 123 | For un-implode, the algorithm is essentially a translation of the PKZ101 124 | MS-DOS algorithm in C that has been hand optimized into Z80 assembly 125 | language. However, the readtree() function was incorrectly returning a 126 | byte value in the A register, when the shift routine at label ui5 was 127 | expecting a 16-bit value in HL. 128 | 129 | For unshrink, there is a race condition with handling the "KwKwK" case 130 | that was omitted from the routine. 131 | 132 | Both updates are flagged with ;;v1.8-1 comments, and the version sign-on 133 | message now includes the revision. 134 | 135 | Version 1.8-2 -- September 3, 2020 -- Martin and Lars 136 | 137 | Bug fixes and some major and minor enhancements. 138 | 139 | Now properly handles the extraction of zero-length files. Will now skip to 140 | the next file header if the compression method is unknown. Fix readbits 141 | when a full word (16 bits) is read (in preparation for implementing the 142 | unDeflate algorithm. Fixed mis-ordering of variables. Code makes the 143 | assumption that "bitbuf" is the byte before "bleft". Major enhancement is 144 | the implementation the UnDeflate algorithm (based on the work by Keir 145 | Fraser's HiTech-C code at 146 | https://github.com/keirf/Amiga-Stuff/blob/master/inflate/degzip_portable.c 147 | Had to reduce I/O Buffers to 2K each because available memory no longer 148 | supports 8K buffers. 149 | 150 | -------------------------------------------------------------------------------- /unzip/UNZIP182.FOR: -------------------------------------------------------------------------------- 1 | UNZIP Undeflates, Unreduces, Unshrinks, Unimplodes and Unstores, files 2 | from MS-DOS ZIP files. Accepts DU and DIR specs for ZIP file and as 3 | destination for extracted files. Output filenames are supported. Can be 4 | aborted with ^C without leaving partial files on disk. 5 | Version 1.82 corrects some bugs and adds undeflate. 6 | -- Martin and Lars Nelson 10/20/20 7 | -------------------------------------------------------------------------------- /unzip/UNZIP182.SUB: -------------------------------------------------------------------------------- 1 | zsm4 =unzip182.z80 2 | link unzip182 3 | ; strip off DSEG storage (last CSEG address is 12f9h) 4 | sid unzip182.com 5 | start of line, zero terminated 68 | ; note: documentation claims the command line at &0080 is unterminated, but 69 | ; DRCCP terminates the line with &00, as do other CCPs that follow the same 70 | ; practice. 71 | ld hl,0080h ; command buffer 72 | ld l,(hl) ; get length 73 | set 7,l ; point after end of line 74 | inc hl 75 | ld (hl),0 ; put terminator in 76 | ld l,81h ; hl=>start of line 77 | OptLp1: ld bc,0 ; b=0, options 78 | ld a,(hl) ; get character 79 | inc hl 80 | cp ' ' 81 | jr z,OptLp1 ; skip spaces 82 | jr c,OptDone ; end of command line 83 | cp '[' 84 | jr z,Opts ; start of options string 85 | Optlp3: ld a,(hl) 86 | inc hl 87 | cp ' ' 88 | jr z,OptLp1 89 | jr nc,OptLp3 ; skip filename 90 | jr OptDone ; end of command line 91 | Opts: ld a,(hl) 92 | inc hl 93 | cp ' ' 94 | jr z,OptLp1 ; another filename 95 | cp '?' 96 | jp z,ZipSyntax ; ZIP [?] - display usage 97 | and 05Fh ; upper case 98 | jr z,OptDone ; end of command line 99 | cp ']' 100 | jr nc,OptDone ; end of options 101 | or b 102 | ld b,a 103 | jr Opts 104 | OptDone: 105 | ld (Options-1),bc ; note options, also zero Pass 106 | ; bit 1 = [O]verwrite 107 | ; bit 4 = [Q]uiet 108 | ; 109 | ; Check for output file 110 | BIT 1,B 111 | JR Z,DeleteOk ; [O]verwrite off 112 | LD DE,FCB1 113 | LD C,bd_delete ; Delete any existing file 114 | CALL bdos 115 | DeleteOk: 116 | 117 | ; GRRRRR Any call to bd_make kills FindFirst and FindNext 118 | ; So, have to build up a list of source files first, and then 119 | ; do the copying. 120 | ; ARAGH!G!HG!I^%!&^$!^%#!! 121 | ; 122 | LD DE,MemStore ; HL=>heap to make list of names 123 | LD C,bd_sfirst 124 | ScanLoop: 125 | PUSH BC 126 | PUSH DE 127 | LD DE,FCB2 128 | CALL bdos ; Search directory 129 | POP DE 130 | POP BC 131 | INC A 132 | JR Z,ScanDone ; No more files 133 | ADD A,A 134 | ADD A,A 135 | ADD A,A 136 | ADD A,A 137 | ADD A,A ; Multiply by 32 to point to entry 138 | ADD A,DMA-32 ; Point to start of filename 139 | LD L,A 140 | LD H,DMA/256 ; HL=>entry 141 | LD A,(FCB2+0) ; Source drive 142 | LD (HL),A ; Put into file list 143 | LD BC,NAMELEN ; DRIVE+FILENAME+EXT 144 | LDIR ; Copy name to heap 145 | LD HL,-0180h ; 128buffer+128buffer+128stack 146 | ADD HL,SP ; HL=SP-&180 147 | SBC HL,DE ; HL=SP-&180-heaptop 148 | JP C,ErrOutOfMem 149 | LD C,bd_snext 150 | JR ScanLoop 151 | ScanDone: 152 | DEC A 153 | LD (DE),A ; &FF terminator 154 | INC DE 155 | LD (OutputBuffer),DE 156 | LD HL,128 157 | ADD HL,DE 158 | LD (InputBuffer),HL 159 | ; 160 | ; Open output file 161 | LD DE,FCB1 162 | LD C,bd_sfirst ; Test for output file 163 | CALL bdos 164 | INC A 165 | JP NZ,ErrFileExists 166 | LD DE,FCB1 167 | LD C,bd_make ; Create output file 168 | CALL bdos 169 | INC A 170 | JP Z,ErrDirFull 171 | ; Can no longer use FCB2 as it is now the metadata for FCB1 172 | 173 | ; 174 | ; Now go through list of names 175 | FileStart: 176 | LD HL,MemStore ; HL=>heap to make list of names 177 | FileLoop: 178 | LD A,(HL) ; HL=>filename 179 | INC A 180 | JP Z,FilesDone ; No more files 181 | LD DE,FCB3 182 | LD BC,NAMELEN 183 | LDIR ; Copy name to FCB3 184 | PUSH HL 185 | LD HL,Header+0 ; Clear header workspace 186 | LD DE,Header+1 187 | LD BC,HeaderEnd-Header-1 188 | LD (HL),0 189 | LDIR 190 | LD HL,'PK' 191 | LD A,(Pass) 192 | AND A 193 | JR Z,FileData ; Pass=0, data segment 194 | LD (DirSig+0),HL ; Directory signiture 195 | LD HL,0201h 196 | LD (DirSig+2),HL 197 | LD HL,DirName ; HL=>name store in header 198 | JR FileDataGo 199 | FileData: 200 | LD (HdrSig+0),HL 201 | LD HL,0403h ; Put data signiture in 202 | LD (HdrSig+2),HL 203 | LD HL,NumFiles 204 | INC (HL) 205 | JP Z,ShutTooManyFiles 206 | LD HL,HdrName ; HL=>name store in header 207 | FileDataGo: 208 | LD DE,FCB3+1 ; DE=>name in FCB3 209 | LD BC,0 ; BC= Filename length 210 | NameLoop: 211 | LD A,E 212 | SUB FCB3 AND 255 213 | CP 12 214 | JR Z,NameDone ; All 12 chars done 215 | CP 9 216 | CALL Z,NameDot ; Insert dot 217 | LD A,(DE) 218 | INC DE 219 | CP ' ' 220 | JR Z,NameLoop ; Truncate spaces 221 | CALL NamePut 222 | JR NameLoop 223 | NameDot: 224 | LD A,(DE) 225 | CP '!' 226 | LD A,'.' 227 | RET C ; Don't output dot if no extension 228 | NamePut: 229 | LD (HL),A ; Store it in header 230 | CALL PRCHAR ; Print character 231 | INC HL 232 | INC BC 233 | RET 234 | NameDone: 235 | LD (HdrNameSz),BC ; Store name size 236 | LD DE,FCB3 237 | LD C,bd_getsize ; get file size 238 | CALL bdos 239 | LD DE,(FCB3PTR+0) 240 | LD HL,(FCB3PTR+2) 241 | LD E,0 242 | SRL H 243 | RR L 244 | RR D 245 | RR E ; HLDE=records*128 246 | LD (HdrFSize+0),DE 247 | LD (HdrSize+0),DE 248 | LD (HdrFSize+2),HL 249 | LD (HdrSize+2),HL 250 | ; CALL PR2HEX 251 | ; EX DE,HL 252 | ; CALL PR2HEX 253 | 254 | CALL SavePTR ; save output PTR 255 | CALL SaveHeader ; save header, also set CRC=&FFFFFFFF 256 | ; 257 | XOR A 258 | LD (FCB3+12),A ; ex=0 for open 259 | LD DE,FCB3 260 | LD C,bd_open ; open input file 261 | CALL bdos 262 | INC A 263 | JP Z,ShutInputFailed 264 | LD HL,0 265 | LD (FCB3PTR+0),HL ; Set PTR to zero 266 | LD (FCB3PTR+2),HL 267 | LD A,(Options) 268 | BIT 4,A 269 | JR NZ,CopyLoop ; [Q]uiet 270 | LD DE,MsgAdding 271 | LD C,bd_string 272 | CALL bdos 273 | ; 274 | ; copy data 275 | CopyLoop: 276 | LD DE,(InputBuffer) 277 | LD C,bd_setdma 278 | CALL bdos 279 | LD DE,FCB3 280 | LD C,bd_read 281 | CALL bdos ; read 128-byte record 282 | AND A 283 | JR NZ,CopyEOF ; end of input file 284 | LD HL,128 285 | LD DE,(InputBuffer) 286 | CALL SaveData ; write 128 bytes to output 287 | JR CopyLoop 288 | CopyEOF: 289 | ; CALL PRHEX 290 | LD DE,FCB3 291 | LD C,bd_close ; close input file 292 | CALL bdos 293 | ; LD HL,(HdrCRC+2) 294 | ; CALL PR2HEX 295 | ; LD HL,(HdrCRC+0) 296 | ; CALL PR2HEX 297 | 298 | ; Update header 299 | CALL RestorePTR ; move back to saved header 300 | CALL SaveHeader ; save updated header, also CRC=CRC EOR &FFFFFFFF 301 | CALL RestorePTR ; back to end of file 302 | ; 303 | CALL CRLF 304 | POP HL 305 | JP FileLoop 306 | 307 | FilesDone: 308 | LD A,16 309 | LD (Options),A ; On second pass, set to [Q]uiet 310 | LD A,(Pass) 311 | AND A 312 | CALL Z,SavePTR ; Save pointer to end of data/start of directory 313 | CALL Z,ConvertPTR ; Convert saved PTR to absolute offset 314 | INC A 315 | LD (Pass),A 316 | CP 2 317 | JP C,FileStart ; Do two passes 318 | 319 | ; Create EOF header 320 | LD HL,'PK' ; Put signiture in 321 | LD (EOFSig+0),HL 322 | LD HL,0605h 323 | LD (EOFSig+2),HL 324 | LD HL,0 325 | LD (EOFDiskThis),HL 326 | LD (EOFDiskStart),HL 327 | LD (EOFCommentSz),HL 328 | LD HL,(NumFiles) 329 | LD H,0 330 | LD (EOFFilesThis),HL 331 | LD (EOFFilesTotal),HL 332 | 333 | LD HL,(SavedPTR+0) 334 | LD (EOFDirOffset+0),HL 335 | LD HL,(SavedPTR+2) 336 | LD (EOFDirOffset+2),HL 337 | 338 | CALL SavePTR 339 | CALL ConvertPTR 340 | AND A 341 | LD HL,(SavedPTR+0) 342 | LD DE,(EOFDirOffset+0) 343 | SBC HL,DE 344 | LD (EOFDirSize+0),HL 345 | 346 | LD HL,(SavedPTR+2) 347 | LD DE,(EOFDirOffset+2) 348 | SBC HL,DE 349 | LD (EOFDirSize+2),HL 350 | 351 | LD HL,EOFEnd-Header 352 | CALL SaveEOF ; Save EOF segment 353 | JR CloseOutput 354 | 355 | ClosePad: 356 | CALL PutZero 357 | CloseOutput: 358 | LD A,(OutputOffset) 359 | AND A 360 | JR NZ,ClosePad ; Pad to end of sector 361 | ShutOutput: 362 | LD DE,FCB1 363 | LD C,bd_close ; Close output file 364 | JP bdos 365 | 366 | SaveHeader: 367 | LD HL,HdrCRC 368 | LD B,4 369 | SaveCRC: 370 | LD A,(HL) ; CRC = CRC EOR &FFFFFFFF 371 | CPL 372 | LD (HL),A 373 | INC HL 374 | DJNZ SaveCRC 375 | LD BC,(HdrNameSz) ; Length of name field 376 | LD HL,HdrName-Header 377 | ADD HL,BC ; HL=length of header 378 | LD A,(Pass) 379 | AND A 380 | JR Z,SaveEOF ; Pass=0, data header 381 | LD BC,16 ; dir header is 16 bytes longer 382 | ADD HL,BC 383 | LD DE,Directory 384 | SCF ; CS=Header, don't build CRC 385 | JR SaveDataGo 386 | SaveEOF: 387 | LD DE,Header 388 | SCF ; CS=Header, don't build CRC 389 | JR SaveDataGo 390 | ; 391 | ; HL=count, DE=start of data, FCB1=output file, CC=update CRC 392 | SaveData: 393 | EXX 394 | LD DE,(HdrCRC+0) ; Incoming CRC 395 | LD HL,(HdrCRC+2) 396 | EXX 397 | AND A ; CC=Data, build CRC 398 | SaveDataGo: 399 | PUSH AF 400 | SaveDataLp: 401 | POP AF ; Get Carry flag back 402 | PUSH AF 403 | LD A,(DE) 404 | JR C,SaveData2 ; Don't update CRC 405 | 406 | ; The following code updates the CRC with the byte in A 407 | PUSH AF ; Save the byte 408 | EXX 409 | XOR E ; XOR byte into CRC bottom byte 410 | LD B,8 ; Prepare to rotate 8 bits 411 | CRClp: SRL H ; Rotate CRC 412 | RR L 413 | RR D 414 | RRA 415 | JR NC,CRCclear ; b0 was zero 416 | LD E,A ; Put CRC low byte back into E 417 | LD A,H 418 | XOR 0EDh ; CRC=CRC XOR &EDB88320, ZIP polynomic 419 | LD H,A 420 | LD A,L 421 | XOR 0B8h 422 | LD L,A 423 | LD A,D 424 | XOR 083h 425 | LD D,A 426 | LD A,E 427 | XOR 020h ; And get CRC low byte back into A 428 | CRCclear: 429 | DJNZ CRClp ; Loop for 8 bits 430 | LD E,A ; Put CRC low byte back into E 431 | EXX 432 | LD A,(Pass) 433 | AND A 434 | JR NZ,SaveData0 ; Not data segment, don't output 435 | POP AF ; Get the byte back 436 | CALL PutByte ; Output data byte 437 | JR SaveData3 438 | SaveData0: 439 | POP AF ; Get the byte back 440 | JR SaveData3 441 | ; 442 | SaveData2: 443 | CALL PutByte ; Output header byte 444 | SaveData3: 445 | INC DE 446 | DEC HL 447 | LD A,H 448 | OR L 449 | JR NZ,SaveDataLp 450 | POP AF ; Get Carry back 451 | RET C ; Don't update CRC 452 | EXX 453 | LD (HdrCRC+0),DE ; Outgoing CRC 454 | LD (HdrCRC+2),HL 455 | EXX 456 | RET 457 | 458 | ConvertPTR: 459 | PUSH AF 460 | LD A,(FCB1Saved+4) 461 | LD DE,(FCB1Saved+0) 462 | LD HL,(FCB1Saved+2) 463 | ADD A,A 464 | LD E,A 465 | SRL H 466 | RR L 467 | RR D 468 | RR E ; HLDE=records*128+Offset 469 | LD (SavedPTR+0),DE 470 | LD (SavedPTR+2),HL 471 | POP AF 472 | RET 473 | 474 | SavePTR: 475 | PUSH AF 476 | PUSH HL 477 | LD HL,(FCB1PTR+0) 478 | LD (FCB1Saved+0),HL 479 | LD HL,(FCB1PTR+2) 480 | LD (FCB1Saved+2),HL 481 | LD A,(OutputOffset) 482 | LD (FCB1Saved+4),A 483 | POP HL 484 | POP AF 485 | RET 486 | 487 | RestorePTR: 488 | PUSH HL 489 | PUSH DE 490 | LD HL,(FCB1PTR+0) 491 | PUSH HL 492 | LD HL,(FCB1PTR+2) 493 | PUSH HL 494 | LD A,(OutputOffset) 495 | PUSH AF 496 | CALL FlushSave ; Flush buffer to disk 497 | LD HL,(FCB1Saved+0) 498 | LD (FCB1PTR+0),HL 499 | LD HL,(FCB1Saved+2) 500 | LD (FCB1PTR+2),HL 501 | LD DE,FCB1 502 | LD C,bd_setptr 503 | CALL bdos ; Set file pointer 504 | LD DE,FCB1 505 | LD C,bd_read 506 | CALL bdos ; Read current sector 507 | LD HL,(FCB1Saved+0) 508 | LD (FCB1PTR+0),HL 509 | LD HL,(FCB1Saved+2) 510 | LD (FCB1PTR+2),HL 511 | LD DE,FCB1 512 | LD C,bd_setptr 513 | CALL bdos ; Set file pointer again 514 | LD A,(FCB1Saved+4) 515 | LD (OutputOffset),A ; and set offset within buffer 516 | POP AF 517 | LD (FCB1Saved+4),A 518 | POP HL 519 | LD (FCB1Saved+2),HL 520 | POP HL 521 | LD (FCB1Saved+0),HL 522 | POP DE 523 | POP HL 524 | RET 525 | 526 | FlushSave: 527 | PUSH HL 528 | PUSH DE 529 | JR PutByteSave 530 | PutZero: 531 | XOR A 532 | PutByte: 533 | PUSH HL 534 | PUSH DE 535 | LD DE,(OutputOffset) 536 | LD D,0 537 | LD HL,(OutputBuffer) 538 | ADD HL,DE 539 | LD (HL),A 540 | LD A,E 541 | INC A 542 | LD (OutputOffset),A 543 | CP 080h 544 | JR C,PutByteDone ; Buffer not full yet 545 | XOR A 546 | LD (OutputOffset),A 547 | PutByteSave: 548 | LD DE,(OutputBuffer) 549 | LD C,bd_setdma 550 | CALL bdos 551 | LD DE,FCB1 552 | LD C,bd_write 553 | CALL bdos 554 | PutByteDone: 555 | POP DE 556 | POP HL 557 | RET 558 | 559 | CRLF: LD A,10 560 | CALL PRCHAR 561 | LD A,13 562 | ; 563 | ; Output A, save all registers 564 | PRCHAR: PUSH BC 565 | PUSH DE 566 | PUSH HL 567 | LD E,A 568 | LD A,(Options) 569 | BIT 4,A 570 | JR NZ,PRDONE ; [Q]uiet 571 | LD C,bd_conout 572 | CALL bdos 573 | PRDONE: POP HL 574 | POP DE 575 | POP BC 576 | RET 577 | 578 | ShutInputFailed: 579 | CALL ShutOutput 580 | LD DE,MsgInputFailed 581 | JR MsgAbort 582 | ErrOutOfMem: 583 | LD DE,MsgOutOfMem 584 | JR MsgAbort 585 | ShutTooManyFiles: 586 | CALL ShutOutput 587 | LD DE,MsgTooManyFiles 588 | JR MsgAbort 589 | ErrFileExists: 590 | LD DE,MsgFileExists 591 | JR MsgAbort 592 | ShutDirFull: 593 | CALL ShutOutput 594 | ErrDirFull: 595 | LD DE,MsgDirFull 596 | JR MsgAbort 597 | ShutDiskFull: 598 | CALL ShutOutput 599 | ErrDiskFull: 600 | LD DE,MsgDiskFull 601 | JR MsgAbort 602 | ZipSyntax: 603 | LD DE,MsgSyntax 604 | MsgAbort: 605 | LD C,bd_string 606 | CALL bdos 607 | JP Exit 608 | 609 | ; Initialised data 610 | MsgSyntax: 611 | DEFM "ZIP v" 612 | DEFB '0'+((Vers / 100) MOD 10),'.' 613 | DEFB '0'+((Vers / 10) MOD 10),'0'+(Vers MOD 10)," - JGH " 614 | ; convert VersDD, VersMM, VersYY to date string in dd-mmm-yyyy format 615 | defb '0'+(VersDD / 10),'0'+(VersDD mod 10),'-' 616 | if (VersMM lt 1) or (VersMM gt 12) 617 | defb 'xxx' 618 | else 619 | if VersMM eq 1 620 | defb 'Jan' 621 | endif 622 | if VersMM eq 2 623 | defb 'Feb' 624 | endif 625 | if VersMM eq 3 626 | defb 'Mar' 627 | endif 628 | if VersMM eq 4 629 | defb 'Apr' 630 | endif 631 | if VersMM eq 5 632 | defb 'May' 633 | endif 634 | if VersMM eq 6 635 | defb 'Jun' 636 | endif 637 | if VersMM eq 7 638 | defb 'Jul' 639 | endif 640 | if VersMM eq 8 641 | defb 'Aug' 642 | endif 643 | if VersMM eq 9 644 | defb 'Sep' 645 | endif 646 | if VersMM eq 10 647 | defb 'Oct' 648 | endif 649 | if VersMM eq 11 650 | defb 'Nov' 651 | endif 652 | if VersMM eq 12 653 | defb 'Dec' 654 | endif 655 | endif 656 | defb '-','0'+((VersYY / 1000) mod 10),'0'+((VersYY / 100) mod 10) 657 | defb '0'+((VersYY / 10) mod 10),'0'+(VersYY mod 10) 658 | DEFM 10,13 659 | DEFM "Usage: ZIP [.zip] [OQ]",10,13 660 | DEFM "Eg: ZIP OUT.ZIP *.COM",10,13 661 | DEFM " ZIP ALLFILES.ZIP *.*",10,13,"$" 662 | MsgAdding: 663 | DEFM " -- adding","$" 664 | MsgFileExists: 665 | DEFM "ZipFile already exists",10,13,"$" 666 | MsgDiskFull: 667 | DEFM "Disk full",10,13,"$" 668 | MsgDirFull: 669 | DEFM "Dir. full",10,13,"$" 670 | MsgOutOfMem: 671 | DEFM "Out of memory",10,13,"$" 672 | MsgTooManyFiles: 673 | DEFM "Too many input files",10,13,"$" 674 | MsgInputFailed: 675 | DEFM 10,13,"Couldn't open input file",10,13,"$" 676 | 677 | 678 | ; Uninitialised data 679 | OldStack: DEFW 0000h ; Also end of saved data 680 | ZeroStart: ; Start of area to be zeroed 681 | Pass: DEFB 0 ; 0=local list, 1=directory, 2=EOF 682 | Options: DEFB 0 683 | NumFiles: DEFB 0 ; Number of entries 684 | ;FileOffset: DS 4 ; Offset to data segment entry 685 | InputOffset: DEFB 0 ; Index into input buffer 686 | OutputOffset: DEFB 0 ; Index into output buffer 687 | InputBuffer: DEFW 0000h ; Input buffer 688 | OutputBuffer: DEFW 0000h ; Output buffer 689 | ZeroEnd: ; End of area to be zeroed on startup 690 | FCB3: DEFS 36 ; Input file control block 691 | FCB3PTR EQU FCB3+32 ; Input file pointer bytes 692 | FCB1SaveOffset DEFS 1 ; Saved output offset 693 | FCB1Saved DEFS 5 ; Saved output PTR 694 | SavedPTR DEFS 4 ; Saved absolute PTR to output file 695 | 696 | ; Central directory overlaps local header 697 | Directory: 698 | DirSig: DS 2 ; Header signature PK,&01,&02 699 | DirMadeBy EQU DirSig+4; Version made by (&0000) 700 | ; 701 | ; Local header 702 | Header: 703 | HdrSig: DS 4 ; Header signature PK,&03,&04 704 | HdrVersion: DS 2 ; Version needed to extract (&0000) 705 | HdrFlags: DS 2 ; General purpose bit flag (&0000) 706 | HdrMethod: DS 2 ; Compression method 707 | HdrTime: DS 2 ; Modification time (&0000) 708 | HdrDate: DS 2 ; Modification date (&0000) 709 | HdrCRC: DS 4 ; 32-bit CRC 710 | HdrSize: DS 4 ; Compressed size 711 | HdrFSize: DS 4 ; Uncompressed size 712 | HdrNameSz: DS 2 ; Filename length 713 | HdrExtraSz: DS 2 ; Extra field length (&0000) 714 | HdrName: DS 0 ; Filename, overlapping next data 715 | ; 716 | ; Central directory also has: 717 | DirCommentSz: DS 2 ; Comment length (&0000) 718 | DirDisk: DS 2 ; Starting disk number (&0000) 719 | DirAttrsIn: DS 2 ; Internal file attributes (&0000) 720 | DirAttrsEx: DS 4 ; External file attributes (&0000) 721 | DirOffset: DS 4 ; Relative offset of local header 722 | DirName: DS 12 ; Filename, CP/M are max "12345678.123" 723 | HeaderEnd: 724 | ; 725 | ; EOF header: 726 | EOFSig EQU Header+0 ; Header signiture 4 bytes PK,&05,&06 727 | EOFDiskThis EQU Header+4 ; Number of this disk 2 bytes (&0000) 728 | EOFDiskStart EQU Header+6 ; Number of start disk 2 bytes (&0000) 729 | EOFFilesThis EQU Header+8 ; Number of entries 2 bytes (NumFiles) 730 | EOFFilesTotal EQU Header+10 ; Total num. entries 2 bytes (NumFiles) 731 | EOFDirSize EQU Header+12 ; Size of central dir 4 bytes (OffsetEOF-OffsetDir) 732 | EOFDirOffset EQU Header+16 ; Offset to central dir 4 bytes (OffsetDir) 733 | EOFCommentSz EQU Header+20 ; Comment length 2 bytes (&0000) 734 | EOFEnd EQU Header+22 735 | 736 | MemStore: 737 | ; This is a heap of all data used 738 | ; List of filenames read from source in 12-byte FCB format 739 | ; &FF terminator 740 | ; 128-byte output buffer 741 | ; 128-byte input buffer 742 | ; ... 743 | ; stack 744 | ; Top of memory at BDOS-&800 745 | -------------------------------------------------------------------------------- /unzip/ZIP101.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/ZIP101.COM -------------------------------------------------------------------------------- /unzip/ZIP101.Z80: -------------------------------------------------------------------------------- 1 | ; ZIP.Z80 2 | ; 3 | ; Create ZIP archives for CPM 4 | ; J.G.Harston 06-Nov-2000 5 | ; 6 | ; Vers 100 -- 31-Aug-2023 -- J.G.Harston 7 | ; Rewritten for ZMac. Can be assembled with ZMAC with: 8 | ; 9 | ; ZMAC -o ZIP.COM ZIP100.Z80 10 | ; 11 | ; Vers 101 -- 08-Dec-2023 -- Lars Nelson 12 | ; Fixed a problem where the computed CRC for some but 13 | ; not all files was not being written into the Local 14 | ; File Header especially on CP/M 2.2 and compatible 15 | ; systems. This caused a problem for CP/M unzip 16 | ; programs because they use the information in the 17 | ; Local File Header to extract files. Lack of a valid 18 | ; CRC causes the unzip programs to skip the file. 19 | ; Note, central directory was correct so on PCs or 20 | ; Macs all files could be extracted. nAdded 21 | ; ability to get file modification date from CP/M Plus 22 | ; and CP/M 2.2 using routines from DSLIB and ZSLIB. This 23 | ; necessitated making the code relocatable. 24 | ; 25 | ; To do: add DU: support. Add ability to add file to a zip 26 | ; file. 27 | ; 28 | ; Production: 29 | ; File is now best assembled and linked with Alex Hawley's ZMAC 30 | ; & ZML as opposed to some other assembler named ZMAC. Set SLR 31 | ; true below. Libraries DSLIB.REL, ZSLIB.REL & SYSLIB.REL are 32 | ; required to be in the default directory 33 | ; 34 | ; zmac zip101 35 | ; zml zip101 36 | ; 37 | ; Z80ASM & SLRNK can also be used. If want to use SLR .REL 38 | ; files instead of Microsoft .REL files, add an 'S' to the end 39 | ; of the library names, i.e. use DSLIBS.REL, ZSLIBSREL & 40 | ; SYSLIBS.REL. 41 | ; 42 | Vers equ 101 43 | VersDD equ 08 44 | VersMM equ 12 45 | VersYY equ 2023 46 | ; 47 | false equ 0 48 | true equ not false 49 | ; 50 | SLR equ true ; set true if using SLR assembler 51 | ; 52 | bdos equ 0005h 53 | FCB1 equ 005Ch 54 | FCB2 equ 006Ch 55 | FCB1PTR equ FCB1+32 ; Output pointer bytes 56 | DMA equ 0080h 57 | CCPSIZE equ 0800h 58 | NAMELEN equ 12 ; "DFILENAMEEXT" in FCB 59 | @FT EQU 9 ; File type 60 | ; 61 | bd_conout equ 2 62 | bd_string equ 9 63 | bd_open equ 15 64 | bd_close equ 16 65 | bd_sfirst equ 17 66 | bd_snext equ 18 67 | bd_delete equ 19 68 | bd_read equ 20 69 | bd_write equ 21 70 | bd_make equ 22 71 | bd_setdma equ 26 72 | bd_rndrd equ 33 73 | bd_rndwr equ 34 74 | bd_getsize equ 35 75 | bd_setptr equ 36 76 | ; 77 | ; These appear to be high memory ROM routines on Mr. Harston's 78 | ; CP/M machine so they should be avoided. 79 | ;PR1HEX equ 0FFAAh 80 | ;PR2HEX equ 0FFADh 81 | ;OSNEWL equ 0FFE7h 82 | ; 83 | global ENVPTR,$MEMRY 84 | ; 85 | .request dslib 86 | extrn timini,DOSTYP,DOSVER,TIMTYP,@BDOS,GSTAMP 87 | extrn U2MTIM 88 | ; 89 | ; .request zslib 90 | ; extrn getstp,gstpcp 91 | ; 92 | .request syslib ; sylib usually last 93 | ; 94 | cseg ; to read in .rel library routines 95 | 96 | jp Start 97 | db 'Z3ENV',1 ; Z3 signiture 98 | ENVPTR: dw 0 99 | ; 100 | ; Code run once, could be overwritten 101 | Start: ld (OldStack),sp ; save old stack 102 | ld hl,(bdos+1) ; start of BDOS 103 | ld de,-CCPSIZE ; allow for CCP 104 | add hl,de 105 | ld sp,hl ; put stack at top of memory 106 | ld de,(ENVPTR) ; check for z-system 107 | ld a,d 108 | or e 109 | jr nz,strt 110 | xor a ; not running zsystem 111 | strt: ld (zflag),a ; clear flag 112 | call timini ; check for datestamping support 113 | ; Global variables returned: 114 | ; DOSTYP ='S'=>ZSDOS, 'D'=>Datestamper & '3'=>CP/M Plus. 115 | ; 0=>no datestamping 116 | ; DOSVER has version number, 22=>CP/M 2.2 and 117 | ; compatiblle. 11 for ZSDOS 118 | ; 119 | ; force zip extention if no extension given on command line 120 | LD A,(FCB1+@FT) ; See if any filetype was specified 121 | CP ' ' ; 122 | JR NZ,SKPZIP ; If so, leave it as is 123 | 124 | LD HL,'PI' ; Else inject a ".ZIP" extension 125 | LD (FCB1+@FT+1),HL ; 126 | LD A,'Z' ; 127 | LD (FCB1+@FT+0),A ; 128 | 129 | SKPZIP: 130 | call Start0 ; call main program 131 | Exit: ld sp,(OldStack) ; recover stack 132 | ret 133 | 134 | Start0: ld hl,ZeroStart 135 | ld de,ZeroStart+1 136 | ld bc,ZeroEnd-ZeroStart-1 137 | ld (hl),0 138 | ldir ; Zero workspace 139 | ld a,(FCB2+1) 140 | cp 32 141 | jp z,ZipSyntax ; No filenames 142 | ; ld hl,0081h ; hl=>start of line, zero terminated 143 | ; note: documentation claims the command line at &0080 is unterminated, but 144 | ; DRCCP terminates the line with &00, as do other CCPs that follow the same 145 | ; practice. 146 | ld hl,0080h ; command buffer 147 | ld l,(hl) ; get length 148 | set 7,l ; point after end of line 149 | inc hl 150 | ld (hl),0 ; put terminator in 151 | ld l,81h ; hl=>start of line 152 | OptLp1: ld bc,0 ; b=0, options 153 | ld a,(hl) ; get character 154 | inc hl 155 | cp ' ' 156 | jr z,OptLp1 ; skip spaces 157 | jr c,OptDone ; end of command line 158 | cp '[' 159 | jr z,Opts ; start of options string 160 | Optlp3: ld a,(hl) 161 | inc hl 162 | cp ' ' 163 | jr z,OptLp1 164 | jr nc,OptLp3 ; skip filename 165 | jr OptDone ; end of command line 166 | Opts: ld a,(hl) 167 | inc hl 168 | cp ' ' 169 | jr z,OptLp1 ; another filename 170 | cp '?' 171 | jp z,ZipSyntax ; ZIP [?] - display usage 172 | and 05Fh ; upper case 173 | jr z,OptDone ; end of command line 174 | cp ']' 175 | jr nc,OptDone ; end of options 176 | or b 177 | ld b,a 178 | jr Opts 179 | OptDone: 180 | ld (Options-1),bc ; note options, also zero Pass 181 | ; bit 1 = [O]verwrite 182 | ; bit 4 = [Q]uiet 183 | ; 184 | ; Check for output file 185 | BIT 1,B 186 | JR Z,DeleteOk ; [O]verwrite off 187 | LD DE,FCB1 188 | LD C,bd_delete ; Delete any existing file 189 | CALL bdos 190 | DeleteOk: 191 | 192 | ; GRRRRR Any call to bd_make kills FindFirst and FindNext 193 | ; So, have to build up a list of source files first, and then 194 | ; do the copying. 195 | ; ARAGH!G!HG!I^%!&^$!^%#!! 196 | ; 197 | LD DE,($MEMRY) ; DE=>heap to make list of names 198 | LD C,bd_sfirst 199 | ScanLoop: 200 | PUSH BC 201 | PUSH DE 202 | LD DE,FCB2 203 | CALL bdos ; Search directory 204 | POP DE 205 | POP BC 206 | INC A 207 | JR Z,ScanDone ; No more files 208 | ADD A,A 209 | ADD A,A 210 | ADD A,A 211 | ADD A,A 212 | ADD A,A ; Multiply by 32 to point to entry 213 | ADD A,DMA-32 ; Point to start of filename 214 | LD L,A 215 | LD H,DMA/256 ; HL=>entry 216 | LD A,(FCB2+0) ; Source drive 217 | LD (HL),A ; Put into file list 218 | LD BC,NAMELEN ; DRIVE+FILENAME+EXT 219 | LDIR ; Copy name to heap 220 | LD HL,-0180h ; 128buffer+128buffer+128stack 221 | ADD HL,SP ; HL=SP-&180 222 | SBC HL,DE ; HL=SP-&180-heaptop 223 | JP C,ErrOutOfMem 224 | LD C,bd_snext 225 | JR ScanLoop 226 | ScanDone: 227 | DEC A 228 | LD (DE),A ; &FF terminator 229 | INC DE 230 | LD (OutputBuffer),DE 231 | LD HL,128 232 | ADD HL,DE 233 | LD (InputBuffer),HL 234 | ; 235 | ; Open output file 236 | ld hl,FCB2 237 | ld de,FCB2+1 238 | ld bc,19 239 | ld (hl),0 240 | ldir ; clear out FCB! 241 | LD DE,FCB1 242 | LD C,bd_sfirst ; Test for output file 243 | CALL bdos 244 | INC A 245 | JP NZ,ErrFileExists 246 | LD DE,FCB1 247 | LD C,bd_make ; Create output file 248 | CALL bdos 249 | INC A 250 | JP Z,ErrDirFull 251 | ld de,FCB1 252 | ld c,bd_open ; open output file 253 | call bdos 254 | ld de,DMA 255 | ld c,bd_setdma 256 | call bdos 257 | ld de,FCB1 258 | ld c,bd_rndwr ; write anything don't inc CR 259 | ; Can no longer use FCB2 as it is now the metadata for FCB1 260 | 261 | ; 262 | ; Now go through list of names 263 | FileStart: 264 | LD HL,($MEMRY) ; HL=>heap to make list of names 265 | FileLoop: 266 | LD A,(HL) ; HL=>filename 267 | INC A 268 | JP Z,FilesDone ; No more files 269 | LD DE,FCB3 270 | LD BC,NAMELEN 271 | LDIR ; Copy name to FCB3 272 | PUSH HL 273 | LD HL,Header+0 ; Clear header workspace 274 | LD DE,Header+1 275 | LD BC,HeaderEnd-Header-1 276 | LD (HL),0 277 | LDIR 278 | if SLR 279 | ld hl,'KP' ; PK little endian 280 | else 281 | LD HL,'PK' 282 | endif 283 | LD A,(Pass) 284 | AND A 285 | JR Z,FileData ; Pass=0, data segment 286 | LD (DirSig+0),HL ; Directory signiture 287 | LD HL,0201h 288 | LD (DirSig+2),HL 289 | LD HL,DirName ; HL=>name store in header 290 | JR FileDataGo 291 | FileData: 292 | LD (HdrSig+0),HL 293 | LD HL,0403h ; Put data signiture in 294 | LD (HdrSig+2),HL 295 | LD HL,NumFiles 296 | INC (HL) 297 | JP Z,ShutTooManyFiles 298 | LD HL,HdrName ; HL=>name store in header 299 | FileDataGo: 300 | ; Move filename in FCB3 to Local Header, print it and get 301 | ; length for Local Header in BC. Note original code needed 302 | ; FCB3 to be far enough away from record boundry and 303 | ; could not be made relocatable. Thus, it has been 304 | ; rewritten so that absolute addresses not needed at 305 | ; assembly time. 306 | LD DE,FCB3+1 ; DE=>name in FCB3 307 | ; LD BC,0 ; BC= Filename length 308 | ld b,11 ; up to 11 chars to process 309 | ld c,0 ; filename length 310 | NameLoop: 311 | ; LD A,E 312 | ld a,b ; characters output so far 313 | ; SUB FCB3 AND 255 ; doesn't work in CSEG since 314 | ; ; FCB3 is in DSEG 315 | ; CP 12 316 | cp 3 ; finished with name? 317 | ; JR Z,NameDone ; All 12 chars done 318 | ; CP 9 319 | CALL Z,NameDot ; If yes, Insert dot & start on ext. 320 | LD A,(DE) 321 | INC DE 322 | ; CP ' ' 323 | ; JR Z,NameLoop ; Truncate spaces 324 | CALL NamePut 325 | djnz NameLoop 326 | jr NameDone 327 | NameDot: 328 | LD A,(DE) 329 | CP '!' 330 | LD A,'.' 331 | RET C ; Don't output dot if no extension 332 | NamePut: 333 | cp ' ' 334 | ret z ; remove whitespace 335 | LD (HL),A ; Store it in header 336 | CALL PRCHAR ; Print character 337 | INC HL 338 | ; INC BC 339 | inc c 340 | RET 341 | NameDone: 342 | LD (HdrNameSz),BC ; Store name size 343 | LD DE,FCB3 344 | LD C,bd_getsize ; get file size 345 | CALL bdos 346 | LD DE,(FCB3PTR+0) 347 | LD HL,(FCB3PTR+2) 348 | LD E,0 349 | SRL H 350 | RR L 351 | RR D 352 | RR E ; HLDE=records*128 353 | LD (HdrFSize+0),DE 354 | LD (HdrSize+0),DE 355 | LD (HdrFSize+2),HL 356 | LD (HdrSize+2),HL 357 | ; CALL PR2HEX 358 | ; EX DE,HL 359 | ; CALL PR2HEX 360 | 361 | CALL SavePTR ; save output PTR 362 | CALL SaveHeader ; save header, also set CRC=&FFFFFFFF 363 | ; 364 | XOR A 365 | LD (FCB3+12),A ; ex=0 for open 366 | LD DE,FCB3 367 | LD C,bd_open ; open input file 368 | CALL bdos 369 | INC A 370 | JP Z,ShutInputFailed 371 | ; 372 | ; Now that input file is open, get the modify date/time stamp. 373 | ; For CP/M Plus, the date stamp is 4 bytes. 2 bytes for days 374 | ; since 1978 and 2 bytes of bcd Hours and minutes. For CP/M 375 | ; 2.2 /w Datestamper or ZSDOS, the stamp is 5 bytes of 376 | ; bcd year, month, day, hour, & minutes. ZIP files 377 | ; use the MS-DOS 32 bit packed binary format. Time is 16-bits 378 | ; with Bits [15:11] = hour, Bits [10:5] = minutes and 379 | ; Bits [4:0] = seconds/2 (not displayed). Date is 16-bits 380 | ; with Bits [15:9] = year - 1980, Bits [8:5] = month and 381 | ; Bits [4:0] = day. Datestamp is stored little endian so time 382 | ; comes first then date. The DSLIB routine GSTAMP will return 383 | ; either CP/M Plus or Datestamper stamps in Datestamp format, 384 | ; while U2MTIM will convert Datestamper to MS-DOS format . 385 | ; (Note ZSDOS can use CP/M style date stamping but returns 386 | ; stamp in Datestamper format). 387 | ; QPM, DOSPlus or Z80DOS stamping are not supported at this 388 | ; time. 389 | ; 390 | ; copy FCB because CP/M Plus returns date in the FCB 391 | ld hl,FCB3 392 | ld de,FCB4 393 | ld bc,36 394 | ldir 395 | ld de,FCB4 396 | ld hl,dsbuf 397 | call gstamp 398 | jr z,NoDS ; no dsatestamp found 399 | ; convert packed bcd modify time to MS-DOS fornat. Note: 400 | ; CP/M date stamps have no seconds. 401 | ld de,dsbuf+10 ; point to modify stamp 402 | ld hl,HdrTime ; put MS-DOS time in header 403 | call U2MTIM ; convert stamp to MS-DOS 404 | NoDS: 405 | LD HL,0 406 | LD (FCB3PTR+0),HL ; Set PTR to zero 407 | LD (FCB3PTR+2),HL 408 | LD A,(Options) 409 | BIT 4,A 410 | JR NZ,CopyLoop ; [Q]uiet 411 | LD DE,MsgAdding 412 | LD C,bd_string 413 | CALL bdos 414 | ; 415 | ; copy data 416 | CopyLoop: 417 | LD DE,(InputBuffer) 418 | LD C,bd_setdma 419 | CALL bdos 420 | LD DE,FCB3 421 | LD C,bd_read 422 | CALL bdos ; read 128-byte record 423 | AND A 424 | JR NZ,CopyEOF ; end of input file 425 | LD HL,128 426 | LD DE,(InputBuffer) 427 | CALL SaveData ; write 128 bytes to output 428 | JR CopyLoop 429 | CopyEOF: 430 | ; CALL PRHEX 431 | LD DE,FCB3 432 | LD C,bd_close ; close input file 433 | CALL bdos 434 | ; LD HL,(HdrCRC+2) 435 | ; CALL PR2HEX 436 | ; LD HL,(HdrCRC+0) 437 | ; CALL PR2HEX 438 | 439 | ; Update header 440 | CALL RestorePTR ; move back to saved header 441 | CALL SaveHeader ; save updated header, also CRC=CRC EOR &FFFFFFFF 442 | CALL RestorePTR ; back to end of file 443 | ; 444 | CALL CRLF 445 | POP HL 446 | JP FileLoop 447 | 448 | FilesDone: 449 | ; At the end of pass zero, all files with local 450 | ; headers have been written. In the next pass through 451 | ; the file, we need to build the central directory by 452 | ; rewinding the output file, adding file location info 453 | ; and writing expanded header info to the central 454 | ; directory. This again requires hoping back and forth 455 | ; from the central directory and the local headers as 456 | ; we progrss down the output file. 457 | 458 | LD A,16 459 | LD (Options),A ; On second pass, set to [Q]uiet 460 | LD A,(Pass) 461 | AND A ; end of pass zer0? 462 | CALL Z,SavePTR ; Save pointer to end of data/start of directory 463 | CALL Z,ConvertPTR ; Convert saved PTR to absolute offset 464 | ; for use in central directory 465 | INC A 466 | LD (Pass),A ; increment pass flag 467 | CP 2 468 | JP C,FileStart ; Do two passes only 469 | 470 | ; Central directory now written so we need to Create END of 471 | ; Central Direcotry Header 472 | if SLR 473 | ld hl,'KP' ; Put signiture in 474 | else 475 | LD HL,'PK' ; Put signiture in 476 | endif 477 | LD (EOFSig+0),HL 478 | LD HL,0605h 479 | LD (EOFSig+2),HL 480 | LD HL,0 481 | LD (EOFDiskThis),HL 482 | LD (EOFDiskStart),HL 483 | LD (EOFCommentSz),HL 484 | LD HL,(NumFiles) 485 | LD H,0 486 | LD (EOFFilesThis),HL 487 | LD (EOFFilesTotal),HL 488 | 489 | LD HL,(SavedPTR+0) 490 | LD (EOFDirOffset+0),HL 491 | LD HL,(SavedPTR+2) 492 | LD (EOFDirOffset+2),HL 493 | 494 | CALL SavePTR 495 | CALL ConvertPTR 496 | AND A 497 | LD HL,(SavedPTR+0) 498 | LD DE,(EOFDirOffset+0) 499 | SBC HL,DE 500 | LD (EOFDirSize+0),HL 501 | 502 | LD HL,(SavedPTR+2) 503 | LD DE,(EOFDirOffset+2) 504 | SBC HL,DE 505 | LD (EOFDirSize+2),HL 506 | 507 | LD HL,EOFEnd-Header 508 | CALL SaveEOF ; Save EOF segment 509 | JR CloseOutput 510 | 511 | ClosePad: 512 | CALL PutZero 513 | CloseOutput: 514 | LD A,(OutputOffset) 515 | AND A 516 | JR NZ,ClosePad ; Pad to end of sector 517 | ShutOutput: 518 | LD DE,FCB1 519 | LD C,bd_close ; Close output file 520 | JP bdos 521 | 522 | SaveHeader: 523 | LD HL,HdrCRC 524 | LD B,4 525 | SaveCRC: 526 | LD A,(HL) ; CRC = CRC EOR &FFFFFFFF 527 | CPL 528 | LD (HL),A 529 | INC HL 530 | DJNZ SaveCRC 531 | LD BC,(HdrNameSz) ; Length of name field 532 | LD HL,HdrName-Header 533 | ADD HL,BC ; HL=length of header 534 | LD A,(Pass) 535 | AND A 536 | JR Z,SaveEOF ; Pass=0, data header 537 | LD BC,16 ; dir header is 16 bytes longer 538 | ADD HL,BC 539 | LD DE,Directory 540 | SCF ; CS=Header, don't build CRC 541 | JR SaveDataGo 542 | SaveEOF: 543 | LD DE,Header 544 | SCF ; CS=Header, don't build CRC 545 | JR SaveDataGo 546 | ; 547 | ; HL=count, DE=start of data, FCB1=output file, CC=update CRC 548 | SaveData: 549 | EXX 550 | LD DE,(HdrCRC+0) ; Incoming CRC 551 | LD HL,(HdrCRC+2) 552 | EXX 553 | AND A ; CC=Data, build CRC 554 | SaveDataGo: 555 | PUSH AF 556 | SaveDataLp: 557 | POP AF ; Get Carry flag back 558 | PUSH AF 559 | LD A,(DE) 560 | JR C,SaveData2 ; Don't update CRC 561 | 562 | ; The following code updates the CRC with the byte in A 563 | PUSH AF ; Save the byte 564 | EXX 565 | XOR E ; XOR byte into CRC bottom byte 566 | LD B,8 ; Prepare to rotate 8 bits 567 | CRClp: SRL H ; Rotate CRC 568 | RR L 569 | RR D 570 | RRA 571 | JR NC,CRCclear ; b0 was zero 572 | LD E,A ; Put CRC low byte back into E 573 | LD A,H 574 | XOR 0EDh ; CRC=CRC XOR &EDB88320, ZIP polynomic 575 | LD H,A 576 | LD A,L 577 | XOR 0B8h 578 | LD L,A 579 | LD A,D 580 | XOR 083h 581 | LD D,A 582 | LD A,E 583 | XOR 020h ; And get CRC low byte back into A 584 | CRCclear: 585 | DJNZ CRClp ; Loop for 8 bits 586 | LD E,A ; Put CRC low byte back into E 587 | EXX 588 | LD A,(Pass) 589 | AND A 590 | JR NZ,SaveData0 ; Not data segment, don't output 591 | POP AF ; Get the byte back 592 | CALL PutByte ; Output data byte 593 | JR SaveData3 594 | SaveData0: 595 | POP AF ; Get the byte back 596 | JR SaveData3 597 | ; 598 | SaveData2: 599 | CALL PutByte ; Output header byte 600 | SaveData3: 601 | INC DE 602 | DEC HL 603 | LD A,H 604 | OR L 605 | JR NZ,SaveDataLp 606 | POP AF ; Get Carry back 607 | RET C ; Don't update CRC 608 | EXX 609 | LD (HdrCRC+0),DE ; Outgoing CRC 610 | LD (HdrCRC+2),HL 611 | EXX 612 | RET 613 | ; 614 | ; ConvertPTR -- convert the saved random record field 615 | ; to number of bytes from the beginning of the 616 | ; output file. Four byte result saved at SavedPTR. 617 | ; Uses A, HL & DE. Preserves CPU Flags 618 | ; 619 | ConvertPTR: 620 | PUSH AF ; preserve flag 621 | LD A,(FCB1Saved+4) 622 | LD DE,(FCB1Saved+0) 623 | LD HL,(FCB1Saved+2) 624 | ADD A,A 625 | LD E,A 626 | SRL H ; shift HLDE right 627 | RR L 628 | RR D 629 | RR E ; HLDE=records*128+Offset 630 | LD (SavedPTR+0),DE ; save result 631 | LD (SavedPTR+2),HL 632 | POP AF ; restore flags 633 | RET 634 | ; Save PTR - Save the current location in the zip file for later 635 | ; return. Location is saved by using the random record field of 636 | ; the FCB. BDOS function 36 is used set the field. This three 637 | ; byte field is then saved for later use by RestorPTR & ConverPTR. 638 | ; Preserves AF & HL. 639 | ; 640 | SavePTR: 641 | PUSH AF ; preserve AF & HL 642 | PUSH HL 643 | LD DE,FCB1 644 | LD C,bd_setptr 645 | CALL bdos ; Set randpm record field 646 | LD HL,(FCB1PTR+0) ;save CR & R0 647 | LD (FCB1Saved+0),HL 648 | LD HL,(FCB1PTR+2) ; save R1 & R2 649 | LD (FCB1Saved+2),HL 650 | LD A,(OutputOffset) 651 | LD (FCB1Saved+4),A 652 | POP HL 653 | POP AF 654 | RET 655 | ; 656 | ; RestorePTR - Move to location in zip file saved by SavePTR. 657 | ; Also saves the current location and moves file access to the 658 | ; location using a random read. Since random read doesn't 659 | ; change the record pointer, subsequent sequential reads or 660 | ; writes occur at the same location. Preserves DE & HL. 661 | ; 662 | RestorePTR: 663 | PUSH HL 664 | PUSH DE 665 | LD DE,FCB1 666 | LD C,bd_setptr 667 | CALL bdos ; Set randpm record field 668 | LD HL,(FCB1PTR+0) ; push current random record & 669 | PUSH HL ; OutputOffset on stack 670 | LD HL,(FCB1PTR+2) 671 | PUSH HL 672 | LD A,(OutputOffset) 673 | PUSH AF 674 | or a 675 | jr z,RPTR0 676 | ld de,(OutputBuffer) ; random write OutputBuffer 677 | ld c,bd_setdma ; if offset not zero 678 | call bdos 679 | ld de,FCB1 680 | ld c,bd_rndwr 681 | call bdos 682 | RPTR0: 683 | LD HL,(FCB1Saved+0) ; get saved random record field 684 | LD (FCB1PTR+0),HL ; and put it into the FCB 685 | LD HL,(FCB1Saved+2) 686 | LD (FCB1PTR+2),HL 687 | ld de,(OutputBuffer) ; fill buffer 688 | ld c,bd_setdma 689 | call bdos 690 | LD DE,FCB1 691 | LD C,bd_rndrd ; using random read 692 | CALL bdos 693 | LD A,(FCB1Saved+4) 694 | LD (OutputOffset),A ; and set offset within buffer 695 | POP AF 696 | LD (FCB1Saved+4),A 697 | POP HL ; save current location 698 | LD (FCB1Saved+2),HL 699 | POP HL 700 | LD (FCB1Saved+0),HL 701 | POP DE 702 | POP HL 703 | RET 704 | 705 | FlushSave: 706 | PUSH HL 707 | PUSH DE 708 | JR PutByteSave 709 | PutZero: 710 | XOR A 711 | PutByte: 712 | PUSH HL 713 | PUSH DE 714 | LD DE,(OutputOffset) 715 | LD D,0 716 | LD HL,(OutputBuffer) 717 | ADD HL,DE 718 | LD (HL),A 719 | LD A,E 720 | INC A 721 | LD (OutputOffset),A 722 | CP 080h 723 | JR C,PutByteDone ; Buffer not full yet 724 | XOR A 725 | LD (OutputOffset),A 726 | PutByteSave: 727 | LD DE,(OutputBuffer) 728 | LD C,bd_setdma 729 | CALL bdos 730 | LD DE,FCB1 731 | LD C,bd_write 732 | CALL bdos 733 | PutByteDone: 734 | POP DE 735 | POP HL 736 | RET 737 | 738 | CRLF: LD A,10 739 | CALL PRCHAR 740 | LD A,13 741 | ; 742 | ; Output A, save all registers 743 | PRCHAR: PUSH BC 744 | PUSH DE 745 | PUSH HL 746 | LD E,A 747 | LD A,(Options) 748 | BIT 4,A 749 | JR NZ,PRDONE ; [Q]uiet 750 | LD C,bd_conout 751 | CALL bdos 752 | PRDONE: POP HL 753 | POP DE 754 | POP BC 755 | RET 756 | 757 | ShutInputFailed: 758 | CALL ShutOutput 759 | LD DE,MsgInputFailed 760 | JR MsgAbort 761 | ErrOutOfMem: 762 | LD DE,MsgOutOfMem 763 | JR MsgAbort 764 | ShutTooManyFiles: 765 | CALL ShutOutput 766 | LD DE,MsgTooManyFiles 767 | JR MsgAbort 768 | ErrFileExists: 769 | LD DE,MsgFileExists 770 | JR MsgAbort 771 | ShutDirFull: 772 | CALL ShutOutput 773 | ErrDirFull: 774 | LD DE,MsgDirFull 775 | JR MsgAbort 776 | ShutDiskFull: 777 | CALL ShutOutput 778 | ErrDiskFull: 779 | LD DE,MsgDiskFull 780 | JR MsgAbort 781 | ZipSyntax: 782 | LD DE,MsgSyntax 783 | MsgAbort: 784 | LD C,bd_string 785 | CALL bdos 786 | JP Exit 787 | 788 | ; dseg 789 | 790 | ; Initialised data 791 | MsgSyntax: 792 | DEFM "ZIP v" 793 | DEFB '0'+((Vers / 100) MOD 10),'.' 794 | DEFB '0'+((Vers / 10) MOD 10),'0'+(Vers MOD 10)," - JGH " 795 | ; convert VersDD, VersMM, VersYY to date string in dd-mmm-yyyy format 796 | defb '0'+(VersDD / 10),'0'+(VersDD mod 10),'-' 797 | if (VersMM lt 1) or (VersMM gt 12) 798 | defb 'xxx' 799 | else 800 | if VersMM eq 1 801 | defb 'Jan' 802 | endif 803 | if VersMM eq 2 804 | defb 'Feb' 805 | endif 806 | if VersMM eq 3 807 | defb 'Mar' 808 | endif 809 | if VersMM eq 4 810 | defb 'Apr' 811 | endif 812 | if VersMM eq 5 813 | defb 'May' 814 | endif 815 | if VersMM eq 6 816 | defb 'Jun' 817 | endif 818 | if VersMM eq 7 819 | defb 'Jul' 820 | endif 821 | if VersMM eq 8 822 | defb 'Aug' 823 | endif 824 | if VersMM eq 9 825 | defb 'Sep' 826 | endif 827 | if VersMM eq 10 828 | defb 'Oct' 829 | endif 830 | if VersMM eq 11 831 | defb 'Nov' 832 | endif 833 | if VersMM eq 12 834 | defb 'Dec' 835 | endif 836 | endif 837 | defb '-','0'+((VersYY / 1000) mod 10),'0'+((VersYY / 100) mod 10) 838 | defb '0'+((VersYY / 10) mod 10),'0'+(VersYY mod 10) 839 | DEFM 10,13 840 | DEFM "Usage: ZIP name[.zip] [/OQ]",10,13 841 | db 'Options:',13,10 842 | db ' Q - Quiet',13,10 843 | db ' O - Overwrite existing file',13,10 844 | db ' / - Print this helP',13,10 845 | DEFM "Eg: ZIP OUT.ZIP *.COM",10,13 846 | DEFM " ZIP ALLFILES.ZIP *.*",10,13,"$" 847 | MsgAdding: 848 | DEFM " -- adding","$" 849 | MsgFileExists: 850 | DEFM "ZipFile already exists",10,13,"$" 851 | MsgDiskFull: 852 | DEFM "Disk full",10,13,"$" 853 | MsgDirFull: 854 | DEFM "Dir. full",10,13,"$" 855 | MsgOutOfMem: 856 | DEFM "Out of memory",10,13,"$" 857 | MsgTooManyFiles: 858 | DEFM "Too many input files",10,13,"$" 859 | MsgInputFailed: 860 | DEFM 10,13,"Couldn't open input file",10,13,"$" 861 | 862 | $MEMRY: DS 2 863 | 864 | dseg 865 | 866 | ; Uninitialised data 867 | OldStack: DEFW 0000h ; Also end of saved data 868 | ZeroStart: ; Start of area to be zeroed 869 | Pass: DEFB 0 ; 0=local list, 1=directory, 2=EOF 870 | Options: DEFB 0 ; command line options i.e. O and/or Q 871 | NumFiles: DEFB 0 ; Number of entries 872 | ;FileOffset: DS 4 ; Offset to data segment entry 873 | InputOffset: DEFB 0 ; Index into input buffer 874 | OutputOffset: DEFB 0 ; Index into output buffer 875 | InputBuffer: DEFW 0000h ; Input buffer 876 | OutputBuffer: DEFW 0000h ; Output buffer 877 | ZeroEnd: ; End of area to be zeroed on startup 878 | FCB3: DEFS 36 ; Input file control block 879 | FCB4: ds 36 ; Copy FCB3 here 880 | FCB3PTR EQU FCB3+32 ; Input file pointer bytes 881 | FCB1SaveOffset DEFS 1 ; Saved output offset 882 | FCB1Saved DEFS 5 ; Saved output PTR 883 | SavedPTR DEFS 4 ; Saved absolute PTR to output file 884 | dsbuf ds 128 ; date stamp buffer 885 | zflag ds 1 ; Zsystem Flag 886 | ; 887 | ; Central directory overlaps local header 888 | Directory: 889 | DirSig: DS 2 ; Header signature PK,&01,&02 890 | DirMadeBy EQU DirSig+4; Version made by (&0000) 891 | ; 892 | ; Local header 893 | Header: 894 | HdrSig: DS 4 ; Header signature PK,&03,&04 895 | HdrVersion: DS 2 ; Version needed to extract (&0000) 896 | HdrFlags: DS 2 ; General purpose bit flag (&0000) 897 | HdrMethod: DS 2 ; Compression method 898 | HdrTime: DS 2 ; Modification time (&0000) 899 | HdrDate: DS 2 ; Modification date (&0000) 900 | HdrCRC: DS 4 ; 32-bit CRC 901 | HdrSize: DS 4 ; Compressed size 902 | HdrFSize: DS 4 ; Uncompressed size 903 | HdrNameSz: DS 2 ; Filename length 904 | HdrExtraSz: DS 2 ; Extra field length (&0000) 905 | HdrName: DS 0 ; Filename, overlapping next data 906 | ; 907 | ; Central directory also has: 908 | DirCommentSz: DS 2 ; Comment length (&0000) 909 | DirDisk: DS 2 ; Starting disk number (&0000) 910 | DirAttrsIn: DS 2 ; Internal file attributes (&0000) 911 | DirAttrsEx: DS 4 ; External file attributes (&0000) 912 | DirOffset: DS 4 ; Relative offset of local header 913 | DirName: DS 12 ; Filename, CP/M are max "12345678.123" 914 | HeaderEnd: 915 | ; 916 | ; EOF header: 917 | EOFSig EQU Header+0 ; Header signiture 4 bytes PK,&05,&06 918 | EOFDiskThis EQU Header+4 ; Number of this disk 2 bytes (&0000) 919 | EOFDiskStart EQU Header+6 ; Number of start disk 2 bytes (&0000) 920 | EOFFilesThis EQU Header+8 ; Number of entries 2 bytes (NumFiles) 921 | EOFFilesTotal EQU Header+10 ; Total num. entries 2 bytes (NumFiles) 922 | EOFDirSize EQU Header+12 ; Size of central dir 4 bytes (OffsetEOF-OffsetDir) 923 | EOFDirOffset EQU Header+16 ; Offset to central dir 4 bytes (OffsetDir) 924 | EOFCommentSz EQU Header+20 ; Comment length 2 bytes (&0000) 925 | EOFEnd EQU Header+22 926 | ; 927 | ; This is a heap of all data used 928 | ; List of filenames read from source in 12-byte FCB format 929 | ; &FF terminator 930 | ; 128-byte output buffer 931 | ; 128-byte input buffer 932 | ; ... 933 | ; stack 934 | ; Top of memory at BDOS-&800 935 | -------------------------------------------------------------------------------- /unzip/ZIPDIR.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/ZIPDIR.COM -------------------------------------------------------------------------------- /unzip/ZIPDIR14.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/ZIPDIR14.COM -------------------------------------------------------------------------------- /unzip/ZIPDIR14.FOR: -------------------------------------------------------------------------------- 1 | CP/M program to list the directory of .ZIP files created by Phil 2 | Katz's MS-DOS utility, PKZIP. The listing shows each member 3 | filename along with it's compressed and uncompressed lengths, 4 | compression method and ratio, time, date, and CRC value, as well as 5 | totals for the above. Ready to go .COM file and Z80 source 6 | included. Good for RCP/M use, now requires no re-assembly or 7 | patching. Version 1.4 fixes some long standing bugs. 8 | -------------------------------------------------------------------------------- /unzip/ZIPDIR15.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/ZIPDIR15.COM -------------------------------------------------------------------------------- /unzip/ZSLIB36.LBR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/ZSLIB36.LBR -------------------------------------------------------------------------------- /unzip/unzip15.for: -------------------------------------------------------------------------------- 1 | UNZIP dissolves MS-DOS ZIP files. Version 1.4 incorporated some 2 | quick and dirty mods to make a more useful utility. Now accepts DU 3 | and DIR specs for ZIP file and as destination for extracted files. 4 | Output filenames are supported. Can be aborted with ^C without 5 | leaving partial files on disk. The code is now a little more 6 | orderly and assembles with SLR's Z80ASM. Version 1.5 fixes several 7 | serious bugs but is otherwise identical to 1.4. 8 | -------------------------------------------------------------------------------- /unzip/unzip15.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip15.lbr -------------------------------------------------------------------------------- /unzip/unzip15.toc: -------------------------------------------------------------------------------- 1 | Name Index Length CRC Date created Date updated 2 | ========================================================================== 3 | Directory 256 e2b0 4 | unzip12.dzc 2 768 9aff 12/06/1991 11:23:00 12/06/1991 11:23:00 5 | unzip12.zz0 8 7296 9a0d 18/09/1990 18:05:00 12/06/1991 11:31:00 6 | unzip15.czm 65 2816 c5ff 01/07/1991 02:38:00 01/07/1991 02:38:00 7 | unzip15.dzc 87 1920 5441 12/06/1991 10:53:00 01/07/1991 03:06:00 8 | unzip15.for 102 512 92ff 01/07/1991 03:21:00 01/07/1991 03:22:00 9 | unzip15.zz0 106 9600 1f96 16/06/1991 04:36:00 01/07/1991 02:37:00 10 | -------------------------------------------------------------------------- 11 | Total bytes used 23168 12 | 13 | Library unzip15.lbr has 8 slots: 0 deleted, 6 active, 1 unused, 1 directory. 14 | -------------------------------------------------------------------------------- /unzip/unzip151.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip151.lbr -------------------------------------------------------------------------------- /unzip/unzip152.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip152.lbr -------------------------------------------------------------------------------- /unzip/unzip153.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip153.lbr -------------------------------------------------------------------------------- /unzip/unzip154.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip154.lbr -------------------------------------------------------------------------------- /unzip/unzip155.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip155.lbr -------------------------------------------------------------------------------- /unzip/unzip156.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip156.lbr -------------------------------------------------------------------------------- /unzip/unzip157.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip157.lbr -------------------------------------------------------------------------------- /unzip/unzip18.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip18.lbr -------------------------------------------------------------------------------- /unzip/unzip18.toc: -------------------------------------------------------------------------------- 1 | Name Index Length CRC Date created Date updated 2 | ========================================================================== 3 | Directory 256 abc2 16/05/1992 07:42:00 16/05/1992 07:42:00 4 | unzip12.dzc 2 768 9aff 12/06/1991 11:23:00 12/06/1991 11:23:00 5 | unzip12.zz0 8 7296 9a0d 18/09/1990 18:05:00 12/06/1991 11:31:00 6 | unzip18.czm 65 3328 5a03 16/05/1992 07:35:00 16/05/1992 07:35:00 7 | unzip18.dzc 91 2432 136a 12/06/1991 10:53:00 16/05/1992 06:47:00 8 | unzip18.for 110 512 4d69 01/07/1991 03:21:00 16/05/1992 06:50:00 9 | unzip18.zz0 114 10880 5dca 16/06/1991 04:36:00 16/05/1992 07:34:00 10 | -------------------------------------------------------------------------- 11 | Total bytes used 25472 12 | 13 | Library unzip18.lbr has 8 slots: 0 deleted, 6 active, 1 unused, 1 directory. 14 | -------------------------------------------------------------------------------- /unzip/unzip181.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip181.lbr -------------------------------------------------------------------------------- /unzip/unzip182.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip182.lbr -------------------------------------------------------------------------------- /unzip/unzip184.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip184.lbr -------------------------------------------------------------------------------- /unzip/unzip185.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip185.lbr -------------------------------------------------------------------------------- /unzip/unzip186.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip186.lbr -------------------------------------------------------------------------------- /unzip/unzip187.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzip187.lbr -------------------------------------------------------------------------------- /unzip/unzipz03.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzipz03.lbr -------------------------------------------------------------------------------- /unzip/unzipz04.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/unzipz04.lbr -------------------------------------------------------------------------------- /unzip/zip100.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/zip100.lbr -------------------------------------------------------------------------------- /unzip/zip101.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/zip101.lbr -------------------------------------------------------------------------------- /unzip/zipdir.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/zipdir.lbr -------------------------------------------------------------------------------- /unzip/zipdir14.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/zipdir14.lbr -------------------------------------------------------------------------------- /unzip/zipdir15.lbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agn453/UNZIP-CPM-Z80/38c9ae5048a81ec8075f43c34bdc43d1da606269/unzip/zipdir15.lbr --------------------------------------------------------------------------------