;----------------------------------------------------------------------------
;File name:	SAVER.S				Revision date:	1994.06.26
;----------------------------------------------------------------------------
;
	include	URAn_LA.S
	include	URAn_DOS.S
;
;----------------------------------------------------------------------------
;
	section	TEXT
;
;----------------------------------------------------------------------------
Begin:
	LEA	L0030,sp
	_a_init
	_a_hide_c
	gemdos	Super,!
	MOVE.L	D0,entry_ssp
	MOVEA.L	(phystop).W,A0
	ADDI.L	#$8000,(phystop).W
	MOVEA.L	A0,A5
	LEA	32032(A0),A0
	LEA	L001C,A1
	MOVEQ	#$F,D0
L0000:
	CMPM.B	(A0)+,(A1)+
	BNE	L0008
	dbra	d0,L0000
	gemdos	Dsetpath,L0024
	LEA	title_page_s,A6
	BSR	cconws_a6_sub
	BSR	scankey_sub
	LEA	L0028,A4
	MOVEQ	#$F,D3
L0001:
	MOVEQ	#$F,D0
	SUB.L	D3,D0
	xbios	Setcolor,d0,#-1
	MOVE.W	D0,(A4)+
	dbra	d3,L0001
	xbios	Physbase
	MOVEA.L	D0,A2
	MOVEA.L	A5,A0
	MOVE.L	#$3E7F,D0
	LEA	L0027,A1
L0002:
	MOVE.W	(A0)+,(A1)+
	dbra	d0,L0002
	MOVEQ	#$F,D0
	LEA	L0029,A1
L0003:
	MOVE.W	(A0)+,(A1)+
	dbra	d0,L0003
	LEA	L0027,A1
	MOVE.L	#$3E7F,D0
L0004:
	MOVE.W	(A1)+,(A2)+
	dbra	d0,L0004
	xbios	Setpalette,L0029
	BSR	scankey_sub
	LEA	what_pic_rez_s,A6
	BSR	cconws_a6_sub
L0005:
	BSR	scankey_sub
	CMP.B	#$26,D0
	BEQ.S	L000A
	CMP.B	#$32,D0
	BEQ	L0010
	CMP.B	#$23,D0
	BEQ	L0011
	CMP.B	#$10,D0
	BNE.S	L0005
L0006:
	xbios	Setpalette,L0028
	LEA	goodbye_release_s,A6
	BSR	cconws_a6_sub
L0007:
	BSR	scankey_sub
	CMP.B	#$15,D0
	BEQ.S	L0009
	CMP.B	#$31,D0
	BNE.S	L0007
	SUBI.L	#$8000,(phystop).W
	BRA.S	L0009
L0008:
	LEA	no_picture_there_s,A6
	BSR	cconws_a6_sub
	BSR	scankey_sub
	SUBI.L	#$8000,(phystop).W
L0009:
	_a_show_c
	gemdos	Super|_ind,entry_ssp
	gemdos	Pterm,#'PG'
;
;
L000A:
	LEA	what_pic_format_s,A6
	BSR	cconws_a6_sub
L000B:
	BSR	scankey_sub
	CMP.B	#$20,D0
	BEQ.S	L000F
	CMP.B	#$31,D0
	BEQ.S	L000C
	BRA.S	L000B
;
L000C:
	LEA	L002B,A1
	LEA	L0029,A0
	MOVEQ	#$F,D0
L000D:
	MOVE.W	(A0)+,(A1)+
	dbra	d0,L000D
	LEA	L0027,A0
	LEA	L002C,A1
	MOVE.L	#$3E7F,D0
L000E:
	MOVE.W	(A0)+,(A1)+
	dbra	d0,L000E
	LEA	enter_filename_s,A6
	BSR	cconws_a6_sub
	MOVE.L	#$7D80,D5
	BSR.S	L0015
	BRA	L0006
L000F:
	LEA	L002A,A1
	CLR.W	(A1)+
	BSR.S	L0012
	BRA	L0006
L0010:
	LEA	L002A,A1
	MOVE.W	#1,(A1)+
	BSR.S	L0012
	BRA	L0006
L0011:
	LEA	L002A,A1
	MOVE.W	#2,(A1)+
	BSR.S	L0012
	BRA	L0006
L0012:
	LEA	L0029,A0
	MOVEQ	#$F,D0
L0013:
	MOVE.W	(A0)+,(A1)+
	dbra	d0,L0013
	LEA	L0027,A0
	MOVE.L	#$3E7F,D0
L0014:
	MOVE.W	(A0)+,(A1)+
	dbra	d0,L0014
	LEA	enter_filename_s,A6
	BSR	cconws_a6_sub
	MOVE.L	#$7D22,D5
	BSR.S	L0015
	RTS
;
L0015:
	LEA	L002D,A0
	MOVE.B	#$28,(A0)
	gemdos	Cconrs,L002D
	gemdos	Dsetdta,L002F
	gemdos	Fsfirst,L002E,#-1
	TST.W	D0
	BMI	L0017
	LEA	file_exists_s,A6
	BSR.S	cconws_a6_sub
L0016:
	BSR.S	scankey_sub
	CMP.B	#$18,D0
	BEQ.S	L0017
	CMP.B	#$10,D0
	BEQ.S	L0018
	CMP.B	#$31,D0
	BNE.S	L0016
	LEA	enter_filename_s,A6
	BSR.S	cconws_a6_sub
	BRA.S	L0015
;
L0017:
	_a_show_c
	gemdos	Fcreate,L002E,!
	TST.W	D0
	BMI	L0019
	MOVE.W	D0,D3
	gemdos	Fwrite,d3,d5,L002A
	TST.W	D0
	BMI	L0019
	gemdos	Fclose,d3
	_a_hide_c
L0018:
	RTS
;
L0019:
	LEA	cannot_write_s,A6
	BSR.S	cconws_a6_sub
	BSR.S	scankey_sub
	RTS
;
;
cconws_a6_sub:
	gemdos	Cconws|_ind,a6
	RTS
;
;
scankey_sub:
	gemdos	Crawcin
	SWAP	D0
	RTS
;
;----------------------------------------------------------------------------
;
	section	DATA
;
;----------------------------------------------------------------------------
;
L001C:
	dc.b	'Picture Grabber!'
no_picture_there_s:
	dc.b	ESC,'E'
	dc.b	'Are you sure you have grabbed a',$0A,$0D
	dc.b	'picture ? There are no picture',$0A,$0D
	dc.b	'there it should be ... ',$0A,$0D
	dc.b	'Thanks for running me anyway!',NUL
title_page_s:
	dc.b	$1B,'E'
	dc.b	'************* Saver v. 2.0 *************',$0A,$0D
	dc.b	$0A,$0D
	dc.b	'100 % Assembly Language (Wow !!!)',$0A,$0D
	dc.b	'(I did it because I wanted to code some',$0A,$0D
	dc.b	'not good looking code...)',$0A,$0D
	dc.b	$0A,$0D
	dc.b	$0A,$0D
	dc.b	"Hi to everybody ..., 'specially myself!",$0A,$0D
	dc.b	$0A,$0D
	dc.b	'PATH = A:\'
	dc.b	ESC,'Y7.'
	dc.b	'Press A Key!',$0A,$0D
	dc.b	$00
what_pic_rez_s:
	dc.b	ESC,'H'
	dc.b	'What resolution is this picture ?'
	dc.b	ESC,'K',$0A,$0D
	dc.b	'(L)ow, (M)edium, (H)igh or (Q)uit '
	dc.b	ESC,'K',$00
what_pic_format_s:
	dc.b	$0A,$0D
	dc.b	'What picture format ? '
	dc.b	ESC,'K',$0A,$0D
	dc.b	'(N)eochrome or (D)egas'
	dc.b	ESC,'K',$00
	dc.b	ESC,'E',$00
cannot_write_s:
	dc.b	ESC,'E'
	dc.b	"Can't write to disc",$0A,$0D
	dc.b	"the right way, so I'll quit.',$00
enter_filename_s:
	dc.b	$0A,$0D
	dc.b	'Enter filename (if no path, A:\ is'
	dc.b	ESC,'K',$0A,$0D
	dc.b	'presumed, max 40 letters) Filename :'
	dc.b	ESC,'K',$0A,$0D
	dc.b	ESC,'K',$00
file_exists_s:
	dc.b	$0A,$0D
	dc.b	'The file specified exists !!!'
	dc.b	ESC,'K',$0A,$0D
	dc.b	'(O)verwrite (N)ew Name or (Q)uit'
	dc.b	ESC,'K',$00
L0024:
	dc.b	'A:\',$00
goodbye_release_s:
	dc.b	ESC,'E'
	dc.b	'Goodbye & Thank you for using me',$0A,$0D
	dc.b	'Release memory used by picture ?',$0A,$0D
	dc.b	'(Y)es or (N)o',$00
	dc.b	'Disc is write protected.'
	dc.b	ESC,'K',$0A,$0D
	dc.b	'(R)etry or (C)ancel'
	dc.b	ESC,'K',$00
;
;----------------------------------------------------------------------------
;
	section	BSS
;
;----------------------------------------------------------------------------
;
entry_ssp:
	DS.L	1
L0027:
	DS.B	32000
L0028:
	DS.B	32
L0029:
	DS.B	32
L002A:
	DS.L	1
L002B:
	DS.B	124
L002C:
	DS.B	32000
L002D:
	DS.W	1
L002E:
	DS.B	42
L002F:
	DS.B	1044
L0030:
	DS.B	14
;----------------------------------------------------------------------------
	END
;----------------------------------------------------------------------------
;End of file:	SAVER.S
;----------------------------------------------------------------------------
