summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian A. Weber <chris@gna.ch>1992-05-26 18:00:52 +0000
committerChristian A. Weber <chris@gna.ch>1992-05-26 18:00:52 +0000
commite51b49e22660432064600b2062915a9a02df442b (patch)
treed09e6e33839b46259ff7a213751c45e02d2fecc9
parent7c14cecd9030fc7d09ea69788012d32fe2852d72 (diff)
downloadiff-library-e51b49e22660432064600b2062915a9a02df442b.tar.gz
iff-library-e51b49e22660432064600b2062915a9a02df442b.tar.bz2
iff-library-e51b49e22660432064600b2062915a9a02df442b.zip
xpk eingebaut (läuft noch nicht...)
-rw-r--r--Source/OpenIFF.S69
1 files changed, 45 insertions, 24 deletions
diff --git a/Source/OpenIFF.S b/Source/OpenIFF.S
index 16e4137..1fbb470 100644
--- a/Source/OpenIFF.S
+++ b/Source/OpenIFF.S
@@ -1,11 +1,11 @@
**
-** $Id: OpenIFF.S,v 21.2 92/05/17 03:27:14 chris Exp $
-** $Revision: 21.2 $
+** $Id: OpenIFF.S,v 21.3 92/05/17 04:40:45 chris Exp $
+** $Revision: 21.3 $
**
** $Filename: OpenIFF.S $
** $Author: chris $
** $Release: 19.1 $
-** $Date: 92/05/17 03:27:14 $
+** $Date: 92/05/17 04:40:45 $
**
** iff.library/IFFL_OpenIFF
**
@@ -43,6 +43,11 @@
* file or not. If it is an IFF file, memory is allocated and the file
* is read into memory.
*
+* New for V22:
+* If xpkmaster.library is installed in your system, IFFL_OpenIFF()
+* will be able to read and decompress compressed IFF files, if they
+* use one of the xpk standard compression schemes.
+*
* If mode == IFFL_MODE_WRITE:
* Initializes an IFF file handle for writing. You may create chunks
* with IFFL_PushChunk() and IFFL_PopChunk(), and you can write data
@@ -133,20 +138,13 @@ OpenIFFFunc: movem.l d2-d6/a2/a5-a6,-(SP)
* NewOpenIFF -- allocate memory for an IFF-file and read it
*
* SYNOPSIS
-* >>> THIS FUNCTION IS OBSOLETE. USE IFFL_OpenIFF() INSTEAD <<<
-*
* ifffile = NewOpenIFF( filename, memattr )
* D0 A0 D0
*
* IFFFILE OpenIFF( char * )
*
* FUNCTION
-* This function opens a file on a disk and looks whether it's an IFF
-* file or not. If it is an IFF file, memory is allocated and the file
-* is read into memory. The 'memattr' argument is taken to define the
-* memory type. Normally memattr is set to MEMF_ANY or MEMF_PUBLIC.
-* If an error occurs, NULL is returned, and you can call
-* IFFError() to get the error number.
+* THIS FUNCTION IS OBSOLETE. USE IFFL_OpenIFF() INSTEAD.
*
* INPUTS
* filename - Pointer to a null-terminated string
@@ -160,7 +158,7 @@ OpenIFFFunc: movem.l d2-d6/a2/a5-a6,-(SP)
* the reason of the failure.
*
* SEE ALSO
-* OpenIFF(), CloseIFF(), IFFError()
+* IFFL_OpenIFF(), IFFL_CloseIFF(), IFFL_IFFError()
*
* BUGS
* None known
@@ -179,20 +177,13 @@ OldNewOpenIFFFunc:
* OpenIFF -- allocate memory for an IFF-file and read it
*
* SYNOPSIS
-* >>> THIS FUNCTION IS OBSOLETE. USE IFFL_OpenIFF() INSTEAD <<<
-*
* ifffile = OpenIFF( filename )
* D0 A0
*
* IFFFILE OpenIFF( char * )
*
* FUNCTION
-* This function does the same as the NewOpenIFF() routine
-* above, except that you cannot specify the type of memory which is
-* allocated for the file. Normally the type is 0 which means 'any
-* memory', but if the IFF file type is '8SVX', the file is ALWAYS
-* loaded into CHIP memory. If you wish to override these defaults,
-* use NewOpenIFF() instead of OpenIFF().
+* THIS FUNCTION IS OBSOLETE. USE IFFL_OpenIFF() INSTEAD.
*
* INPUTS
* filename - Pointer to a null-terminated string
@@ -206,7 +197,7 @@ OldNewOpenIFFFunc:
* None
*
* SEE ALSO
-* NewOpenIFF(), CloseIFF(), IFFError()
+* IFFL_OpenIFF(), IFFL_CloseIFF(), IFFL_IFFError()
*
*****************************************************************************
@@ -239,10 +230,40 @@ ReadMode: movea.l a6,a5 ; A5 : IFFBase
moveq.l #12,d3 ; Len
JSRLIB Read ; erste 3 Longwords lesen
cmpi.l #'FORM',(SP)
- beq.b 2$
+ beq.b .IsIFF
+
+ *** Es ist kein IFF. Testen ob's ein xpk-gepacktes IFF ist.
+
+ lea XpkName(PC),a1
+ movea.l iffb_SysBase(a5),a6
+ JSRLIB OldOpenLibrary
+ tst.l d0 ; xpk.library geöffnet ?
+ beq.b .NotIFF ; nope --->
+
+ movea.l d0,a6 ; XpkBase
+ lea -xf_SIZEOF(SP),SP ; Platz für FIB
+ movea.l SP,a0 ; fib für XpkExamine()
+ clr.l -(SP) ; TAG_DONE
+ move.l d4,-(SP) ; Filehandle
+ pea XPK_InFH ; TagItem
+ movea.l SP,a1 ; Tags
+ JSRLIB XpkExamine
+ tst.l d0
+ bne.b .XpkNotIFF ; Error --->
+
+ cmpi.l #'FORM',3*4+xf_Head(SP)
+ bne.b .XpkNotIFF
+
+.XpkNotIFF:
+ moveq #IFFL_ERROR_NOTIFF,d5
+ bra.b .XpkError
+.XpkError:
+ lea xf_SIZEOF+3*4(SP),SP
+
+.NotIFF:
moveq #IFFL_ERROR_NOTIFF,d5
bra.b .Error1 ; --->
-2$:
+.IsIFF:
*** Testen ob Chip-Speicher erwünscht (bei 8SVX-Files)
move.l d6,d1 ; Default-Requirements
@@ -257,7 +278,7 @@ ReadMode: movea.l a6,a5 ; A5 : IFFBase
moveq.l #12,d2 ; 'Remember' + FORM....
move.l 4(SP),d3 ; D3 : FORM-Länge
add.l d3,d2 ; D2 : Gesamtlänge
- subq.l #4,d3 ; FUCK!!! IFF-Typ ist ja schon gelesen!
+ subq.l #4,d3 ; FUCK!!! IFF-Typ ist ja schon gelesen!
move.l d2,d0
movea.l iffb_SysBase(a5),a6
JSRLIB AllocMem ; requirements von D1