;	usage:	BIG_VIEW <iff filename>
;
;	This little programm show an IFF picture in a big size (each pixel
; is now 8*8 pixels on screen). You can move the picture by moving
; the mouse.
;	You can use any number of bitplanes (even 8!) but you'd better use
; a 320*200 or 320*256 image, but NO STENCIL!
;
;	This programm contain also the sourcecode of my iff de-packer, so
; it's perhaps useful for some poeples.
;	But I've put all the code in one single file, so the last peoples
; who still use seka can make some few modification to run this pg.
;	Run from CLI. But it won't crash from workbench!
;
;	You can freely use this source, but if you do it, justput a little
; message to tell from where  you've take it, or even better, send me your
; realisations!
;

;	Sorry, but there is a little french lost inthe sourcecode!










	OPT	O1+	; optimise les branchements si possible (Cooool No?)
	OPT	O2+	; optimize adressing
	OPT	W-	; don't print warning
	OPT	C127+	; case sensitive

NB_CHG_LIG=46		; x resolution
NB_COL=NB_CHG_LIG
NB_OCT_LIG=NB_CHG_LIG*4+4
NB_LIG=265/8		; y resolution

NB_COL_TAB=320		; size of my buffer!
NB_LIG_TAB=200

	; ***********************************************
	; *                                             *
	; *    ###  # ####    #   # # #### #     #      *
	; *    #  #   #       #   #   #    #     #      *
	; *    # #  # # ##     # #  # ##    #   #       *
	; *    #  # # #  #     # #  # #     # # #       *
	; *    ###  # ####      #   # ####   # #        *
	; *                                             *
	; *                                             *
	; * File	: big_view.s			*
	; * Prog	: Thomas Landspurg		*
	; * Made in	: June 1990			*
	; * Object	: View an iff file in a big size*
	; *	Use Devpack 2.0 or more			*
	; ***********************************************


	;EXEC
execbase=	4
OpenLib=	-408
CloseLib=	-414
AllocMem=	-$c6
FreeMem=	-$d2
Forbid=		-132
Permit=		-138
FindTask=	-294
WaitPort=	-384
GetMsg=		-372
ReplyMsg=	-378


	;GRAPHICS
	;INTUITION
	;DOS
Open=	-30
Read=	-42
Write=	-48
Close=	-36
OutPut=	-60

	; CUSTOM EQUIVALENCES

COPRBASE=$dff000
CUSTOM=COPRBASE
DMACONR=2
JOY0DAT=$a
JOY1DAT=$c
BLTDDAT=$76
BLTADAT=$74
BLTBDAT=$72
BLTCDAT=$70
BLTAFWM=$44
BLTALWM=$46
BLTAMOD=$64
BLTBMOD=$62
BLTCMOD=$60
BLTDMOD=$66
BLTCON0=$40
BLTCON1=$42
BLTSIZE=$58
BLTAPTH=$50
BLTAPTL=$52
BLTBPTH=$4c
BLTCPTH=$48
BLTDPTH=$54
COP1LCH=$80
COPJMP1=$88



MEMF_CHIP=2
MEMF_FAST=0
MEMF_CLEAR=$10000


	jmp	start

	; Usage: ALLOC_MEM <taille de la zone>,<attributs>,
	;		   <pointeur ou stocker le resultat >

ALLOC_MEM:macro
	move.l	\1,d0	; taille de la zone a allouer
	move.l	#\2,d1	; type d'allocation CHIP,FAST...
	move.l	execbase,a6
	jsr	AllocMem(a6)
	move.l	d0,\3	;adresse ou stocker le resultat
	endm

	; usage : FREE_MEM <taille de la zone>,
	;		   <pointeur sur la zone >

FREE_MEM:macro
	move.l	\1,d0
	move.l	\2,a1
	move.l	execbase,a6
	jsr	FreeMem(a6)
	endm

	; PRINT	<adresse du texte>
PRINT:	macro
	lea	\1,a0
	bsr	_print
	endm

	; ####################
	; the printing routine
	; ####################
_print:
	clr.l	d0
	clr.l	d3
	move.l	a0,d2	; d2 pointer to the text
next_pr:
	tst.b	(a0)+	; get the size of the text
	beq.s	found
	addq.w	#1,d3	; d3 contain this size
	bra.s	next_pr	
found:
	move.l	save_output(pc),d1
	move.l	dosbase,a6
	jsr	Write(a6)	; write this text
	rts

start:
	move.l	a0,argv		; save pointer to the argument
	move.w	d0,argsize	; size of the argument

	clr.l	WBenchMsg	; workbench startup
	move.l	execbase,a6
	sub.l	a1,a1
	jsr	FindTask(a6)
	move.l	d0,a4
	tst.l	$ac(a4)		; do we came from the workbench?
	bne	du_cli		; from cli!
	lea	$5c(a4),a0	; so, we came from the wbench
	jsr	WaitPort(a6)
	lea	$5c(a4),a0
	jsr	GetMsg(a6)
	move.l	d0,WBenchMsg	; get workbench msg
	jsr	Forbid(a6)
	move.l	WBenchMsg,a1
	jsr	ReplyMsg(a6)	; reply it
	moveq	#0,d0		; byebye
	rts

WBenchMsg:dc.l	0
argv:	dc.l	0
argsize:dc.w	0
save_output:
	dc.l	0
du_cli:
	bsr	openlib		; open the librairies!

	move.l	dosbase(pc),a6
	jsr	OutPut(a6)
	move.l	d0,save_output	; get the standart output

	move.w	argsize(pc),d0
	cmp.w	#1,d0		; do we have one arg?
	bne.s	ok_arg		; ifso, that's ok!
	PRINT	usage		; if no, print a little message
	bra.s	out_1
ok_arg:
	move.l	argv(pc),a0
	clr.b	-1(a0,d0.w)
	move.l	a0,pname
	move.l	#pcustom,pbitpl	; chargement de l'image
	bsr	read_iff
	tst.l	d0
	bne.s	out_2		; if d0=0 then no error!
	bsr	init_fond

	move.l	#pcustom,pbitpl	; we can free the picture now!
	bsr	free_iff

	PRINT	info_texte
	bsr	initcop
cont_mouse:
	bsr	sync
	bsr	mouse
	bsr	init_col
	btst	#6,$bfe001
	bne	cont_mouse

	bsr	freecop
out_1:
	bsr	closelib
	rts
out_2
	PRINT	iff_error
	bra.s	out_1

waitb:
	btst	#6,$bfe001
	bne	waitb
	rts

OPENLIB:macro
	move.l	#\1,a1	; nom de la librairie
	move.l	execbase,a6
	jsr	OpenLib(a6)
	move.l	d0,\2	; pointeur
	endm

FREELIB:macro
	move.l	\1,a1
	move.l	execbase,a6
	jsr	CloseLib(a6)
	endm

openlib:
	OPENLIB	graphname,graphbase
	OPENLIB	dosname,dosbase
	rts
closelib:
	FREELIB	dosbase
	FREELIB	graphbase
	rts

dosname:dc.b	'dos.library',0
	even
dosbase:dcb.l	1
graphname:dc.b	'graphics.library',0
	even
graphbase:dcb.l	1

	; ###################
	; # SYNC WITH VBEAM #
	; ###################

sync:
	cmp.b	#$60,$dff006
	bne	sync
	rts


	; #############################
	; # HANDLE THE MOUSE POSITION #
	; #############################
	; sorry for not using intuition to get the mouse movment!
mouse:
	lea	CUSTOM,a5
	clr.w	d0
	move.w	old_mousey(pc),d1; old cont y
	move.b	JOY0DAT(a5),d0	; new cont y
	move.w	d0,old_mousey	; save 
	sub.b	d1,d0		; delta y
	ext.w	d0

	move.w	height(pc),d1	; take the y size of the picture
	sub.w	#NB_LIG,d1	; the y size of the vue
	add.w	mousey(pc),d0	; new y pos
	cmp.w	d1,d0		; don't get out of the picture!
	ble	pasmousey
	move.w	d1,d0
pasmousey
	cmp.w	#NB_LIG_TAB-NB_LIG,d0; don't get out of the picture!
	ble	pasmousey2
	move.w	#NB_LIG_TAB-NB_LIG,d0
pasmousey2
	cmp.w	#0,d0
	bge	pasmousey_b
	clr.w	d0
pasmousey_b
	move.w	d0,mousey
				; exactly the same with y!
	move.w	old_mousex(pc),d1
	move.b	JOY0DAT+1(a5),d0
	move.w	d0,old_mousex
	sub.b	d1,d0
	ext.w	d0
	add.w	mousex(pc),d0

	move.w	Width(pc),d1	; take the x size of the picture
	sub.w	#NB_COL,d1	; the x size of the vue

	cmp.w	d1,d0
	ble	pasmousex
	move.w	d1,d0
pasmousex
	cmp.w	#0,d0
	bge	pasmousex2
	clr.w	d0
pasmousex2	
	move.w	d0,mousex
	rts
old_mousex:			; value of the mouse counter
	dc.w	0
old_mousey:
	dc.w	0
mousex:	dc.w	0		; value of the mouse position
mousey:	dc.w	0


	; ##########################
	; # CREATE THE COPPER LIST #
	; ##########################

init_col:
	clr.l	d0
	move.w	mousex(pc),d0
	move.w	mousey(pc),d1
	mulu	#160,d1		;
	add.l	d1,d1		; there is 320 bytes (160*2) per line
	add.l	d1,d0
	add.l	d0,d0		; in fact, the size of a color pixel is in word!

	move.l	#$180000,d2	; d2 will contain the value of the color
	move.l	p_col(pc),a0	; get the copperlist pointer
	lea	tab_fond,a2	; get the pointer to 'pixels colors'
 	lea	(a2,d0.l),a2	; 
	lea	4+2(a0),a0	; skip the first wait
	clr.w	d0	
	move.w	#NB_LIG-1,d6		; nombre de lignes
next_ligne
	move.l	a2,a1

	rept	NB_CHG_LIG	; we made a like-ST programmation!
	movem.w	(a1)+,d2
	move.w	d2,0*NB_OCT_LIG(a0)
	move.w	d2,1*NB_OCT_LIG(a0)
	move.w	d2,2*NB_OCT_LIG(a0)
	move.w	d2,3*NB_OCT_LIG(a0)
	move.w	d2,4*NB_OCT_LIG(a0)
	move.w	d2,5*NB_OCT_LIG(a0)
	move.w	d2,6*NB_OCT_LIG(a0)
	move.w	d2,7*NB_OCT_LIG(a0)

	lea	4(a0),a0
	endr			; end of Repeat!

	lea	NB_OCT_LIG*7+4(a0),a0	; get the pointer of the next line
	lea	320*2(a2),a2		; posy++
	dbf	d6,next_ligne
	rts


	; ########################################
	; # CREATE THE COPPERLIST THE FIRST TIME #
	; ########################################

init_col_first:
	move.l	p_col,a0
	move.w	#$282d,d5	; first wait
	move.w	#NB_LIG*8,d6		; nombre de lignes
next_ligne1
	move.w	d5,(a0)+
	add.w	#$0100,d5
	move.w	#$fffe,(a0)+
	move.w	#NB_CHG_LIG-1,d7; nombre de changement de col dans une lignes
next_col1
	move.w	#$180,(a0)+
	move.w	d2,(a0)+
	dbf	d7,next_col1
	dbf	d6,next_ligne1
	rts


	; ####################################################
	; # CREATE THE TAB WITH THE VALUE OF THE COLOR PIXEL #
	; ####################################################
	; NO OPTIMIZED!
	; Could have been greatly optimized, just for this case,
	; but I don't made it!

init_fond:
	move.w	depth,d0		; number of bitplanes
	mulu	#40,d0
	move.w	d0,taille_all_ligne	; just for don't make mulu each time!

	move.l	spr_adr0(pc),a0		; pointer to the picture
	lea	tab_fond,a1		; pointer to this table
	lea	ctab,a3			; color tab
	clr.w	d1
i_next_ligne:
	clr.w	d0
i_next_col:
	bsr	get_col
	move.w	d2,$dff180		; to see something!
	move.w	d2,(a1)+		; save the value!
	addq.w	#1,d0
	cmp.w	#NB_COL_TAB,d0		; we just 320 pixels
	bne.s	i_next_col		; next column
	move.w	taille_all_ligne,d0
	lea	(a0,d0.w),a0
	addq.w	#1,d1
	cmp.w	#NB_LIG_TAB,d1		; and 200 lines,no more!
	bne.s	i_next_ligne		; next line
	rts
taille_all_ligne:
	dc.w	0

	; ##############################
	; # GET THE COLOR OF ONE PIXEL #
	; ##############################

get_col:
	movem.w	d0-d1/d3,-(a7)
	move.w	d0,d3
	lsr.w	#3,d0
	not.w	d3
	and.w	#$7,d3
	clr.w	d2
	add.w	taille_all_ligne(pc),d0
	sub.w	#40,d0
	move.w	depth,d1		; number of bitplanes
	subq	#1,d1
next_pl
	btst	d3,(a0,d0.w)		; test the value of this bitplane
	beq.s	pas_col
	addq.w	#1,d2
pas_col:
	rol.w	#1,d2			; d2=color number
	sub.w	#40,d0
	dbf	d1,next_pl		; next bitplane
	move.w	(a3,d2.w),d2		; save the color value
	movem.w	(a7)+,d0-d1/d3
	rts
	

	; ################################
	; # CREATE THE WHOLE COPPER LIST #
	; ################################

taillecop=NB_OCT_LIG*NB_LIG*8+1000	; size of the copperlist

initcop:
	ALLOC_MEM #taillecop,MEMF_CHIP|MEMF_CLEAR,coplista

	move.l 	coplista(pc),a0	; adresse de la copper list
	lea	mycop(pc),a1	; we put the first part in memory
tfrcop:	move.l	(a1)+,(a0)+
	cmp.l	#fincop,a1
	bne.s	tfrcop

	move.l	a0,p_col
	bsr	init_col_first	; creation of the main part!

	move.l	#$fffffffe,(a0)+; end of the copperlist

	move.l	graphbase,a0
	lea	$32(a0),a0
	move.l	a0,adrcop	; save the pointer current copperlist pointer
	move.l	(a0),oldcop	; save the current copperlist
				; but you'd better use the view structure, to
				; get these infos!
	move.l	coplista(pc),(a0)
	lea	COPRBASE,a5
;	move.l	coplista(pc),COP1LCH(a5)
;	clr.w	COPJMP1(a5)
	rts

	; ##########################
	; # RESTORE THE COPPERLIST #
	; ##########################

freecop:
	move.l	graphbase(pc),a0
	move.l	oldcop,$32(a0)
	move.l	$26(a0),COPRBASE+COP1LCH

	FREE_MEM	#taillecop,coplista

	rts

	; WAIT <Line number>
WAIT:	macro
	dc.w	(\1<<8+1),$fffe
	endm
	; METCOL <Color Value>
METCOL:	macro
	dc.w	$180,\1
	endm
	; first part of the copperlist
mycop:
	dc.w	$1081,$fffe
	dc.w	$180,0
	dc.w	$130,0,$132,0,$134,0,$136,0
	dc.w	$138,0,$13a,0,$13c,0,$13e,0
	dc.w	$008e,$2581
	dc.w	$0090,$40c1
	dc.w	$0092,$0038
	dc.w	$0094,$00cc
	dc.w	$0100,0
	dc.w	$0180,$00
	dc.w	$102,0
fincop:

p_col:dc.l	0
coplista:	dc.l	0
adrcop:	dc.l	0
oldcop:	dc.l	0
flagcop:dc.b	0
	even

	; used by the iff de-packer
pcustom:
custtscr:dc.l	0	; size of the picture
spr_adr0:dcb.l	5	; pointer to the bitplanes

usage:
	dc.b	'Usage: BIGVIEW <iff name>',$0a,$0d,0
iff_error:
	dc.b	'Bigview: error with the IFF file!',$0a,$0d,0
info_texte:
	dc.b	'BIGVIEW by Thomas LANDSPURG @ July 1990',$0a,$0d
	dc.b	'For NewsFlash ',$0a,$0d,0
	even


; ---------------------------------------------------------------
; Start of the iff de-packer (normally in include file!)
; ---------------------------------------------------------------




	;################################
	;######  DECOMPACTEUR IFF #######
	;################################
	; This was my first asm programm, so
	; don't blame me for the strange coding!
	;
	; use	read_iff to load an image
	;               if  p_name contain a pointer to the picture name
	;              and  p_bitpl conatin a pointer to my 'screen structure'
	;
	; use   free_iff to free a picture
	;
	; my 'screen structure' look like this:
	;     struct_screen:
	;	size:dc.l	0 ; size of the picture
	;       bitpl0:dc.l	0 ; pointer to the first bitplane
	;       bitpl1:dc.l	1 ; pointer to the second bitplane
	;          ect......

IFF_ERROR=1
IFF_NO_ERROR=0

read_iff:
	bsr	ouvfichier		; ouverture du fichier
	tst	d0
	beq	iff_fin3		; erreur pendant l'ouverture

	move.l	dosbase,a6		; Read the first chunk
	move.l	filehd,d1
	move.l	#iff_en_tete,d2
	move.l	#12,d3
	jsr	Read(a6)

	lea	iff_en_tete,a0
	cmp.l	#'FORM',(a0)	; verification iff
	bne	iff_fin1
	cmp.l	#'ILBM',8(a0)	; verification image
	bne	iff_fin1

	move.l	4(a0),taille
	bsr	alloc		; memory allocation
	tst.l	d0
	beq	iff_fin1

	bsr	readf		; read the whole file
	bsr	fermfiche	; close this file

iff_loop:move.l	#8,d3		; get the 8 byte of the chunk
	bsr	readtamp
	move.l	tampon+4,d3	; longueur des data
	cmp.l	#'BMHD',tampon	; Bit Map HeaDer ?
	beq.s	chunk_bmhd
	cmp.l	#'CMAP',tampon	; donnees concernant la couleur
	beq.s	chunk_cmap
	cmp.l	#'BODY',tampon	; donnees des plans bitmaps
	beq	chunk_body

	bsr	readtamp	; don't take care of the other types!
	bra.s	iff_loop

		;----------- BMHD ---------
chunk_bmhd:
	bsr	readtamp
	clr.w	view_modes
	move.w	tampon,Width	; X size
	move.w	tampon+2,height	; Y size
	clr.w	depth		; 
	move.b	tampon+8,depth+1; number of bitplanes
	move.b	tampon+10,compr ; compression flag
	bra.s	iff_loop


		;----------- CMAP ---------
chunk_cmap:
	bsr	readtamp
top:	move.w	depth,d1	; calcul de 2 puissance depth
	move.l	#1,d0
	rol.l	d1,d0
	lea	tampon,a0
	lea	ctab,a1
	subq.w	#1,d0
loop_c:	sub	d1,d1
	move.l	d1,d2
	move.b	(a0)+,d1	; lecture du rouge
	rol.w	#4,d1		; division par 16
	move.b	(a0)+,d2	; lecture du vert
	add.w	d2,d1
	move.b	(a0)+,d2	; lecture du bleu
	ror.b	#4,d2		; division par 16
	add.w	d2,d1		; calcul de regtemp
	move.w	d1,(a1)		; stockage dans ctab
	addq.l	#2,a1
	dbf	d0,loop_c
	bra	iff_loop

		;----------- BODY ---------
chunk_body:
	moveq	#0,d0
	move.w	Width(pc),d0	; X size in pixels
	lsr.w	#3,d0		; X size in bytes
	mulu	height,d0	; Total Size of one bitplane
	move.l	d0,d2
	move.l	d0,tailleplan_iff ; save this size
	mulu	depth,d0	; Total size of the picture
	move.l	pbitpl,a5
	move.l	d0,taillescr_iff ; save this size for the de-packer
	move.l	d0,(a5)+	; and for the user
	moveq	#2,d1

	move.l	execbase,a6
	jsr	AllocMem(a6)
	tst.l	d0
	beq	iff_fin1

	move.l	pbitpl,a0
	addq.l	#4,a0
	move.w	depth,d3
	subq	#1,d3
loopb:	move.l	d0,(a0)+	; save the value of the pointers
	add.l	#40,d0
	dbeq	d3,loopb

	tst.b	compr		; algorithme de compression?
	beq	pas_compr

algdec:	clr.l	d7
	move.w	height,d7	; nombre de lignes dans D7
profloo:
	move.l	pbitpl,a5	; screenhandle dans A5
	add.l	#4,a5
	move.w	depth,d6	; profondeur dans D6
f1loop:	move.l	(a5)+,a4	; adresse du plan de bits dans A4
	clr.l	d1		; calcul foireux
	move.w	height,d1
	sub.w	d7,d1
	mulu	#40,d1
	mulu	depth,d1
	add.l	d1,a4
	clr.l	d5		; bcnt=0 dans D5
f2loop:	move.l	#1,d3		; lecture de incode
	bsr	readtamp
	cmp.b	#128,tampon	; incode>128?
	bhi	sup128

	move.l	a4,d2		; adresse ou charger la ligne
	clr.l	d3
	move.b	tampon,d3
	addq.w	#1,d3		; charger incode+1 donnees
	bsr	readdata	; lecture de la ligne
	add.l	d3,d5		; bcnt=bcnt+incode+1
	add.l	d3,a4		; adresse+incode+1
	bra	fligne

sup128:	clr.l	d4
	move.b	tampon,d4	; incode dans D4
	neg.b	d4		; 256-incode
	bsr	readtamp	; lecture d'un caractere(inbyte)
	move.b	tampon,d3	; inbyte=D3
bofloop:move.b	d3,(a4)+	; remplissage
	addq	#1,d5		; dcnt=dcnt+1
	dbf	d4,bofloop

fligne:	move.w	d5,d4		; d5 dans d4
	rol.l	#3,d4		; multuplie dcnt par 8
	or.w	#$1,d4
	cmp.w	Width,d4	; bcnt<rowbyte/8?
	blt	f2loop
nextlig:			; adresse du pointeur du p.de bit next
	cmp.w	#1,d6
	dbeq	d6,f1loop	; dernier plan? 
	cmp.w	#1,d7
	dbeq	d7,profloo	; derniere ligne?
	bra	iff_fin		; he ben alors c'est fini!!!

	; si pas d'algo de compression!

pas_compr:
	move.w	Width(pc),d4	; convertit le nb de pixel/ligne
	lsr.w	#3,d4		; en nb d'octets/ligne
	
	move.l	a3,a2		; a2 va pointer sur les donnes du fichier
	clr.l	d5		; d5 contient l'offset/debut du plan
	move.w	height,d7	; nombre de lignes dans D7

	move.l	pbitpl(pc),a5	; screenhandle dans A5
	add.l	#4,a5
	move.l	(a5),a0		; pointeur sur le plan de bitsuivant
	move.l	a0,d2
	moveq	#1,d3
profloo_n:
	move.w	depth(pc),d6	; profondeur dans D6
f1loop_n:
	move.w	d4,d0
next_ligne_n:
	bsr	readdata
	addq.l	#1,d2

	sub.w	#1,d0
	bne	next_ligne_n
	cmp.w	#1,d6
	dbeq	d6,f1loop_n	; dernier plan? 
	cmp.w	#1,d7
	dbeq	d7,profloo_n	; derniere ligne?
	bra	iff_fin

iff_fin:
	bsr	free		; tchao
	moveq.w	#IFF_NO_ERROR,d0
	rts

iff_fin2:			; error if file was not loaded
	bsr	free		; tchao
iff_fin1:
	bsr	fermfiche	; close file
iff_fin3:
	moveq.w	#IFF_ERROR,d0
	rts

ouvfichier:
	move.l	#1005,d2	;mode old
	move.l	dosbase,a6
	move.l	pname,d1
	jsr	Open(a6)
	move.l	d0,filehd
	rts

fermfiche:
	move.l	dosbase,a6
	move.l	filehd,d1
	jsr	Close(a6)
	rts

readf:	move.l	dosbase,a6
	move.l	filehd,d1
	move.l	base,d2
	move.l	taille,d3
	jsr	Read(a6)
	rts

readtamp:move.l	#tampon,d2
readdata:
	movem.l	a1/a2/d3,-(a7)
	move.l	d2,a1
	move.l	adr,a2
loop_r:	move.b	(a2)+,(a1)+
	subq	#1,d3
	bne	loop_r
	move.l	a2,adr
	movem.l	(a7)+,a1/a2/d3
	rts
error:
	move.l	#-1,d7
	rts

alloc:	move.l	execbase,a6
	move.l	taille,d0
	move.l	#$10002,d1
	jsr	AllocMem(a6)
	move.l	d0,base
	move.l	d0,adr
	rts
free:	move.l	execbase,a6
	move.l	base,a1
	move.l	taille,d0
	jsr	FreeMem(a6)
	rts

free_iff:
	move.l	execbase,a6
	move.l	pbitpl,a1
	move.l	(a1)+,d0
	move.l	(a1),a1
	move.l	(a1),d1
	tst.l	d1
	beq.s	error_iff
	jsr	FreeMem(a6)
error_iff:
	rts


tailleplan_iff:	dc.l	0
taillescr_iff:	dc.l	0
taille:	dc.l	0
filehd:	dc.l	0
compr:	dcb.w	1	; drapeau indiquant un alogorythme de comp.
base:	dcb.l	1	; adresse du debut du programme
adr:	dcb.l	1	; adresse du pointeur sur le programme
depth:	dc.w	0
height:	dc.w	0
Width:	dc.w	0
view_modes:dc.w	0
pname:dc.l	0
pbitpl:dc.l	0
	section	IFF_DATA,BSS
tampon:	dcb.b	300	; memoire tampon
ctab:	dcb.w	32	; tableau des couleurs
iff_en_tete:	dcb.b	12,0

; ---------------------------------------------------------------
; endt of the iff de-packer (normally in include file!)
; ---------------------------------------------------------------

	section	fond,BSS
tab_fond:
	dcb.w	320*200

