summaryrefslogtreecommitdiff
path: root/Source/WriteChunkBytes.S
diff options
context:
space:
mode:
authorChristian A. Weber <chris@gna.ch>1992-05-15 03:24:13 +0000
committerChristian A. Weber <chris@gna.ch>1992-05-15 03:24:13 +0000
commitb4425496e443c1d95593a4b1cd22e0c84a114ed0 (patch)
tree55671e882649d03e1b7dc38cac5e534418894894 /Source/WriteChunkBytes.S
parent6f59b3d06fbda6695a495bc09c0607b20b0dd39b (diff)
downloadiff-library-b4425496e443c1d95593a4b1cd22e0c84a114ed0.tar.gz
iff-library-b4425496e443c1d95593a4b1cd22e0c84a114ed0.tar.bz2
iff-library-b4425496e443c1d95593a4b1cd22e0c84a114ed0.zip
Initial revision
Diffstat (limited to 'Source/WriteChunkBytes.S')
-rw-r--r--Source/WriteChunkBytes.S93
1 files changed, 93 insertions, 0 deletions
diff --git a/Source/WriteChunkBytes.S b/Source/WriteChunkBytes.S
new file mode 100644
index 0000000..68f1b44
--- /dev/null
+++ b/Source/WriteChunkBytes.S
@@ -0,0 +1,93 @@
+**
+** $Id: $
+** $Revision: $
+**
+** $Filename: WriteChunkBytes.S $
+** $Author: Christian A. Weber $
+** $Release: 21.1 $
+** $Date: 92/05/14 22:26:34 $
+**
+** iff.library/IFFL_WriteChunkBytes
+**
+** COPYRIGHT (C) 1987-1992 BY CHRISTIAN A. WEBER, BRUGGERWEG 2,
+** CH-8037 ZUERICH, SWITZERLAND. ALL RIGHTS RESERVED. NO PART
+** OF THIS SOFTWARE MAY BE COPIED, REPRODUCED, OR TRANSMITTED
+** IN ANY FORM OR BY ANY MEANS, WITHOUT THE PRIOR WRITTEN PER-
+** MISSION OF THE AUTHOR. USE AT YOUR OWN RISK.
+**
+
+
+ IDNT IFFL_WriteChunkBytes
+ SECTION text,CODE
+
+ INCLUDE "IffLib.i"
+
+ XREF SetError,ClearError
+ XDEF WriteChunkBytesFunc
+
+
+******* iff.library/IFFL_WriteChunkBytes ************************************
+*
+* NAME
+* IFFL_WriteChunkBytes -- Write data into the current chunk
+*
+* SYNOPSIS
+* success = IFFL_WriteChunkBytes( iff, buf, size )
+* D0 A0 A1 D0
+*
+* LONG IFFL_WriteChunkBytes( IFFL_HANDLE, APTR, LONG )
+*
+* FUNCTION
+* Writes "size" bytes from the specified buffer into the current chunk.
+*
+* INPUTS
+* iff - IFF file handle, from IFFL_OpenIFF().
+* buf - pointer to buffer area with bytes to be written.
+* size - number of bytes to write.
+*
+* RESULT
+* number of bytes written if successful or NULL if an error
+* occurred. Call IFFL_IFFError() to know what's going on.
+*
+* SEE ALSO
+* IFFL_PushChunk(), IFFL_PopChunk(), IFFL_IFFError()
+*
+*****************************************************************************
+
+WriteChunkBytesFunc:
+ movem.l d2-d3/a2/a5-a6,-(SP)
+ movea.l a6,a5 ; IFFBase für ClearError()
+ movea.l a0,a2 ; A2 : IFF-Handle
+ movea.l iffb_DOSBase(a5),a6 ; A6 : DOSBase
+
+ *** Daten in Chunk schreiben (Seek-Position ist schon richtig)
+
+ move.l ifffh_File(a2),d1
+ move.l a1,d2 ; Adresse
+ move.l d0,d3 ; Länge
+ JSRLIB Write
+ cmp.l d3,d0
+ bne.b .WriteError
+
+ *** Chunk-Grösse updaten
+
+ add.l d3,ifffh_ChunkSize(a2)
+
+ *** Okay
+
+ bsr ClearError ; Setzt auch D0 auf TRUE
+ bra.b .End
+
+ *** Schreibfehler oder Seekfehler
+
+.SeekError:
+.WriteError: moveq.l #IFFL_ERROR_WRITE,d0
+ bsr SetError ; Setzt auch D0 auf FALSE
+
+ *** Routine beenden
+
+.End: movem.l (SP)+,d2-d3/a2/a5-a6
+ rts
+
+
+ END