⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flate.a

📁 压缩解压,是unzip540的升级,这个外国网站摘来的源码,是evb编写.
💻 A
📖 第 1 页 / 共 2 页
字号:
;===========================================================================; Copyright (c) 1990-2002 Info-ZIP.  All rights reserved.;; See the accompanying file LICENSE, version 2000-Apr-09 or later; (the contents of which are also included in unzip.h) for terms of use.; If, for some reason, all these files are missing, the Info-ZIP license; also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html;===========================================================================; flate.a created by Paul Kienitz, 20 June 94.  Last modified 23 Mar 2002.;; 68000 assembly language version of inflate_codes(), for Amiga.  Prototype:;;   int inflate_codes(__GPRO__ struct huft *tl, struct huft *td,;                     unsigned bl, unsigned bd);;; Where __GPRO__ expands to "Uz_Globs *G," if REENTRANT is defined,; otherwise to nothing.  In the latter case G is a global variable.;; Define the symbol FUNZIP if this is for fUnZip.  It overrides REENTRANT.;; Define AZTEC to use the Aztec C macro version of getc() instead of the; library getc() with FUNZIP.  AZTEC is ignored if FUNZIP is not defined.;; Define NO_CHECK_EOF to not use the fancy paranoid version of NEEDBITS --; this is equivalent to removing the #define CHECK_EOF from inflate.c.;; Define INT16 if ints are short, otherwise it assumes ints are long.;; Define USE_DEFLATE64 if we're supporting Deflate64 decompression.;; Do NOT define WSIZE; it is always 32K or 64K depending on USE_DEFLATE64.;; ------;; The following include file is generated from globals.h, and gives us equates; that give the offsets in Uz_Globs of the fields we use, which are:;       ulg bb;       unsigned int bk, wp;       (either array of unsigned char, or pointer to unsigned char) redirslide; For fUnZip:;       FILE *in; For regular UnZip but not fUnZip:;       int incnt, mem_mode;       long csize;       uch *inptr; It also defines a value SIZEOF_slide, which tells us whether the appropriate; slide field in G (either area.Slide or redirect_pointer) is a pointer or an; array instance.  It is 4 in the former case and a large value in the latter.; Lastly, this include will define CRYPT as 1 if appropriate and supply flag; definitions for major compile options that may affect the layout of the; globals structure and the functionality of the core decompression routines; (currently FUNZIP, SFX, REENTRANT, DLL, NO_SLIDE_REDIR, USE_DEFLATE64).        INCLUDE "amiga/G_offs.a"; struct huft is defined as follows:;;   struct huft {;     uch e;                /* number of extra bits or operation */;     uch b;                /* number of bits in this code or subcode */;     union {;       ush n;              /* literal, length base, or distance base */;       struct huft *t;     /* pointer to next level of table */;     } v;;   };                      /* sizeof(struct huft) == 6 */;; The G_offs include defines offsets h_e, h_b, h_v_n, and h_v_t in this; struct, plus SIZEOF_huft.                IFD     REENTRANT                 IFND   FUNZIPREENT_G equ     1                 ENDC                ENDC; These macros allow us to deal uniformly with short or long ints:                IFD     INT16MOVINT           MACRO        move.w          \1,\2                 ENDMINTSIZE equ     2                ELSE    ; !INT16MOVINT           MACRO        move.l          \1,\2                 ENDMINTSIZE equ     4                ENDC; G.bb is the global buffer that holds bits from the huffman code stream, which; we cache in the register variable b.  G.bk is the number of valid bits in it,; which we cache in k.  The macros NEEDBITS(n) and DUMPBITS(n) have side effects; on b and k.                IFD     REENT_GG_SIZE  equ     4G_PUSH           MACRO          ; this macro passes "__G__" to functions        move.l          G,-(sp)                 ENDM                ELSE        xref    _G              ; Uz_GlobsG_SIZE  equ     0G_PUSH           MACRO        ds.b            0       ; does nothing; the assembler dislikes MACRO ENDM                 ENDM                ENDC    ; REENT_G;;      xref    _mask_bits      ; const unsigned mask_bits[17];                IFD     FUNZIP                 IF     CRYPT        xref    _encrypted      ; int -- boolean flag        xref    _update_keys    ; int update_keys(__GPRO__ int)        xref    _decrypt_byte   ; int decrypt_byte(__GPRO)                 ENDC   ; CRYPT                ELSE    ; !FUNZIP        xref    _memflush       ; int memflush(__GPRO__ uch *, ulg)        xref    _readbyte       ; int readbyte(__GPRO)                ENDC    ; FUNZIP        xref    _flush          ; if FUNZIP:  int flush(__GPRO__ ulg)                                ; else:  int flush(__GPRO__ uch *, ulg, int); Here are our register variables.b       equr    d2              ; unsigned longk       equr    d3              ; unsigned short <= 32e       equr    d4              ; unsigned int, mostly used as unsigned charw       equr    d5              ; unsigned long (was short before deflate64)n       equr    d6              ; unsigned long (was short before deflate64)d       equr    d7              ; unsigned int, used as unsigned shortt       equr    a2              ; struct huft *lmask   equr    a3              ; ulg *G       equr    a6              ; Uz_Globs *; Couple other items we need:savregs reg     d2-d7/a2/a3/a6                IFD     USE_DEFLATE64WSIZE   equ     $10000          ; 64K... be careful not to treat as short!                ELSEWSIZE   equ     $08000          ; 32K... be careful not to treat as negative!                ENDCEOF     equ     -1INVALID equ     99; inflate_codes() returns one of the following status codes:;          0  OK;          1  internal inflate error or EOF on input stream;         the following return codes are passed through from FLUSH() errors;          50 (PK_DISK)   "overflow of output space";          80 (IZ_CTRLC)  "canceled by user's request"RET_OK  equ     0RET_ERR equ     1                IFD     FUNZIP; This does getc(in).  Aztec version is based on #define getc(fp) in stdio.h                 IFD    AZTEC        xref    __filbufGETC              MACRO        move.l          in(G),a0        move.l          (a0),a1         ; in->_bp        cmp.l           4(a0),a1        ; in->_bend        blo.s           gci\@        move.l          a0,-(sp)        jsr             __filbuf        addq            #4,sp        bra.s           gce\@gci\@:  moveq           #0,d0           ; must be valid as longword        move.b          (a1)+,d0        move.l          a1,(a0)gce\@:                  ENDM                 ELSE   ; !AZTECGETC              MACRO        xref    _getc        move.l          in(G),-(sp)        jsr             _getc        addq            #4,sp                  ENDM                 ENDC   ; AZTEC                ENDC    ; FUNZIP; Input depends on the NEXTBYTE macro.  This exists in three different forms.; The first two are for fUnZip, with and without decryption.  The last is for; regular UnZip with or without decryption.  The resulting byte is returned; in d0 as a longword, and d1, a0, and a1 are clobbered.; FLUSH also has different forms for UnZip and fUnZip.  Arg must be a longword.; The same scratch registers are trashed.                IFD     FUNZIPNEXTBYTE         MACRO        GETC                  IF    CRYPT        tst.w           _encrypted+INTSIZE-2    ; test low word if long        beq.s           nbe\@        MOVINT          d0,-(sp)                ; save thru next call        G_PUSH        jsr             _decrypt_byte        eor.w           d0,G_SIZE+INTSIZE-2(sp) ; becomes arg to update_keys        jsr             _update_keys        addq            #INTSIZE+G_SIZE,spnbe\@:                  ENDC  ; !CRYPT                  IFGT 4-INTSIZE        ext.l           d0              ; assert -1 <= d0 <= 255                  ENDC                 ENDMFLUSH            MACRO        move.l          \1,-(sp)        G_PUSH        jsr             _flush        addq            #4+G_SIZE,sp                 ENDM                ELSE    ; !FUNZIPNEXTBYTE         MACRO        subq.w          #1,incnt+INTSIZE-2(G)   ; treat as short        bge.s           nbs\@        G_PUSH        jsr             _readbyte                  IFNE G_SIZE        addq            #G_SIZE,sp                  ENDC                  IFGT 4-INTSIZE        ext.l           d0            ; assert -1 <= d0 <= 255                  ENDC        bra.s           nbe\@nbs\@:  moveq           #0,d0        move.l          inptr(G),a0   ; alt vers: move.b inptr(G),d0        move.b          (a0)+,d0      ;           addq   #1,inptr(G)        move.l          a0,inptr(G)nbe\@:                 ENDMFLUSH            MACRO        MOVINT          #0,-(sp)                ; unshrink flag: always false        move.l          \1,-(sp)                ; length                  IFGT  SIZEOF_slide-4        pea             redirslide(G)           ; buffer to flush                  ELSE        move.l          redirslide(G),-(sp)                  ENDC        G_PUSH        tst.w           mem_mode+INTSIZE-2(G)   ; test lower word if long        beq.s           fm\@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -