	incdir ":include/"
	include "exec/exec_lib.i"
	include "intuition/intuition_lib.i"
	include "libraries/dosextens.i"
	include "libraries/dos_lib.i"
	include "iff/iff.i"
 	include "intuition/intuition.i"
 	
openint:
	lea intname,a1
	clr.l d0
	CALLEXEC OpenLibrary
	move.l d0,_IntuitionBase
openifflib:
	lea iffname,a1
	clr.l d0
	CALLEXEC OpenLibrary
	move.l d0,_IFFBase
opendos:
	lea dosname,a1
	clr.l d0
	CALLEXEC OpenLibrary
	move.l d0,_DOSBase
scropen:
	lea screen_devs,a0
	CALLINT OpenScreen
	move.l d0,screenhd
start:
	move.l #MODE_OLDFILE,d2
	move.l #name,d1
	CALLDOS Open
	move.l d0,file
	beq next
	move.l #sc_BitMap+bm_Planes,d5
loop1:
	move.l screenhd,a0
	move.l 0(a0,d5),d2
	move.l file,d1
	move.l #320*200/8,d3
	CALLDOS Read
	add.l #4,d5
	cmp.l #320*200/8,d0
	beq loop1
	move.l file,d1
	CALLDOS Close
	move.l screenhd,a0
	move.l 88(a0),d6		; BitMap
	move.l 48(a0),a1		; struct ColorTable
	move.l 4(a1),d7		; struct Colormap
	lea	44(a0),a1		; sc_ViewPort
	move.w 32(a1),d1		; vp_Modes
	moveq	#1,d0			; Cruncher-Flag setzen
	btst	#11,d1		; Hold And Modify ?
	beq.s	NoHam			; no --->
	bset	#7,d0			; Set HAM-Flag for iff.lib
NoHam:
	lea name1,a0		; Name of file to save
	move.l d6,a1		; Pointer to BitMap
	move.l d7,a2		; Pointer to ColorMap
	CALLIFF SaveBitMap	; SaveBitMap() !!!
next:
	lea name,a0
	addi.b #1,18(a0)
	lea name1,a0
	addi.b #1,15(a0)
	cmp.b #"z",18(a0)
	bne start
scrclose:
	move.l screenhd,a0
	CALLINT CloseScreen
closeint:
	move.l _IntuitionBase,a1
	CALLEXEC CloseLibrary
closeiff:
	move.l _IFFBase,a1
	CALLEXEC CloseLibrary
closedos:
	move.l _DOSBase,a1
	CALLEXEC CloseLibrary
	rts
	
	
screen_devs:
	x_pos:     dc.w 0
	y_pos:     dc.w 0
	width:     dc.w 320
	height:    dc.w 200
	depth:     dc.w 6
	detail_pen: dc.b 0
	block_pen:  dc.b 1
	view_modes: dc.w $800
	screen_type: dc.w 15
	font:      dc.l 0
	title:     dc.l titel
	gadgets:   dc.l 0
	bitmap:     dc.l 0

titel:   dc.b "arsch",0
name:	   dc.b "Ham-Bilder:picturea",0
name1:   dc.b "IFF-Bilder:Bilda",0

intname: INTNAME
iffname: IFFNAME
dosname: DOSNAME
	even
_IntuitionBase: dc.l 0
_IFFBase: dc.l 0
_DOSBase: dc.l 0
	even
screenhd: dc.l 0
file: dc.l 0
	dc.l    0
	dc.w  150
	dc.w   50
	dc.w  640
	dc.w  230
	dc.w   15
	even

