diff options
author | Christian A. Weber <chris@gna.ch> | 1992-05-17 03:27:44 +0000 |
---|---|---|
committer | Christian A. Weber <chris@gna.ch> | 1992-05-17 03:27:44 +0000 |
commit | 66ed983098f631f3f3b93eebf3b162e9b0996479 (patch) | |
tree | 06d70708fa2542e84c734b16dc8abc8dddf3054e | |
parent | e11f00aad3ad4846e7ef31a56a78836b6f1a6478 (diff) | |
download | iff-library-66ed983098f631f3f3b93eebf3b162e9b0996479.tar.gz iff-library-66ed983098f631f3f3b93eebf3b162e9b0996479.tar.bz2 iff-library-66ed983098f631f3f3b93eebf3b162e9b0996479.zip |
Autodocs vervollständigt, Modus-Abfrage korrigiert
-rw-r--r-- | Source/CompressBlock.S | 40 | ||||
-rw-r--r-- | Source/DecompressBlock.S | 51 |
2 files changed, 54 insertions, 37 deletions
diff --git a/Source/CompressBlock.S b/Source/CompressBlock.S index 36bed53..9bec2d3 100644 --- a/Source/CompressBlock.S +++ b/Source/CompressBlock.S @@ -1,11 +1,11 @@ ** -** $Id: CompressBlock.S,v 2.1 92/05/13 01:48:05 chris Exp $ -** $Revision: 2.1 $ +** $Id: CompressBlock.S,v 21.1 92/05/15 03:23:52 chris Exp $ +** $Revision: 21.1 $ ** ** $Filename: CompressBlock.S $ ** $Author: chris $ ** $Release: $ -** $Date: 92/05/13 01:48:05 $ +** $Date: 92/05/15 03:23:52 $ ** ** iff.library/IFFL_CompressBlock ** @@ -22,9 +22,10 @@ INCLUDE "IffLib.i" - XREF ClearError + XREF SetError XDEF CompressBlockFunc + XDEF Compress_NONE,Compress_BYTERUN1 ;,Compress_FIBDELTA ******* iff.library/IFFL_CompressBlock ************************************** * @@ -48,10 +49,15 @@ * size - Number of data bytes to compress * mode - Compression mode. Currently, the following modes * are supported: -* $$$ +* +* IFFL_COMPR_NONE - Vanilla copy +* IFFL_COMPR_BYTERUN1 - CmpByteRun1 (ILBM BODY data) +* IFFL_COMPR_FIBDELTA - Fibonacci Delta (8SVX BODY data) * * RESULTS * Length of compressed data or 0 if an error occurred. +* IFFL_IFFError() returns IFFL_ERROR_BADCOMPRESSION if you ask for +* an unsupported compression mode. * * SEE ALSO * IFFL_DecompressBlock() @@ -59,17 +65,23 @@ ***************************************************************************** CompressBlockFunc: - tst.l d1 ; Modus == 0 ? - beq.b Mode_Copy - subq.l #1,d1 ; Modus == 1 ? - beq.b Mode_CmpByteRun1 - moveq.l #0,d0 + subq.l #1,d1 + beq.b Compress_BYTERUN1 ; Modus == 1 + bmi.b Compress_NONE ; Modus == 0 + + *** Unbekannter Modus --> Error setzen + + movem.l a5-a6,-(SP) + movea.l a6,a5 ; A5 : IFFBase für SetError() + moveq.l #IFFL_ERROR_BADCOMPRESSION,d0 + bsr SetError ; Setzt auch D0 auf 0 + movem.l (SP)+,a5-a6 rts ***************************************************************************** -** Kopiermodus +** Kopiermodus (für CompressBlock() UND DecompressBlock() benutzt) -Mode_Copy: movem.l d0/a6,-(SP) +Compress_NONE: movem.l d0/a6,-(SP) movea.l iffb_SysBase(a6),a6 JSRLIB CopyMem movem.l (SP)+,d0/a6 @@ -78,7 +90,7 @@ Mode_Copy: movem.l d0/a6,-(SP) ***************************************************************************** ** CmpByteRun1 komprimieren -Mode_CmpByteRun1: +Compress_BYTERUN1: movem.l d2-d3/a2-a3,-(SP) lea (a0,d0.l),a2 ; A2 : Source-Endadresse moveq #0,d3 ; Byte-Zähler @@ -140,5 +152,5 @@ CountEq: move.l a0,-(SP) 3$: move.l (SP)+,a0 rts - END + END diff --git a/Source/DecompressBlock.S b/Source/DecompressBlock.S index 54f2fec..9a50da0 100644 --- a/Source/DecompressBlock.S +++ b/Source/DecompressBlock.S @@ -1,11 +1,11 @@ ** -** $Id: DecompressBlock.S,v 2.1 92/05/13 01:48:41 chris Exp $ -** $Revision: 2.1 $ +** $Id: DecompressBlock.S,v 21.1 92/05/15 03:23:32 chris Exp $ +** $Revision: 21.1 $ ** ** $Filename: DecompressBlock.S $ ** $Author: chris $ ** $Release: $ -** $Date: 92/05/13 01:48:41 $ +** $Date: 92/05/15 03:23:32 $ ** ** iff.library/IFFL_DecompressBlock ** @@ -22,9 +22,12 @@ INCLUDE "IffLib.i" - XREF ClearError + XREF SetError XDEF DecompressBlockFunc + XREF Compress_NONE + XDEF Decompress_BYTERUN1 ;,Decompress_FIBDELTA + ******* iff.library/IFFL_DecompressBlock ************************************ * @@ -45,13 +48,18 @@ * INPUTS * source - Pointer to data to decompress * destination - Target address for decompression -* size - Number of data bytes to decompress +* size - Number of _DECOMPRESSED_ data bytes * mode - Compression mode. Currently, the following modes * are supported: -* $$$ +* +* IFFL_COMPR_NONE - Vanilla copy +* IFFL_COMPR_BYTERUN1 - CmpByteRun1 (ILBM BODY data) +* IFFL_COMPR_FIBDELTA - Fibonacci Delta (8SVX BODY data) * * RESULTS * Length of uncompressed data or 0 if an error occurred. +* IFFL_IFFError() returns IFFL_ERROR_BADCOMPRESSION if you ask for +* an unsupported compression mode. * * SEE ALSO * IFFL_CompressBlock() @@ -59,27 +67,24 @@ ***************************************************************************** DecompressBlockFunc: - tst.l d1 ; Modus == 0 ? - beq.b Mode_Copy - subq.l #1,d1 ; Modus == 1 ? - beq.b Mode_CmpByteRun1 - moveq.l #0,d0 - rts + subq.l #1,d1 + beq.b Decompress_BYTERUN1 ; Modus == 1 + bmi Compress_NONE ; Modus == 0 -***************************************************************************** -** Kopiermodus + *** Unbekannter Modus --> Error setzen -Mode_Copy: movem.l d0/a6,-(SP) - movea.l iffb_SysBase(a6),a6 - JSRLIB CopyMem - movem.l (SP)+,d0/a6 + movem.l a5-a6,-(SP) + movea.l a6,a5 ; A5 : IFFBase für SetError() + moveq.l #IFFL_ERROR_BADCOMPRESSION,d0 + bsr SetError ; Setzt auch D0 auf 0 + movem.l (SP)+,a5-a6 rts ***************************************************************************** ** CmpByteRun1 dekomprimieren -Mode_CmpByteRun1: - move.l d2,-(SP) +Decompress_BYTERUN1: + movem.l d0/d2,-(SP) 1$: moveq.l #0,d1 move.b (a0)+,d1 ; D1 : nächstes Kommando-Byte @@ -94,14 +99,14 @@ Mode_CmpByteRun1: bmi.b 3$ ; ~$80 (== $80) ist 'NOP' move.b (a0)+,d2 ; Zu repetierender Wert .RepLoop: move.b d2,(a1)+ - subq.l #1,d0 ; DEC ColumnCounter + subq.l #1,d0 ; DEC length counter dble d1,.RepLoop 3$: tst.l d0 ; Linie fertig ? (Braucht's das tst??) bgt.b 1$ ; noch nicht ---> Loop - move.l (SP)+,d2 + movem.l (SP)+,d0/d2 rts - END + END |