Coder Social home page Coder Social logo

unzip-cpm-z80's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m Tony Nicholson @agn453 a retired Computer Engineer.

  • ๐Ÿ‘€ Iโ€™m interested in Retrocomputing - particularly with a nostalgic connection to the beginnings of my undergraduate years (1975+) with the emergence of microprocessors like the Intel 8080, Zilog Z80...

  • ๐Ÿ“ซ You can reach me by raising an issue in any of my repositories; or e-mail [email protected]

unzip-cpm-z80's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

unzip-cpm-z80's Issues

OPT proposal

; push de
; ld de,-4
; add iy,de
; pop de

dec iy
dec iy
dec iy
dec iy

; push de
; ld de,4
; add iy,de
; pop de

inc iy
inc iy
inc iy
inc iy

...why it was preferred the addition ? For the flags?

GUNZIP

Providing Deflate is a wonderful achievement.
I'd like to point out that a GUNZIP tool is just right behind the corner, probably a CRC16 routine would suffice to provide a nice text deflater.

I could print out the text from a gzipped file with the following mockup, it stops with a CRC error only after having printed out the whole thing:

    outbyte:
    
        push   bc
        push   de
        push   hl
        ld     e,a
        ld     c,conout
        call   bdos		; B preserved
        pop    hl
        pop    de
        pop    bc
        ret


  
  
    ;
    ;  Verify we have a valid GZip archive
    ;
    openok:
        call	getword
        ld	de,-((0x8b << 8) + 0x1f)		; magic number
        add	hl,de
        ld	a,h
        or	l
        jr	nz,sigerr
    
        call	getbyte     ; CM (Compression Method)
        sub     8           ; il must be 8 (Deflate)
        jr	nz,sigerr
    
        call	getbyte		; File Flags  (see table below)
    
        call	getword		; 32-bit timestamp
        call	getword
    
        call	getbyte		; Compression flags
    ;	push    af
        call	getbyte		; Operating system (see table below)
    ;	pop     af
        
    ;	and     4 ; FEXTRA?
    ;    ... if so we should skip the extra field
    
    
    ;  We have the original filename here, let's skip it for now
    fnameloop:
        call	getbyte
        and     a
        jr nz,fnameloop
    
    
        call	undeflate
    
        jp	closeo
    
    
    ; File Flags 
    ; -----------------------------
    ; 0x01  FTEXT      If set the uncompressed data needs to be treated as text instead of binary data.
    ;                  This flag hints end-of-line conversion for cross-platform text files but does not enforce it.
    ; 0x02  FHCRC      The file contains a header checksum (CRC-16)
    ; 0x04  FEXTRA     The file contains extra fields
    ; 0x08  FNAME      The file contains an original file name string
    ; 0x10  FCOMMENT   The file contains comment
    ; 0x20  Reserved
    ; 0x40  Reserved
    ; 0x80  Reserved
    
    
    ; Operating System flags
    ; -----------------------------
    ; 0    FAT filesystem (MS-DOS, OS/2, NT/Win32)
    ; 1    Amiga
    ; 2    VMS (or OpenVMS) 
    ; 4    VM/CMS
    ; 5    Atari TOS
    ; 6    HPFS filesystem (OS/2, NT)
    ; 7    Macintosh
    ; 8    Z-System
    ; 9    CP/M
    ; 10   TOPS-20
    ; 11   NTFS filesystem (NT)
    ; 12   QDOS
    ; 13   Acorn RISCOS
    ; 255  unknown

This is also a valuable concept to exclude the file related BDOS calls and work on a fixed memory image to tune the decompression algorithm, a cut-down version allows z88dk-ticks to work properly and compute the overall CPU usage.

Will not extract under CP/M 2.2 or 3.0

Running unzip186.com under cp/m 2.2 and 3.0 on my SC-131. I've tried against zip files with just Stored files and also others with varying levels of compression. None of them extract.

I>era random.pas
I>f:unzip186 d2 random.pas
UNZIP Version 1.8-6 - DPG
Checking
ZIP archive = D2 .ZIP
Name Length Stored Method Ver File Date & Time CRC STATUS
============ ======= ======= ======== === ========= ===== ======== =======
RANDOM .PAS 3712 3712 Stored 10 28 Apr 16 19:19 97381948 CRC OK

I>dir random.pas
NO FILE
I>f:unzip186
UNZIP Version 1.8-6 - DPG
Usage:
UNZIP {d:}zipfile {d:}{afn.typ}
If a destination is given, files are extracted.
If not, filenames are listed.
I>f:unzip186 d2 random.pas i:
UNZIP Version 1.8-6 - DPG
Checking
ZIP archive = D2 .ZIP
Name Length Stored Method Ver File Date & Time CRC STATUS
============ ======= ======= ======== === ========= ===== ======== =======
RANDOM .PAS 3712 3712 Stored 10 28 Apr 16 19:19 97381948 CRC OK

I>dir random.pas
NO FILE

Add 'Overwrite' option

Needs an [O]verwrite option to force overwriting existing files.

(I'm working on this, placeholder to note it's being done.)

Skipping directory names in archive

quote:
; read a byte at a time, resetting DE everytime a path seperator
; is encountered until all bytes in the filename have been read.
; '/', '' and ':' are considered path seperators.

This is wrong. The ZIP format specifies that within the archive directories are always seperated by '/' regardless of the platform's own directory characters.
directory/directory/file is stored as directory/directory/file
directory\directory\file is stored as directory/directory/file
directory.directory.file is stored as directory/directory/file
directory:directory:file is stored as directory/directory/file
always

When creating a ZIP archive the ZIP tool translates the local filename naming system into the ZIP filename naming convention when storing the names in the archive.
When extracting from a ZIP archive, the UNZIP tool translates the ZIP filename naming convention into the filename naming convention for the platform it is extracting to.

"ZIP filename format" is close enough to "Unix filename format" as to not make much difference.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.