	opt	C8+
	xref	_intin,_intout,_ptsin,_ptsout,_contrl
	xref	_loadlength,_delete,_createdir
	xref	_myfp,_aespb,_doalert
	xref	_addrin,_addrout,_global
	xdef	_savequick

*****************************************************************
*	This is the NEW save file bit, it'll handle all warnings*
*	except overwriting existing files handled by me		*
*	Call like this...SAVEQUICK(data.L,length.L)		*
*								*
*	Returns:
*			1.L	for complete success		*
*			-1.L	for some general error		*
*								*
*	I'll handle most general errors such as disk write	*
*	protected by asking if they wanna try again.		*
*****************************************************************
_savequick:
	move.l	4(sp),filelength
	move.l	8(sp),fileaddress
	movem.l	d1-d7/a0-a6,-(sp)
qretry:
	move    #1,-(SP)        ;Open file for write
	move.l  #_myfp,-(SP) 	;Address of filename
	move    #$3d,-(SP)
	trap    #1              ;Get handle number in D0
	addq.l  #8,SP
	cmpi.w	#-33,d0		;doesn't exist
	beq	qcreate
	tst.w	d0		;other error
	bmi	qdocn2
qcb:
	move.w	d0,-(sp)
	move.l  fileaddress,-(SP)
	move.l  filelength,-(SP)	;length to write in
	move    D0,-(SP)	;Handle
	move    #$40,-(SP)	;bios number
	trap    #1		;write file
	add.l   #12,SP
	tst.w	d0
	bmi	qfailwrite
	move    #$3E,-(SP)      ;Handle already on stack
	trap    #1              ;Close file
	addq.l  #4,SP
	moveq	#1,d0
qsaveback:
	movem.l	(sp)+,d1-d7/a0-a6
	rts
qcreate:
	move.w	#$0,-(sp)	;its a new file so I gotta create it
	move.l	#_myfp,-(sp)	;filename
	move.w	#$3c,-(sp)
	trap	#1
	addq.l	#8,sp
	tst.w	d0
	bmi.s	qdocn		;still something wrong
	move.w	d0,-(sp)	;put the handle on the stack
	bra	qcb
qdocn:
	lea	save1,a0
	bsr	_doalert
	cmpi.w	#1,_intout
	beq	qcreate
	moveq	#0,d0
	bra	qsaveback
qdocn2:
	lea	save1,a0
	bsr	_doalert
	cmpi.w	#1,_intout
	beq	qretry
	moveq	#0,d0
	bra	qsaveback
qfailwrite:
	lea	save2,a0
	bsr	_doalert
	cmpi.w	#1,_intout
	beq	qcb
	
	move    #$3E,-(SP)      ;Handle already on stack
	trap    #1              ;Close file
	addq.l  #4,SP
	moveq	#-1,d0
	bra	qsaveback
filelength:	dc.l	0
fileaddress:	dc.l	0
save1:
		dc.b	'[1][Cannot create file.|'
		dc.b	'Is the disk write protected ?]'
		dc.b	'[Try again|Cancel]',0,0
save2:
		dc.b	'[1][Cannot write file.|'
		dc.b	'Is the disk write protected ?]'
		dc.b	'[Try again|Cancel]',0,0
	even