; Assemble it with disabled UCase=LCase option !

RT_FILEREQ		=0

_LVOrtAllocRequestA	=-30
_LVOrtFreeRequest	=-36
_LVOrtChangeReqAttrA	=-48
_LVOrtFileRequestA	=-54
_LVOrtFreeFileList	=-60
_LVOrtGetStringA	=-72

rtfl_Next		=0
rtfl_Name		=8
rtfi_Dir		=16

RT_ReqPos		=$80000003
RTGS_Width		=$80000020
RTFI_Flags		=$80000028
RTFI_Height		=$80000029
RTFI_AllowEmpty		=$8000002d
RTFI_Dir		=$80000032
RTFI_MatchPat		=$80000033
RTGS_AllowEmpty		=$80000050
RTGS_CenterText		=$80000064

REQPOS_POINTER		=0
FREQF_MULTISELECT	=1
FREQF_PATGAD		=$10
FREQF_SELECTDIRS	=$1000

program:
	move.l	sp,stack

	move.l	4,a6
	move.b	21(a6),sysver

	move.l	a0,a0store

	lea	windowcopy(pc),a0
	lea	window,a1
	bsr.w	move
	lea	executenamecopy(pc),a0
	lea	executename,a1
	bsr.w	move
	lea	assigncmdcopy(pc),a0
	lea	assigncmd,a1
	bsr.w	move

	move.l	4,a6
	lea	dosname(pc),a1
	jsr	-408(a6)
	move.l	d0,dosbase

	move.l	4,a6
	lea	gfxname(pc),a1
	jsr	-408(a6)
	move.l	d0,gfxbase

	move.l	4,a6
	lea	intname(pc),a1
	jsr	-408(a6)
	move.l	d0,intbase

	lea	iconname(pc),a1
	clr.l	d0
	move.l	4,a6
	jsr	-552(a6)
	move.l	d0,iconbase
	beq.w	quit

	suba.l	a1,a1
	move.l	4,a6
	jsr	-294(a6)
	move.l	d0,a3

	move.l	152(a3),stdcd

	tst.l	172(a3)
	bne.w	fromcli

	lea	92(a3),a0
	move.l	4,a6
	jsr	-384(a6)
	move.l	4,a6
	lea	92(a3),a0
	jsr	-372(a6)
	move.l	d0,wbmsg

	move.l	wbmsg,a0
	move.l	28(a0),wbnumargs
	sub.l	#2,wbnumargs
	tst.l	wbnumargs
	bpl.s	numargs_ok
	bsr.w	openio
	bsr.w	printinfo
	move.l	dosbase,a6
	move.l	#200,d1
	jsr	-198(a6)
	bsr.w	closeio
	bra.w	quit
numargs_ok:
	move.l	$24(a0),a0
	cmp.l	#0,a0
	beq.w	quit

	move.l	a0,wbargs
	move.l	a0,wbargadress
	add.l	#16,wbargadress

	move.l	wbargs,a0
	move.l	8(a0),d1
	beq.w	quit
	move.l	dosbase,a6
	jsr	-126(a6)

	move.l	wbargs,a0
	move.l	12(a0),a0
	move.l	a0,prgnameadress

returnfromcli:
	move.l	prgnameadress,a0
	bsr.w	moveprogram

	move.l	prgnameadress,a0
	move.l	iconbase,a6
	jsr	-78(a6)
	tst.l	d0
	bne.s	icon_noerror
	lea	nofile(pc),a0
	bsr.w	error
	bra.w	quit
icon_noerror:
	move.l	d0,diskobject
	move.l	d0,a1
	move.l	$36(a1),a1
	move.l	a1,tooltypearray

	lea	tooltypestable(pc),a0
	bsr.w	tooltypes

	tst.b	screenflag
	beq.b	screenok

	move.w	s_sx(pc),w_sx

	lea	newscreen(pc),a0
	move.l	intbase,a6
	jsr	-198(a6)
	move.l	d0,screen
	tst.l	d0
	beq.s	screenerr

	move.l	screen(pc),w_screen

	lea	newwindow(pc),a0
	move.l	intbase,a6
	jsr	-204(a6)
	move.l	d0,windowp
	tst.l	d0
	bne.s	screenok

	move.l	screen(pc),a0
	move.l	intbase,a6
	jsr	-66(a6)

screenerr:
	lea	noscr(pc),a0
	bsr.w	error
	tst.l	d0
	bne.w	noclosescr

screenok:
	tst.b	prgtype
	bne.s	typeset
	bsr.w	analyse
typeset:
	cmp.b	#1,prgtype
	beq.w	segment
	cmp.b	#2,prgtype
	beq.w	loadabsolute

	bsr.w	openio

	move.l	prgadr(pc),d1
	move.l	windowfile,d2
	moveq	#0,d3
	tst.b	outputflag
	beq.s	inout
	move.l	d2,d3
	moveq	#0,d2
inout:
	move.l	dosbase,a6
	jsr	-222(a6)

returnhere:
	move.l	stack,sp

	bsr.w	cacheon

	move.l	currentdir,d1
	beq.s	nounlock
	move.l	dosbase,a6
	jsr	-90(a6)

nounlock:
	tst.l	allocdone
	beq.s	nounalloc

	move.l	4,a6
	move.l	allocadr,a1
	move.l	alloclen,d0
	jsr	-210(a6)

nounalloc:
	tst.b	scrcloseflag
	beq.s	noscrclose
	tst.l	windowp
	beq.s	noscrclose

message:
	move.l	dosbase,a6
	moveq	#20,d1
	jsr	-198(a6)

	move.l	windowp,a0
	move.l	86(a0),a0
	move.l	4,a6
	jsr	-372(a6)
	tst.l	d0
	beq.s	message
	move.l	d0,a1
	move.l	20(a1),d2

	move.l	4,a6
	jsr	-378(a6)

	cmp.l	#512,d2
	bne.s	message

noscrclose:
	tst.l	windowp
	beq.s	noclosewindow

	move.l	windowp,a0
	move.l	intbase,a6
	jsr	-72(a6)

noclosewindow:
	tst.l	screen
	beq.s	noclosescr

	move.l	screen,a0
	move.l	intbase,a6
	jsr	-66(a6)

noclosescr:
	move.l	intbase,a6
	jsr	-210(a6)

	tst.b	resflag
	beq.b	norescue
	move.l 	gfxbase,a4
	move.l	38(a4),$dff080
	clr.w	$dff088
	move.w	#%1000000110100000,$dff096

	tst.l	view
	bne.s	setview

	move.l	gfxbase,a6
	move.l	34(a6),view

	suba.l	a1,a1
	jsr	-222(a6)

setview:
	move.l	view,a1
	move.l	gfxbase,a6
	jsr	-222(a6)

norescue:
	tst.l	windowfile
	beq.w	nocloseio

	tst.b	outputflag
	beq.s	o_newcli

	move.l	dosbase,a6
	move.l	#150,d1
	jsr	-198(a6)

o_newcli:
	bsr.w	closeio

quit:
	move.l	stack,sp

	move.l	stdcd,d1
	move.l	dosbase,a6
	jsr	-126(a6)

	tst.l	diskobject
	beq.s	nofreediskobject
	move.l	iconbase,a6
	move.l	diskobject,a0
	jsr	-90(a6)

nofreediskobject:
	tst.l	iconbase
	beq.s	nocloseicon
	move.l	iconbase,a1
	move.l	4,a6
	jsr	-414(a6)

nocloseicon:
	move.l	gfxbase,a1
	move.l	4,a6
	jsr	-414(a6)

	move.l	dosbase,a1
	move.l	4,a6
	jsr	-414(a6)

	bsr.w	closereq

	tst.l	wbmsg
	beq.s	nowb
	move.l	4.w,a6
	jsr	-132(a6)
	move.l	wbmsg,a1
	move.l	4.w,a6
	jsr	-378(a6)

nowb:

	clr.l	d0
	rts

openio:
	tst.l	wbmsg
	beq.s	noopenio
	move.l	#window,d1
	move.l	#$3ed,d2
	move.l	dosbase,a6
	jsr	-30(a6)
	move.l	d0,windowfile
noopenio:
	rts

closeio:
	move.l	windowfile,d1
	move.l	dosbase,a6
	jsr	-36(a6)
nocloseio:
	rts

fromcli:
	move.l	a0store,a0
	cmp.b	#10,(a0)
	beq.s	showinfo

	cmp.b	#'"',(a0)
	bne.s	fcli_noquote
	adda.l	#1,a0
fcli_noquote:
	move.l	a0,prgnameadress
fcli_loop:
	cmp.b	#10,(a0)+
	bne.s	fcli_loop
	move.b	#0,-(a0)
	cmp.b	#'"',-(a0)
	bne.w	returnfromcli
	move.b	#0,(a0)
	bra.w	returnfromcli

showinfo:
	move.l	dosbase,a6
	jsr	-60(a6)
	tst.l	d0
	beq.s	showend
	bsr.w	printinfo
showend:
	bra.w	quit
	rts

; d0 - output window file

printinfo:
	move.l	d0,windowfile

	lea	infoprint,a0
	move.l	(a0)+,d2
	move.l	(a0)+,d3
infoloop:

	move.l	a0,-(sp)
	move.l	dosbase,a6
	move.l	windowfile,d1
	jsr	-48(a6)
	move.l	(sp)+,a0

	move.l	(a0)+,d2
	tst.l	d2
	beq.s	realend
	move.l	(a0)+,d3

	movem.l	a0/d2/d3,-(sp)
	move.l	windowfile,d1
	move.l	#buffer,d2
	move.l	#1,d3
	move.l	dosbase,a6
	jsr	-42(a6)
	movem.l	(sp)+,a0/d2/d3
	bra.s	infoloop

realend:
	rts

analyse:
	move.l	prgnameadress,a0
	bsr.w	fsize
	move.l	protection,d0
	btst	#6,d0
	beq.s	noscript
	bsr.w	execute
noscript:
	tst.l	loadadr
	beq.s	noabsolute
	bsr.w	abs
noabsolute:
	move.b	interruptsflag,d0
	or.b	multitaskingflag,d0
	tst.b	d0
	beq.s	noloadseg
	bsr.w	lseg
noloadseg:
	rts

moveprogram:
	move.l	prgadr,a1
	move.b	#'"',(a1)+
	bsr.w	move
	move.b	#'"',-1(a1)
	move.b	#0,(a1)+
	rts

segment:
	move.l	prgnameadress,d1
	move.l	dosbase,a6
	jsr	-150(a6)
	tst.l	d0
	beq.w	returnhere
	move.l	d0,segmentadr

	bsr.b	opt

	move.l	segmentadr,d0
	asl.l	#2,d0
	add.l	#4,d0
	move.l	d0,a5
	move.l	paramsadr,a0
	move.l	4,a6
	jsr	(a5)

	move.l	stack,sp

 	bsr.b	opton

	move.l	segmentadr,d1
	move.l	dosbase,a6
	jsr	-156(a6)
	bra.w	returnhere

enter:
	dc.b	10,0
segmentadr:
	dc.l	0

opt:
	tst.b	interruptsflag
	beq.s	nointoff
	move.w	#%0100000000000000,$dff09a
nointoff:
	tst.b	multitaskingflag
	beq.s	nomultioff
	move.l	4,a6
	jsr	-132(a6)
nomultioff:
	rts

opton:
	tst.b	interruptsflag
	beq.s	nointon
	move.w	#%1100000000000000,$dff09a
nointon:
	tst.b	multitaskingflag
	beq.s	nomultion
	move.l	4,a6
	jsr	-138(a6)
nomultion:
	rts

loadabsolute:
	tst.l	loadadr
	beq.b	laend

	move.l	prgnameadress,a0
	bsr.w	fsize

	move.l	prgnameadress,d1
	move.l	#$3ed,d2
	move.l	dosbase,a6
	jsr	-30(a6)
	tst.l	d0
	beq.s	laend
	move.l	d0,file

	move.l	file,d1
	move.l	loadadr,d2
	move.l	filesize,d3
	move.l	dosbase,a6
	jsr	-42(a6)

	bsr.w	opt

	move.l	jumpadr,a5
	move.l	paramsadr,a0
	move.l	4,a6
	jsr	(a5)

	move.l	stack,sp

	bsr.w	opton

	move.l	file,d1
	move.l	dosbase,a6
	jsr	-36(a6)

laend:
	bra.w	returnhere

allocdone:
	dc.l	0

tooltypes:
	movem.l	d0-d7/a0-a6,-(sp)
	move.l	a0,a2
toolloop:
	move.l	(a2)+,a1
	cmp.l	#0,a1
	beq.w	toolend

	move.l	a2,-(sp)
	move.l	tooltypearray,a0
	move.l	iconbase,a6
	jsr	-96(a6)
	move.l	(sp)+,a2
	tst.l	d0
	beq.w	notool2
	move.l	d0,a0
nextarg:
	move.l	(a2)+,a1
	cmp.l	#0,a1
	beq.s	notool
	move.l	(a2)+,d1
	cmp.l	#'b',d1
	bne.s	argnob
	bsr.b	asciidoliczba
	cmp.l	#$80000000,d0
	bne.s	here___
	moveq	#1,d0
here___:
	move.b	d0,(a1)
	bra.s	nexttool
argnob:	cmp.l	#'w',d1
	bne.s	argnow
	bsr.s	asciidoliczba
	cmp.l	#$80000000,d0
	beq.s	nexttool
	move.w	d0,(a1)
	bra.s	nexttool
argnow:	cmp.l	#'l',d1
	bne.s	argnol
	bsr.s	asciidoliczba
	cmp.l	#$80000000,d0
	beq.s	nexttool
	move.l	d0,(a1)
	bra.s	nexttool
argnol:
	tst.l	d1
	beq.s	a_jump
	movem.l	d1-d7/a0-a6,-(sp)
	move.l	d1,a1
	move.l	iconbase,a6
	jsr	-102(a6)
	movem.l	(sp)+,d1-d7/a0-a6
	tst.w	d0
	beq.s	nexttool
a_jump:	movem.l	d0-d7/a0-a6,-(sp)
	jsr	(a1)
	movem.l	(sp)+,d0-d7/a0-a6
nexttool:
	bra.s	nextarg
notool:	bra.w	toolloop
toolend:
	movem.l	(sp)+,d0-d7/a0-a6
	rts
notool2:
	move.l	(a2)+,a1
	cmp.l	#0,a1
	beq.s	notool
	move.l	(a2)+,d1
	bra.s	notool2

asciidoliczba:
	movem.l	a1-a6/d1-d7,-(sp)
asloop:
	move.b	(a0)+,d0
	tst.b	d0
	beq.s	aserr
	cmp.b	#',',d0
	beq.s	aserr
	cmp.b	#'$',d0
	beq.s	hexlicz
	cmp.b	#'0',d0
	blt.s	asloop
	cmp.b	#'9',d0
	bgt.s	asloop
	suba.l	#1,a0
asloop2:
	move.b	(a0)+,d0
	tst.b	d0
	beq.s	aslicz
	cmp.b	#'0',d0
	blt.s	aslicz
	cmp.b	#'9',d0
	bgt.s	aslicz
	bra.s	asloop2
aslicz:	move.l	a0,-(sp)
	suba.l	#1,a0
	lea	mnozonko,a1
	clr.l	d0
	clr.l	d1
asconv:
	move.b	-(a0),d1
	cmp.b	#'-',d1
	beq.s	ascneg
	sub.b	#'0',d1
	tst.b	d1
	bmi.s	ascend
	cmp.b	#10,d1
	bge.s	ascend
	move.l	(a1)+,d2
	ext.w	d1
	tst.w	d1
	beq.s	asconv
	sub.w	#1,d1
mululoop:
	add.l	d2,d0
	dbf	d1,mululoop
	bra.s	asconv
ascend:	move.l	(sp)+,a0
asend:	movem.l	(sp)+,a1-a6/d1-d7
	rts
aserr:	move.l	#$80000000,d0
	movem.l	(sp)+,a1-a6/d1-d7
	rts
	
ascneg:	neg.l	d0
	bra.s	ascend

hexlicz:
	move.b	(a0)+,d0
	bsr.b	hexdocyfra
	cmp.b	d1,d0
	bne.s	hexlicz

	move.l	a0,-(sp)
	suba.l	#1,a0

	clr.l	d2
	clr.l	d3
hexloop:
	move.b	-(a0),d0
	bsr.b	hexdocyfra
	cmp.b	d0,d1
	beq.s	hexend
	ext.w	d1
	ext.l	d1
	asl.l	d2,d1
	addq	#4,d2
	add.l	d1,d3
	bra.s	hexloop
hexend:
	move.l	(sp)+,a0
	move.l	d3,d0
	movem.l	(sp)+,a1-a6/d1-d7
	rts

; d0 - ascii
; d1 - cyfra

hexdocyfra:
	movem.l	d2/a5,-(sp)
	lea	hexcyfry,a5
hdcloop:
	move.b	(a5)+,d2
	move.b	(a5)+,d1
	tst.b	d2
	beq.s	hdcerr
	cmp.b	d0,d2
	bne.s	hdcloop
	movem.l	(sp)+,d2/a5
	rts
hdcerr:
	move.b	d0,d1
	movem.l	(sp)+,d2/a5
	rts

hexcyfry:
	dc.b	'0',0,'1',1,'2',2,'3',3,'4',4,'5',5,'6',6,'7',7,'8',8,'9',9
	dc.b	'a',10,'b',11,'c',12,'d',13,'e',14,'f',15
	dc.b	'A',10,'B',11,'C',12,'D',13,'E',14,'F',15
	dc.b	0,0

mnozonko:
	dc.l	1,10,100,1000,10000,100000,1000000

movename:
	lea	window,a1
	bsr.b	move
	rts

argmove:
	tst.b	quoteflag
	beq.s	am_noq
	move.b	#'"',(a1)+
am_noq:	bsr.b	move
	tst.b	quoteflag
	beq.s	am_noq2
	move.b	#'"',-1(a1)
	adda.l	#1,a1
am_noq2:
	move.b	#' ',-(a1)
	rts

move:
n_loop:
	move.b	(a0)+,d0
	move.b	d0,(a1)+
	bne.s	n_loop
	rts

argmovenq:
mnq_loop:
	move.b	(a0)+,d0
	move.b	d0,(a1)+
	bne.s	mnq_loop
	move.b	#' ',-(a1)
	rts

moveparams:
	movem.l	a2/d1/d2,-(sp)
	clr.l	d1
mp_loop:
	bsr.b	argsoptionscheck
	move.b	(a0)+,d0
	cmp.b	#'»',d0
	bne.s	nonextline

	move.l	tooltypearray,a2
	addq	#1,d1
	move.l	d1,d2
mp_loop2:
	move.l	(a2)+,a0
	cmp.l	#0,a0
	beq.s	mp_end
	cmp.b	#'»',(a0)+
	bne.s	mp_loop2
	subq	#1,d2
	bne.s	mp_loop2
	bra.s	mp_loop

nonextline:
	move.b	d0,(a1)+
	bne.s	mp_loop
mp_end:
	movem.l	(sp)+,a2/d1/d2
	rts

; a0 - source
; a1 - destination

argsoptionscheck:
	movem.l	d0-d7/a2-a6,-(sp)
	move.l	a0,orgsource
	move.l	a1,orgdest
	lea	argsadresses,a2
	lea	argsoptions,a3
	lea	textadresses,a4
aoc_loop:
	move.l	(a2)+,a5
	cmp.l	#0,a5
	beq.s	aoc_done
aoc_loop2:
	move.b	(a3)+,d1
	beq.s	aoc_equal
	move.b	(a0)+,d0
	beq.s	aoc_done
	cmp.b	#'*',d1
	bne.s	aoc_nowildcard
	move.l	a1,-(sp)
	move.l	a3,a1
	bsr.b	aoc_wildcard
	move.l	a1,a3
	move.l	(sp)+,a1
	bra.s	aoc_loop2
aoc_nowildcard:
	cmp.b	d0,d1
	beq.s	aoc_loop2
aoc_loop3:
	tst.b	(a3)+
	bne.s	aoc_loop3
	move.l	orgsource,a0
	move.l	orgdest,a1
	bra.s	aoc_loop
aoc_equal:
	move.l	orgsource,a2
	move.l	a0,orgsource
	move.l	a2,a0
	jsr	(a5)
	move.l	a1,orgdest
	movem.l	(sp)+,d0-d7/a2-a6
	move.l	orgsource,a0
	move.l	orgdest,a1
	bra.w	argsoptionscheck
aoc_done:
	movem.l	(sp)+,d0-d7/a2-a6
	move.l	orgsource,a0
	move.l	orgdest,a1
	rts

; a0 - source
; a1 - cmp text

aoc_wildcard:
	movem.l	d0-d1,-(sp)
	move.b	(a1)+,d0
aocw_loop:
	move.b	(a0)+,d1
	beq.s	aocw_error
	cmp.b	d0,d1
	bne.s	aocw_loop	
	movem.l	(sp)+,d0-d1
	suba.l	#1,a0
	suba.l	#1,a1
	rts
aocw_error:
	movem.l	(sp)+,d0-d1
	rts

getadresses:
	lea	adresses,a1
	clr.l	(a1)
	clr.l	4(a1)
	clr.l	8(a1)
	clr.l	12(a1)
ga_loop:
	move.b	(a0)+,d0
	beq.s	nomore
	cmp.b	#'}',d0
	beq.s	nomore
	cmp.b	#'"',d0
	bne.s	ga_loop
	move.l	a0,(a1)+
ga_loop2:
	move.b	(a0)+,d0
	beq.s	nomore
	cmp.b	#'"',d0
	bne.s	ga_loop2
	move.b	#0,-1(a0)
	bra.s	ga_loop
nomore:
	rts

argfilereqmulti:
;------------------------
	move.l	a1,-(sp)
	bsr.b	getadresses
	move.l	adresses+8,a0
	cmp.l	#0,a0
	beq.s	afrm_nodeffile
	lea	filebuffer,a1
	bsr.w	move
afrm_nodeffile:
	move.l	adresses+12,a0
	cmp.l	#0,a0
	beq.s	afrm_nopattern
	lea	pattern,a1
	bsr.w	move
afrm_nopattern:
	move.l	adresses+4,a0
	cmp.l	#0,a0
	beq.s	afrm_nodir
	lea	directory,a1
	bsr.w	move
afrm_nodir:
	lea	filebuffer,a0
	move.l	adresses,a1
	bsr.w	multirequest
	tst.l	d0
	beq.w	quit
	bmi.w	noreqerr
	move.l	(sp)+,a1
	bsr.w	argmovenq
	rts
;------------------------

argfilereqwbmulti:
;------------------------
	bsr.w	arggetfromwbmulti
	tst.l	d0
	beq.b	arg_end
;------------------------
	bsr.b	argfilereqmulti
;------------------------
	rts

argfilereq:
;------------------------
	move.l	a1,-(sp)
	bsr.w	getadresses
	move.l	adresses+8,a0
	cmp.l	#0,a0
	beq.s	afr_nodeffile
	lea	filebuffer,a1
	bsr.w	move
afr_nodeffile:
	move.l	adresses+12,a0
	cmp.l	#0,a0
	beq.s	afr_nopattern
	lea	pattern,a1
	bsr.w	move
afr_nopattern:
	move.l	adresses+4,a0
	cmp.l	#0,a0
	beq.s	afr_nodir
	lea	directory,a1
	bsr.w	move
afr_nodir:
	lea	filebuffer,a0
	move.l	adresses,a1
	bsr.w	request
	tst.l	d0
	beq.w	quit
	bmi.w	noreqerr
	move.l	(sp)+,a1
	bsr.w	argmovenq
	rts
;------------------------
arg_end:
	rts

arggetstring:
;------------------------
	move.l	a1,-(sp)
	bsr.w	getadresses
	lea	stringbuffer,a1
	move.l	adresses+4,a0
	cmp.l	#0,a0
	beq.s	nodefanswer
	bsr.w	move
nodefanswer:
	lea	stringbuffer,a0
	move.l	adresses,a1
	bsr.w	getstring
	tst.l	d0
	beq.w	quit
	bmi.w	noreqerr
	move.l	(sp)+,a1
	lea	stringbuffer,a0
	bsr.w	argmovenq
;------------------------
	rts

arggetoption:
;------------------------
	move.l	a1,-(sp)
	bsr.w	getadresses
	move.l	adresses,a1
	move.l	adresses+4,a2
	bsr.w	requester
	tst.l	d0
	bmi.w	noreqerr
	move.l	adresses+8,a0
	lea	gadstable,a1
	moveq.l	#1,d2
count_loop:
	move.b	(a2)+,d1
	beq.s	count_end
	cmp.b	#'|',d1
	bne.s	count_loop
	addq	#1,d2
	bra.s	count_loop
count_end:
	move.l	a0,(a1)+
ago_loop:
	move.b	(a0)+,d1
	beq.s	ago_eog
	cmp.b	#'|',d1
	bne.s	ago_loop
	move.b	#0,-1(a0)
	move.l	a0,(a1)+
	bra.s	ago_loop
ago_eog:
	tst.w	d0
	bne.s	nolastgad
	move.w	d2,d0
nolastgad:
	sub.w	#1,d0
	lea	gadstable,a1
	asl.w	#2,d0
	move.l	(a1,d0.w),a0
	cmp.l	#0,a0
	beq.w	quit
	move.l	(sp)+,a1
	bsr.w	argmovenq
;------------------------
	rts

argfilereqwb:
	bsr.b	arggetfromwb
	tst.l	d0
	beq.w	arg_end
;------------------------
	bsr.w	argfilereq
;------------------------
	rts

arggetstringwb:
	bsr.b	arggetfromwb
	tst.l	d0
	beq.w	arg_end
;------------------------
	bsr.w	arggetstring
;------------------------
	rts

arggetfromwbmulti
	bsr.b	arggetfromwb
	tst.l	d0
	bne.s	agfwbm_nowbarg
	move.b	#' ',(a1)+
agfwm_loop:
	bsr.b	arggetfromwb
	move.b	#' ',(a1)+
	tst.l	d0
	beq.s	agfwm_loop
	suba.l	#1,a1
	clr.l	d0
	rts
agfwbm_nowbarg:
	moveq	#-1,d0
	rts

arggetfromwb:
;------------------------
	sub.l	#1,wbnumargs
	move.l	wbnumargs,d0
	tst.l	d0
	bmi.s	nowbarg
	movem.l	a0-a2,-(sp)
	move.l	wbargadress,a2
	move.l	(a2),a0
	move.l	4(a2),a1
	lea	filebuffer,a2
	bsr.b	joindirandfile
	movem.l	(sp)+,a0-a2
	lea	filebuffer,a0
	add.l	#8,wbargadress
	bsr.w	argmove
	moveq	#0,d0
	rts
nowbarg:
	moveq	#-1,d0
	rts
;------------------------
	rts

noreqerr:
	lea	noreq,a0
	bsr.w	error
	bra.w	quit

; a0 - directory lock
; a1 - file
; a2 - buffer

joindirandfile:
	move.l	a0,d1
	move.l	a1,d3
	move.l	a2,d2
	lea	directories,a1
	lea	diradresses,a2
	bsr.w	fileinfo
	move.l	a1,(a2)+
	move.l	name,a0
	bsr.w	move
jdaf_loop:
	movem.l	d0/a0-a1/a6,-(sp)
	move.l	dosbase,a6
	jsr	-210(a6)
	move.l	d0,d1
	movem.l	(sp)+,d0/a0-a1/a6
	tst.l	d1
	beq.s	noparent
	bsr.w	fileinfo
	move.l	a1,(a2)+

	move.l	name,a0
	bsr.w	move
	bra.s	jdaf_loop
noparent:
	move.l	-(a2),a0
	move.l	d2,a1
	bsr.w	move
	move.b	#':',-1(a1)
jdirsloop:
	move.l	-(a2),a0
	cmp.l	#0,a0
	beq.s	jdirsend
	bsr.w	move
	move.b	#'/',-1(a1)
	bra.s	jdirsloop
jdirsend:
	move.l	d3,a0
	bsr.w	move
	rts

wbnumargs:
	dc.l	0
wbargadress:
	dc.l	0

argsadresses:
	dc.l	argfilereq
	dc.l	arggetstring
	dc.l	arggetoption
	dc.l	arggetfromwb
	dc.l	argfilereqwb
	dc.l	arggetstringwb
	dc.l	argfilereqmulti
	dc.l	arggetfromwbmulti
	dc.l	argfilereqwbmulti
	dc.l	0

argsoptions:
	dc.b	'{F *}',0
	dc.b	'{S *}',0
	dc.b	'{O *}',0
	dc.b	'{W}',0
	dc.b	'{FW *}',0
	dc.b	'{SW *}',0
	dc.b	'{FM *}',0
	dc.b	'{WM}',0
	dc.b	'{FWM *}',0

	even

cacheoff:
	cmp.b	#37,sysver
	blt.s	cache_end

	moveq	#0,d0			;Get old cache state
	moveq	#0,d1			;
	move.l	4,a6
	jsr	-648(a6)		; CacheControl
	move.l	d0,oldcache

	move.l	d0,d1			;Clear only SET bits to avoid masking
	moveq	#0,d0			;d1 with -1
	move.l	4,a6
	jsr	-648(a6)

	rts

cacheon:
	cmp.b	#37,sysver
	blt.s	cache_end

	move.l	oldcache,d1
	moveq	#-1,d0
	move.l	4,a6
	jsr	-648(a6)

cache_end:
	rts

assign:
	lea	assignargs,a1
	bsr.w	move

	move.l	#assigncmd,d1
	move.l	#0,d2
	move.l	#0,d3
	move.l	dosbase,a6
	jsr	-222(a6)

	rts

cd:
	lea	cddir,a1
	bsr.w	move
	move.l	#cddir,d1
	moveq.l	#-2,d2
	move.l	dosbase,a6

	jsr	-84(a6)
	tst.l	d0
	beq.s	cdend
	move.l	d0,currentdir
	move.l	d0,d1
	move.l	dosbase,a6
	jsr	-126(a6)
cdend:	rts

param:
	tst.b	prgtype
	bne.s	par_end
	move.l	prgadr,a1
loop:	move.b	(a1)+,d0
	bne.s	loop
	move.b	#' ',-1(a1)
	move.l	a1,paramsadr
	bsr.w	moveparams
par_end:
	rts

paramsadr:
	dc.l	enter

execute:
	move.l	#executename,prgadr
	rts
lseg:
	move.b	#1,prgtype
	rts
abs:
	move.b	#2,prgtype
	rts
setexec:
	move.b	#3,prgtype
	rts

nop:	rts

doff:
	move.b	#1,resflag
	move.w	#%000000110100000,$dff096
	move.w	#0,$dff100
	move.w	#0,$dff102
	move.w	#0,$dff104
	move.w	#0,$dff106
	move.w	#0,$dff108
	move.w	#0,$dff10a
	move.w	#0,$dff1fc
	rts

setpal:
	move.w	#32,$dff1dc
	move.b	#1,resflag
	rts
setntsc:
	move.w	#0,$dff1dc
	move.b	#1,resflag
	rts

resc:	move.b	#1,resflag
	rts

noresc:
	move.b	#0,resflag
	rts

output:
	move.b	#1,outputflag
	rts
inpout:
	clr.b	outputflag
	rts


; a0 - filename

; d0 - size

fsize:
	movem.l	d0-d7/a0-a6,-(sp)

	move.l	a0,d1
	moveq	#-2,d2
	move.l	dosbase,a6
	jsr	-84(a6)
	tst.l	d0
	beq.s	lerr
	move.l	d0,d1

	move.l	d1,-(sp)
	bsr.b	fileinfo
	move.l	(sp)+,d1

	move.l	dosbase,a6
	jsr	-90(a6)

loadend:
	movem.l	(sp)+,d0-d7/a0-a6
	move.l	filesize,d0
	rts

; d1 - lock

fileinfo:
	movem.l	d0-d2/a0-a6,-(sp)
	move.l	#fileinfoblk,d2
	addq.l	#3,d2
	and.l	#$fffffffc,d2
	move.l	d2,fileinfoadr
	move.l	fileinfoadr,d2
	move.l	dosbase,a6
	jsr	-102(a6)
	move.l	fileinfoadr,a0
	move.l	124(a0),filesize
	move.l	116(a0),protection
	move.l	a0,name
	add.l	#8,name
	movem.l	(sp)+,d0-d2/a0-a6
	rts

name:
	dc.l	0

lerr:
	move.l	#0,filesize
	move.l	#0,protection
	move.l	#0,name
	movem.l	(sp)+,d0-d7/a0-a6
	moveq	#0,d0
	rts

protection:
	dc.l	0

ioff:
	move.b	#1,interruptsflag
	rts
moff:
	move.b	#1,multitaskingflag
	rts

w_close:
	move.l	intbase,a6
	jsr	-78(a6)
	rts

lv:
	move.b	#1,resflag
	move.l	gfxbase,a6
	move.l	34(a6),view
	suba.l	a1,a1
	jsr	-222(a6)
	rts

; a0 - error text

error:
	move.l	a0,a1
e_sfg:	tst.b	(a1)+
	bne.s	e_sfg
	move.l	a1,a2
	moveq	#1,d1
e_loop:
	move.b	(a2)+,d0
	beq.s	e_end
	cmp.b	#'|',d0
	bne.s	e_loop
	move.l	a2,a3
	addq	#1,d1
	bra.s	e_loop
; a0 - error text
; a1 - gadgets
; a2 - end of text
; a3 - second gadget
; d1 - number of gadgets
e_end:
	cmp.b	#1,d1			; only information ?
	bne.s	noclierror
	tst.l	wbmsg			; from cli ?
	bne.s	noclierror
	movem.l	a0/a1/d1,-(sp)
	move.l	dosbase,a6
	jsr	-60(a6)			; output
	movem.l	(sp)+,a0/a1/d1
	tst.l	d0
	beq.s	noclierror		; no output window !
	move.b	#10,-1(a1)
	move.l	d0,d1
	move.l	a0,d2
	move.l	a1,d3
	sub.l	a0,d3
	move.l	dosbase,a6
	jsr	-48(a6)			; write
	rts
noclierror:
	movem.l	a1-a3,-(sp)
	move.l	a1,a2
	move.l	a0,a1
	bsr.w	requester
	movem.l	(sp)+,a1-a3
	tst.l	d0
	bmi.s	noreqlib
	rts

;	-no req.library !-

noreqlib:
	cmp.b	#3,d1
	bge.w	toomanygads

	move.b	#0,-(a3)

	lea	alertbuf,a3
	move.l	#20,d3

nextline:
	move.b	#0,(a3)+
	moveq	#0,d0

	move.l	a0,-(sp)
e_eofl:	addq	#1,d0
	move.b	(a0)+,d2
	beq.s	e_eof
	cmp.b	#10,d2
	bne.s	e_eofl
e_eof:	move.l	(sp)+,a0

	moveq	#80,d2
	sub.w	d0,d2
	add.w	#1,d2
	asl.w	#2,d2
	move.b	d2,(a3)+
	move.b	d3,(a3)+
emm_loop:
	move.b	(a0)+,d2
	cmp.b	#10,d2
	bne.s	e_nenter
	add.l	#10,d3
	move.b	#0,(a3)+
	move.b	#1,(a3)+
	bra.s	nextline
e_nenter:
	move.b	d2,(a3)+
	tst.b	d2
	bne.s	emm_loop

	add.l	#20,d3

	cmp.b	#2,d1
	bne.s	e_displayalert

	move.b	#1,(a3)+
	move.b	#0,(a3)+
	move.l	a2,d0
	sub.l	a1,d0
	add.l	#26,d0
	moveq	#80,d2
	sub.w	d0,d2
	asl.w	#2,d2
	move.b	d2,(a3)+
	move.b	d3,(a3)+

	move.l	a1,-(sp)
	move.l	a3,a1
	lea	lmbtext,a0
	bsr.w	argmovenq
	move.l	(sp)+,a0
	bsr.w	argmovenq
	move.w	#14,d0
e_sloop:
	move.b	#' ',(a1)+
	dbf	d0,e_sloop
	move.l	a0,-(sp)
	lea	rmbtext,a0
	bsr.w	argmovenq
	move.l	(sp)+,a0
	bsr.w	move
	move.b	#0,(a1)+

	add.l	#20,d3

e_displayalert:
	move.l	intbase,a6
	lea	alertbuf,a0
	move.l	d3,d1
	jsr	-90(a6)
	rts

toomanygads:
	moveq	#-1,d0
	rts

exec	=	4
oldoplib		=-408
closelib		=-414

openreq
	tst.l	reqbase
	bne.s	noopenreq
	movem.l	d0/d1/a0/a1/a6,-(sp)
	move.l	exec,a6
	lea	reqname,a1
	jsr	oldoplib(a6)
	move.l	d0,reqbase
	movem.l	(sp)+,d0/d1/a0/a1/a6
noopenreq:
	rts
closereq:
	tst.l	reqbase
	beq.s	noclose
	move.l	exec,a6
	move.l	reqbase,a1
	jsr	closelib(a6)
noclose:
	rts

; *** wyswietlenie requestera ***
; a1 - tekst w requesterze
; a2 - gadzety

; d0 - numer wcisnietego gadzetu

requester:
	bsr.b	openreq
	tst.l	reqbase
	beq.w	rtend
	move.l	a1,-(sp)
	move.l	reqbase(pc),a6
	moveq.l	#0,d0
	lea	zero,a0
	jsr	-30(a6)
	move.l	d0,reqfile
	move.l	(sp)+,a1

	move.l	reqbase(pc),a6
	move.l	reqfile(pc),a3
	lea	reqtaglist(pc),a0
	jsr	-66(a6)

	move.l	d0,-(sp)
	bsr.w	freereq
	move.l	(sp)+,d0

	rts	


;==========================================================================;
; in:
; a0 - buffer
; a1 - window name

; out:
; d0 - 0=cancel

getstring:
	bsr.w	openreq
	tst.l	reqbase
	beq.w	rtend
	move.l	a0,chars
	move.l	a1,tytul

	move.l	reqbase,a6	;!!! a6 !!! nie uzywac
	move.l	#250,d0
	move.l	chars,a1
	move.l	tytul,a2
	move.l	#0,a3
	move.l	#gstaglist,a0
	jsr	_LVOrtGetStringA(a6)
	rts

; in:
; a0 - filename buffer
; a1 - window name

; out:
; a0 - filenames

multirequest:
	bsr.w	openreq
	tst.l	reqbase
	beq.w	rtend
	move.l	a0,nazwa
	move.l	a1,tytul

	move.l	reqbase,a6	;!!! a6 !!! nie uzywac
					;przydzielenie structury
	move.l	#RT_FILEREQ,d0
	move.l	#zero,a0
	jsr	_LVOrtAllocRequestA(a6)
	tst.l	d0
	bne.b	r.nerr
	bra.w	rtend
r.nerr	move.l	d0,reqfile
	
;--------------------------------------------------------------;
	move.l	reqfile,a1
	lea	addtag,a0
	move.l	reqbase,a6
	jsr	_LVOrtChangeReqAttrA(a6)
					;wywoŁanie requestera
	move.l	reqfile,a1
	move.l	nazwa,a2
	move.l	tytul,a3
	move.l	#taglistmulti,a0
	move.l	reqbase,a6
	jsr	_LVOrtFileRequestA(a6)
		;tutaj powinna znajdowac sie nasza procedura ktora
		;operuje na wybranym zbiorze
	movem.l	d0,-(sp)

;--------------------------------------------------------------;
	move.l	reqfile,a0
	move.l	rtfi_Dir(a0),a0		;teraz w a0 znajduje sie adres
					;nazwy katalogu...
	move.l	d0,filelist
	move.l	d0,a4

	lea	string,a1
multiloop:
	move.b	#' ',-1(a1)
	lea	directory,a3
	move.l	rtfl_Name(a4),a2
	move.l	a0,-(sp)
	bsr.b	joinreqnames
	move.l	(sp)+,a0
	move.l	rtfl_Next(a4),a4
	cmp.l	#0,a4
	bne.s	multiloop

	move.l	filelist,a0
	move.l	reqbase,a6
	jsr	_LVOrtFreeFileList(a6)

	bsr.w	freereq
	lea	string,a0
	movem.l	(sp)+,d0
	rts

filelist:
	dc.l	0

; a0 - directory
; a1 - dest. buffer
; a2 - file
; a3 - directory buffer

; changed: a0,a1,a2,a3,d0

joinreqnames:
	tst.b	quoteflag
	beq.s	jrn_noq
	move.b	#'"',(a1)+
jrn_noq:
	move.b	(a0)+,d0
	move.b	d0,(a3)+
	tst.b	d0
	beq.s	req_nx
	move.b	d0,(a1)+
req_lop:
	move.b	(a0)+,d0
	move.b	d0,(a1)+
	move.b	d0,(a3)+
	tst.b	d0
	bne.s	req_lop
	subq	#1,a1
	cmp.b	#':',-1(a1)
	beq.s	req_nx
	move.b	#'/',(a1)+
req_nx:	move.b	(a2)+,d0
	move.b	d0,(a1)+
	tst.b	d0
	bne.s	req_nx
	tst.b	quoteflag
	beq.s	jrn_noq2
	move.b	#'"',-1(a1)
	move.b	#0,(a1)+
jrn_noq2:
	rts

; in:
; a0 - filename buffer
; a1 - window name

; out:
; a0 - filename

request:
	bsr.w	openreq
	tst.l	reqbase
	beq.w	rtend
	move.l	a0,nazwa
	move.l	a1,tytul

	move.l	reqbase,a6	;!!! a6 !!! nie uzywac
					;przydzielenie structury
	move.l	#RT_FILEREQ,d0
	move.l	#zero,a0
	jsr	_LVOrtAllocRequestA(a6)
	tst.l	d0
	bne.b	mr.nerr
	bra.b	rtend
mr.nerr	move.l	d0,reqfile
	
;--------------------------------------------------------------;
					;wywoŁanie requestera
	move.l	reqfile,a1
	lea	addtag,a0
	move.l	reqbase,a6
	jsr	_LVOrtChangeReqAttrA(a6)
	move.l	reqfile,a1
	move.l	nazwa,a2
	move.l	tytul,a3
	move.l	#taglist,a0
	jsr	_LVOrtFileRequestA(a6)
		;tutaj powinna znajdowac sie nasza procedura ktora
		;operuje na wybranym zbiorze
	move.l	d0,-(sp)

;--------------------------------------------------------------;
	move.l	reqfile,a0
	move.l	rtfi_Dir(a0),a0		;teraz w a0 znajduje sie adres
					;nazwy katalogu...
	lea	string,a1
	lea	directory,a3
	bsr.w	joinreqnames
	bsr.b	freereq
	lea	string,a0
	move.l	(sp)+,d0
	rts

freereq:
	move.l	reqfile,a1
	move.l	reqbase,a6
	jsr	_LVOrtFreeRequest(a6)
	rts

rtend:	moveq	#-1,d0
	rts
;==========================================================================;
eror	dc.l	0	
zero	dc.l	0

reqbase	dc.l	0
req	dc.l	0
reqfile	dc.l	0
reqfont	dc.l	0
reqname	dc.b	'reqtools.library',0
	even

reqtaglist:
	dc.l	RT_ReqPos,REQPOS_POINTER
	dc.l	0,0

taglist:
	dc.l	RT_ReqPos,REQPOS_POINTER
	dc.l	RTFI_Flags,FREQF_PATGAD
	dc.l	RTFI_Height,1000
	dc.l	RTFI_AllowEmpty,1
	dc.l	0,0

gstaglist:
	dc.l	RT_ReqPos,REQPOS_POINTER
	dc.l	RTGS_Width,320
	dc.l	RTGS_CenterText,1
	dc.l	RTGS_AllowEmpty,1
	dc.l	0,0

taglistmulti:
	dc.l	RT_ReqPos,REQPOS_POINTER
	dc.l	RTFI_Flags,FREQF_PATGAD+FREQF_MULTISELECT+FREQF_SELECTDIRS
	dc.l	RTFI_Height,1000
	dc.l	RTFI_AllowEmpty,1
	dc.l	0,0

addtag:
	dc.l	RTFI_MatchPat,pattern
	dc.l	RTFI_Dir,directory
	dc.l	0,0

tytul:	dc.l	reqname

interruptsflag:
	dc.b	0
multitaskingflag:
	dc.b	0

	even

quoteoff:
	clr.b	quoteflag
	rts
setclose:
	add.l	#512,w_idcmp
	add.l	#8,w_flags
	move.b	#1,scrcloseflag
	rts

allocate:
	cmp.l	#0,allocadr
	beq.s	noalloc

	move.l	allocadr,a1
	move.l	alloclen,d0
	move.l	4,a6
	jsr	-204(a6)
	move.l	d0,allocdone
	tst.l	d0
	bne.s	noalloc

	lea	nomem(pc),a0
	bsr.w	error
	tst.l	d0
	bne.w	returnhere
noalloc:
	rts

quoteflag:
	dc.b	1
scrcloseflag:
	dc.b	0
	even

tooltypestable:
	dc.l	toolcd,cd,0,0
	dc.l	quotes,quoteoff,off,0
	dc.l	tool,moveprogram,0,0
	dc.l	win,movename,0,0
	dc.l	assign0,assign,0,0
	dc.l	assign1,assign,0,0
	dc.l	assign2,assign,0,0
	dc.l	assign3,assign,0,0
	dc.l	assign4,assign,0,0
	dc.l	assign5,assign,0,0
	dc.l	assign6,assign,0,0
	dc.l	assign7,assign,0,0
	dc.l	assign8,assign,0,0
	dc.l	assign9,assign,0,0
	dc.l	toolparams,param,0,0
	dc.l	type,setexec,executable,execute,script,lseg,loadsegment,abs,absolute,0
	dc.l	load,loadadr,'l',0
	dc.l	jump,jumpadr,'l',0
	dc.l	alloc,allocadr,'l',alloclen,'l',allocate,0,0
	dc.l	killaga,doff,hardware,lv,loadview,0
	dc.l	system,setpal,pal,setntsc,ntsc,0
	dc.l	wintype,output,onlyoutput,inpout,inputoutput,0
	dc.l	rescue,resc,on,noresc,off,0
	dc.l	inter,ioff,off,0
	dc.l	multi,moff,off,0
	dc.l	screenclose,setclose,on,0
	dc.l	screentxt,s_sx,'w',s_sy,'w',s_viewmodes,'w',screenflag,'b',0
	dc.l	workbench,w_close,close,0
	dc.l	cache,cacheoff,off,0
	dc.l	0

screenflag:
	dc.b	0

	even

newscreen:
	dc.w	0,0
s_sx:	dc.w	0
s_sy:	dc.w	0
	dc.w	1
	dc.b	0,1
s_viewmodes:
	dc.w	0
	dc.w	$f
	dc.l	0
	dc.l	sname
	dc.l	0
	dc.l	0
sname:
	dc.b	'IconPP screen',0
screen:
	dc.l	0
newwindow:
	dc.w	0,0
w_sx:	dc.w	0
w_sy:	dc.w	12
	dc.b	0,0
w_idcmp:
	dc.l	0
w_flags:
	dc.l	$800
	dc.l	0
	dc.l	0
	dc.l	sname
w_screen:
	dc.l	0
	dc.l	0
	dc.w	0,0,10000,10000
	dc.w	$f
windowp:
	dc.l	0
tool:
	dc.b	'TOOL',0
quotes:
	dc.b	'QUOTES',0
executable:
	dc.b	'EXECUTABLE',0
system:
	dc.b	'SYSTEM',0
hardware:
	dc.b	'HARDWARE',0
loadview:
	dc.b	'LOADVIEW',0
workbench:
	dc.b	'WORKBENCH',0
close:
	dc.b	'CLOSE',0
screentxt:
	dc.b	'SCREEN',0
screenclose:
	dc.b	'SCRCLOSE',0
inter:
	dc.b	'INTERRUPTS',0
multi:
	dc.b	'MULTITASKING',0
load:
	dc.b	'LOAD',0
jump:
	dc.b	'JUMP',0
alloc:
	dc.b	'ALLOCATE',0
loadsegment:
	dc.b	'LOADSEGMENT',0
absolute:
	dc.b	'ABSOLUTE',0
wintype:
	dc.b	'WINTYPE',0
onlyoutput:
	dc.b	'OUTPUT',0
inputoutput:
	dc.b	'NEWCLI',0
killaga:
	dc.b	'KILLAGA',0
on:
	dc.b	'ON',0
off:
	dc.b	'OFF',0
pal:
	dc.b	'PAL',0
ntsc:
	dc.b	'NTSC',0
type:
	dc.b	'TYPE',0
script:
	dc.b	'SCRIPT',0
assign0:
	dc.b	'ASSIGN',0
assign1:
	dc.b	'ASSIGN1',0
assign2:
	dc.b	'ASSIGN2',0
assign3:
	dc.b	'ASSIGN3',0
assign4:
	dc.b	'ASSIGN4',0
assign5:
	dc.b	'ASSIGN5',0
assign6:
	dc.b	'ASSIGN6',0
assign7:
	dc.b	'ASSIGN7',0
assign8:
	dc.b	'ASSIGN8',0
assign9:
	dc.b	'ASSIGN9',0
toolcd:
	dc.b	'CD',0
toolparams:
	dc.b	'PARAMS',0
rescue:
	dc.b	'RESCUE',0
win:
	dc.b	'WINDOW',0
cache:
	dc.b	'CACHE',0

	even

nomem:
	dc.b	'No memory at load address !',10
	dc.b	'The program will destroy something in memory.',0
	dc.b	'abort loading|load it, anyway !',0

noscr:
	dc.b	'Cannot open screen !',0
	dc.b	'abort loading|ignore',0

nofile:
	dc.b	"Cannot find the program or it's icon !",0
	dc.b	"That's terrible !",0
noreq:
	dc.b	'Cannot open reqtools.library !',0,0
	even

prgadr:
	dc.l	prgname

oldcache:
	dc.l	0

sysver:
	dc.b	0

resflag:
	dc.b	0
outputflag:
	dc.b	1
prgtype:
	dc.b	0

	even

diskobject:
	dc.l	0
tooltypearray:
	dc.l	0

dosname:
	dc.b	'dos.library',0
iconname:
	dc.b	'icon.library',0
gfxname:
	dc.b	'graphics.library',0
intname:
	dc.b	'intuition.library',0

	even

cl:
	dc.l	$ffdffffe
	dc.l	$fffffffe

infoprint:
	dc.l	info1,info2-info1
	dc.l	info2,info3-info2
	dc.l	info3,info4-info3
	dc.l	info4,info5-info4
	dc.l	info5,info6-info5
	dc.l	info6,info7-info6
	dc.l	0

info1:
 dc.b 10
 dc.b 27,'[2mIconPP v.3.0 by PP/TERMOS/UNION',27,'[0m',10
 dc.b 10
 dc.b 'List of tooltypes:',10
 dc.b '	TOOL=Program name',10
 dc.b '	TYPE=EXECUTABLE | LOADSEGMENT | SCRIPT | ABSOLUTE',10
 dc.b '	WINDOW=Window file',10
 dc.b '	WINTYPE=NEWCLI',10
 dc.b '	CD=Directory name',10
 dc.b '	ASSIGN1=Name Directory',10
 dc.b '	ASSIGN2=Name Directory',10
 dc.b '	......................',10
 dc.b '	ASSIGN9=Name Directory',10
 dc.b '	PARAMS=Parameters',10
 dc.b '	QUOTES=OFF',10
 dc.b 'ENTER to continue...'
info2:
 dc.b 155,65
 dc.b '                    ',155,65,10
 dc.b '	KILLAGA=HARDWARE | LOADVIEW',10
 dc.b '	SYSTEM=PAL | NTSC',10
 dc.b '	WORKBENCH=CLOSE',10
 dc.b '	SCREEN=X size,Y size,Viewmode',10
 dc.b '	SCRCLOSE=ON',10
 dc.b '	RESCUE=OFF',10
 dc.b '	ALLOCATE=Address,Size',10
 dc.b '	CACHE=OFF',10
 dc.b '	MULTITASKING=OFF',10
 dc.b '	INTERRUPTS=OFF',10
 dc.b '	LOAD=Load address',10
 dc.b '	JUMP=Jump address',10
 dc.b 10
 dc.b 'ENTER to continue...'
info3:
 dc.b 155,65
 dc.b '                    ',155,65,10
 dc.b 'List of viewmodes:',10
 dc.b 10
 dc.b '	$8000 - hires',10
 dc.b '	$20   - superhires',10
 dc.b '	$8    - double scan',10
 dc.b '	$4    - interlace',10
 dc.b 10
 dc.b 10
 dc.b 'ENTER to continue...'
info4
 dc.b 155,65
 dc.b '                    ',155,65,10
 dc.b 'List of arguments:',10
 dc.b 10
 dc.b '	{F "something" "dir" "def" "pat"} brings you file requester',10
 dc.b '	{S "something" "def"} will get string',10
 dc.b '	{O "text" "gad1|gad2|...gadx" "op1|op2|...opx"}',10
 dc.b '		will get option from requester.',10
 dc.b '	{W} will get any argument from Workbench',10
 dc.b '	{FW "something" "dir" "def" "pat"} will get filename from Workbench',10
 dc.b '	{SW "something" "def"} will get string from Workbench',10
 dc.b '	{FM "something" "dir" "def" "pat"} - multiselect file requester',10
 dc.b '	{WM} - multiselection from Workbench',10
 dc.b '	{FWM "something" "dir" "def" "pat"} - multiselection from',10
 dc.b '		Workbench or requester',10
 dc.b 10
 dc.b 'ENTER to continue...'
info5:
 dc.b 155,65
 dc.b '                    ',155,65,10
 dc.b '"something"'," is the name of requester's window",10
 dc.b '"dir" is default directory',10
 dc.b '"text"'," is the text in requester's window",10
 dc.b '"gad1"-"gadx" is the text in gadgets',10
 dc.b '"op1"-"opx" - options',10
 dc.b '"def" - default answer',10
 dc.b '"pat" - file match pattern',10
 dc.b 10
 dc.b 10
 dc.b 'If you want to contact me, here is my address:',10
 dc.b 10,27,'[2m'
 dc.b 'Piotr Pawlow',10
 dc.b 'ul. Lewartowskiego 12 m.46',10
 dc.b '00-185 Warszawa',10
 dc.b 'Polska',10,27,'[0m'
 dc.b 'ENTER to continue...'
info6:
 dc.b 155,65
 dc.b '                    ',155,65,10
 dc.b 10
 dc.b 'If you use this program on any PD/shareware or commercial pack,',10
 dc.b 'please send me a copy of it !',10
 dc.b 10
info7:

lmbtext:
	dc.b	'LMB -',0
rmbtext:
	dc.b	'RMB -',0

windowcopy:
	dc.b	'CON:0/0/640/150/IconPP v.3.0 by PP of Termos output window/AUTO/CLOSE',0
executenamecopy:
	dc.b	'C:EXECUTE ',0
assigncmdcopy:
	dc.b	'c:assign ',0

	dc.b	'$VER: IconPP 3.0 (12.04.95)',0

	section	nico,BSS

buffer:
	ds.b	10
adresses:
	ds.l	4

gadstable:
	ds.l	10

	ds.l	1

diradresses:
	ds.l	20
directories:
	ds.b	1024

chars:
	ds.l	1

stringbuffer:
	ds.b	256

nazwa:
	ds.l	1

filebuffer:
	ds.b	256

	ds.b	1
string:
	ds.b	2048

directory:
	ds.b	256

	even

filesize:
	ds.l	1
fileinfoadr:
	ds.l	1

	even

fileinfoblk:
	ds.b	262

currentdir:
	ds.l	1

cddir:	ds.b	256

assigncmd:
	ds.b	9
assignargs:
	ds.b	256

	even

textadresses:
	ds.l	20

orgsource:
	ds.l	1
orgdest:
	ds.l	1

dosbase:
	ds.l	1
iconbase:
	ds.l	1
gfxbase:
	ds.l	1
intbase:
	ds.l	1
wbmsg:	ds.l	1
wbargs:
	ds.l	1
file:
	ds.l	1
windowfile:
	ds.l	1
window:
	ds.b	256
executename:
	ds.b	10
prgname:
	ds.b	2048
stack:
	ds.l	1
loadadr:
	ds.l	1
jumpadr:
	ds.l	1
allocadr:
	ds.l	1
alloclen:
	ds.l	1
copperlist:
	ds.l	1
prgnameadress:
	ds.l	1
a0store:
	ds.l	1
view:	ds.l	1
alertbuf:
	ds.b	256
stdcd:
	ds.l	1
pattern:
	ds.b	80
