home *** CD-ROM | disk | FTP | other *** search
-
- CSECT text,0,,1,2
-
- XDEF PCHG_FastDecomp
-
- ;****** pchg.lib/PCHG_FastDecomp ******************************************
- ;
- ; NAME
- ; PCHG_FastDecomp -- Decompress a PCHG chunk, fast.
- ;
- ; SYNOPSIS
- ; PCHG_FastDecomp(Source, Dest, TreeCode, OriginalSize);
- ; A0 A1 A2 D0
- ;
- ; VOID PCHG_FastDecomp(APTR, APTR, WORD *, ULONG);
- ;
- ; PCHG_CFastDecomp(Source, Dest, TreeCode, OriginalSize);
- ;
- ; VOID PCHG_CFastDecomp(APTR, APTR, WORD *, ULONG);
- ;
- ; FUNCTION
- ; Unpack reasonably fast a PCHG chunk. This routine will
- ; never bypass the OriginalSize limit while writing to
- ; Dest.
- ;
- ; INPUTS
- ; Source - The PCHG compressed data (just after the
- ; PCHGCompHeader).
- ; Dest - A block of memory OriginalSize bytes long
- ; which will contain the unpacked data.
- ; TreeCode - A pointer to the last word of the code
- ; of the tree used when compressing the data.
- ; If you're unpacking a standard PCHG chunk,
- ; you should set this entry to
- ; (char *)(PCHGCompHeader+1)+PCHGCompHeader->TreeSize-2
- ; OriginalSize - The original length of the compressed data.
- ; If you're unpacking a standard PCHG chunk,
- ; you should set this entry to
- ; PCHGCompHeader->OriginalSize
- ;
- ; RESULT
- ; None.
- ;
- ; EXAMPLE
- ;
- ; NOTES
- ;
- ; BUGS
- ;
- ; SEE ALSO
- ;
- ;****************************************************************************
- ;
- ;
- ; void __asm PCHG_FastDecomp( register __a0 void *Source,
- ; register __a1 void *Dest,
- ; register __a2 WORD *TreeCode,
- ; register __d0 ULONG OriginalSize);
- ;
- ;
- ; d1: bits in longword
- ; d2: longword
- ; d3: value fetched
- ; a3: pointer in the tree
-
- PCHG_FastDecomp movem.l d2/d3/a3,-(a7)
-
- moveq #0,d1
- move.l a2,a3
- bra.s Loop
-
- OffsetPointer add.w d3,a3
-
- Loop dbra d1,StillBits
- move.l (a0)+,d2
- moveq #31,d1
-
- StillBits add.l d2,d2
- bcc.s Case0
-
- move.w (a3),d3
- bmi.s OffsetPointer
-
- StoreValue move.b d3,(a1)+
- move.l a2,a3
- subq.l #1,d0
- bne.s Loop
- movem.l (a7)+,d2/d3/a3
- rts
-
- Case0 move.w -(a3),d3
- bmi.s Loop
- btst #8,d3
- bne.s StoreValue
- bra.s Loop
-
- END
-