 move.l	#0,wbmsg
 move.l	#0,a1
 move.l	4,a6
 jsr	-294(a6)
 move.l	d0,a4
 tst.l	$ac(a4)
 bne	deranfang
 lea	$5c(a4),a0
 jsr	-384(a6)
 lea	$5c(a4),a0
 jsr	-372(a6)
 move.l	d0,wbmsg

deranfang:
 moveq	#0,d5
 move.l	4,a6
 lea	dosname(pc),a1
 jsr	-408(a6)
 move.l	d0,dosbase
 beq	nodoser
 lea	intname(pc),a1
 jsr	-408(a6)
 move.l	d0,intbase
 beq	nointer
 lea	gfxname(pc),a1
 jsr	-408(a6)
 move.l	d0,gfxbase
 beq	nogfxer
 lea	codname(pc),a1
 jsr 	-408(a6)
 move.l	d0,codbase
 beq	nocoder
 lea	reqtoolsname(pc),a1
 jsr	-408(a6)
 move.l	d0,reqbase
 beq	suchereq1
 move.l	#2,reqda
 bra	reqdaweiter
suchereq1:
 lea	aslname(pc),a1
 jsr	-408(a6)
 move.l	d0,reqbase
 beq	suchereq2
 move.l	#1,reqda
 bra	reqdaweiter
suchereq2:
 lea	reqname(pc),a1
 jsr	-408(a6)
 move.l	d0,reqbase
 beq	suchereq3
 move.l	#3,reqda
 bra	reqdaweiter
suchereq3:
 lea	arpname(pc),a1
 jsr	-408(a6)
 move.l	d0,reqbase
 beq	suchereq4
 move.l	#4,reqda
 bra	reqdaweiter
suchereq4:
 move.l	#0,reqda
 bra	noreq
 


reqdaweiter:
          ; hier die Struc der filereqs oeffnen!
 cmp.l	#1,reqda
 bne	reqdaw1
 move.l	reqbase,a6
 jsr	-30(a6)
 move.l	d0,reqstruc
 bne	noreq
 move.l	4,a6
 move.l	reqbase,a1
 jsr	-414(a6)
 bra	suchereq1

reqdaw1:
 cmp.l	#2,reqda
 bne	reqdaw2
 move.l	reqbase,a6
 moveq	#0,d0
 move.l	#0,a0
 jsr	-30(a6)
 move.l	d0,reqstruc
 bne	noreq
 move.l	4,a6
 move.l	reqbase,a1
 jsr	-414(a6)
 bra	suchereq2

reqdaw2:
 cmp.l	#3,reqda
 bne	reqdaw3

reqdaw3:
 cmp.l	#4,reqda
 bne	reqdaw4

reqdaw4:

noreq:
 move.l	codbase(pc),a6
 jsr	-96(a6)
 move.l	d0,codinfoblk

 move.l	intbase(pc),a6
 lea	windowstruc(pc),a0
 jsr	-204(a6)
 move.l	d0,window
 move.l	d0,a0
 move.l	50(a0),rp
 move.l	46(a0),a0
 move.b	30(a0),d0
 and.l	#$ff,d0
 sub.l	#10,d0
 move.l	d0,dy
 move.l	intbase,a6
 move.l	window,a0
 move.l	#630,d0
 move.l	dy,d1
 add.l	#66,d1
 jsr	-288(a6)
H:
 move.l dosbase,a6
 move.l #10,d1
 jsr -198(a6)

 move.l	gfxbase,a6
 move.l	#textattribute,a0
 jsr	-72(a6)
 move.l	d0,fontstruc
 move.l	d0,a0
 move.l	rp,a1
 jsr	-66(a6)

 lea	srcgad,a5
 move.l	dy,d0
morphcoords:
 add	d0,6(a5)
 move.l	(a5),a5
 cmp.l	#0,a5
 bne	morphcoords

 move.l	intbase,a6
 lea	srcgad,a0
 move.l	window,a1
 move.l	#0,a2
 moveq	#8,d0
 jsr	-432(a6)

 move.l	rp,a0
 lea	srcgadtxt,a1
 moveq	#0,d0
 move.l	dy,d1
 jsr	-216(a6)

 move.l	window,a0
 jsr	-456(a6)

 bsr	initwin
 move.l	#1,caflag
 bsr	changealgo
 bsr	changealgo
 move.l	#0,caflag
 bsr	main

 move.l	fontstruc,a1
 move.l	gfxbase,a6
 jsr	-78(a6)

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

 tst.l	reqda
 beq	keinreqschl
 move.l	reqbase,a6
                         ; hier reqstruc wieder freigeben!
 cmp.l	#1,reqda
 bne	schlreqw1
 move.l	reqstruc,a0
 jsr	-36(a6)
 bra	schlreq

schlreqw1:
 cmp.l	#2,reqda
 bne	schlreqw2
 move.l	reqstruc,a1
 jsr	-36(a6)
 bra	schlreq
schlreqw2:
 cmp.l	#3,reqda
 bne	schlreqw3
 bra	schlreq
schlreqw3:
 cmp.l	#4,reqda
 bne	schlreqw4
 bra	schlreq
schlreqw4:


schlreq:
 move.l	4,a6
 move.l	reqbase(pc),a1
 jsr	-414(a6)

keinreqschl:
 moveq	#-5,d5
nocoder:
 move.l	4,a6
 move.l	codbase(pc),a1
 jsr	-414(a6)
 move.l	gfxbase(pc),a1
 jsr	-414(a6)
nogfxer
 move.l	intbase(pc),a1
 jsr	-414(a6)
nointer
 move.l	dosbase(pc),a1
 move.l	4,a6
 jsr	-414(a6)
nodoser:
 tst.l	d5
 bne	oktoex
 bsr	failinopenlib

oktoex:
 tst.l	wbmsg
 beq	oktoex2
 move.l	4,a6
 jsr	-132(a6)
 move.l	wbmsg,a1
 jsr	-378(a6)
 jsr	-138(a6)
oktoex2:
 moveq	#0,d0
 rts

initwin:
 moveq	#0,d2
 moveq	#0,d3
 moveq	#0,d4
 moveq	#0,d5
 lea	srcgad(pc),a2
initwinlp1:
 move.l	(a2),a3
 move	4(a2),d2
 move	6(a2),d3
 move	8(a2),d4
 move	10(a2),d5
 add.l	d2,d4
 add.l	d3,d5
 bsr	drawborder
 move.l	a3,a2
 move.l	a3,d0
 tst.l	d0
 bne	initwinlp1
 moveq	#45,d1
 move.l	#120,d0
 add.l	dy,d1
 lea	codewordtxt(pc),a0
 bsr	text
 moveq	#64,d3
 moveq	#64,d5
 add.l	dy,d3
 add.l	dy,d5
 moveq	#3,d2
 move.l	#637,d4
 bsr	drawborder
 moveq	#115,d2
 moveq	#12,d3
 add.l	dy,d3
 moveq	#115,d4
 moveq	#49,d5
 add.l	dy,d5
 bsr	drawborder
 moveq	#115,d2
 moveq	#49,d3
 add.l	dy,d3
 move.l	#190,d4
 moveq	#49,d5
 add.l	dy,d5
 bsr	drawborder
 move.l	#190,d2
 moveq	#49,d3
 move.l	#190,d4
 moveq	#62,d5
 add.l	dy,d3
 add.l	dy,d5
 bsr	drawborder
 move.l	#0,infopos
 move.l	codinfoblk,d0
 add.l	#6,d0
 move.l	d0,infoptr
 bsr	writecodinfo
 rts

drawborder:
 subq.l	#1,d2
 subq.l	#1,d3
 move.l	gfxbase(pc),a6
 move.l	rp(pc),a1
 moveq	#2,d0
 jsr	-342(a6)
 move.l	rp(pc),a1
 move.l	d2,d0
 move.l	d3,d1
 jsr	-240(a6)
 move.l	rp(pc),a1
 move.l	d4,d0
 move.l	d3,d1
 jsr	-246(a6)
 move.l	rp(pc),a1
 moveq	#1,d0
 jsr	-342(a6)
 move.l	rp(pc),a1
 move.l	d4,d0
 move.l	d5,d1
 jsr	-246(a6)
 move.l	rp(pc),a1
 move.l	d2,d0
 move.l	d5,d1
 jsr	-246(a6)
 move.l	rp(pc),a1
 moveq	#2,d0
 jsr	-342(a6)
 move.l	rp(pc),a1
 move.l	d2,d0
 move.l	d3,d1
 jsr	-246(a6)
 move.l	rp(pc),a1
 moveq	#1,d0
 jsr	-342(a6)
 rts

dosname	dc.b	"dos.library",0
intname	dc.b	"intuition.library",0
gfxname	dc.b	"graphics.library",0,0
codname	dc.b	"coder.library",0
reqtoolsname	dc.b	"reqtools.library",0
aslname	dc.b	"asl.library",0
reqname	dc.b	"req.library",0
arpname	dc.b	"arp.library",0
 even
textattribute	dc.l	fontname
		dc.w	8
		dc.b	0,1
fontname	dc.b	"topaz.font",0
 even
fontstruc	dc.l	0
dy		dc.l	0
dosbase	dc.l	0
intbase	dc.l	0
gfxbase	dc.l	0
reqbase	dc.l	0
wbmsg	dc.l	0
destfilepnt	dc.l	0
window	dc.l	0
decodekennung	dc.l	0
lmdflag	dc.l	0
anfangsflag	dc.l	0
rp	dc.l	0
codbase	dc.l	0
sourcefilelen	dc.l	0
codinfoblk	dc.l	0
infoptr	dc.l	0
infopos	dc.l	0
todo	dc.l	0
reqda	dc.l	0
codingok	dc.l	0
reqstruc	dc.l	0
coderidstruc	dc.l	0
 cnop	0,4
fileinfo	ds.b	260
lock	dc.l	0
altlock	dc.l	0

windowstruc
 dc.w	0,0,10,10
 dc.b	0,1
 dc.l	%1001000000
 dc.l	%1000000001110
 dc.l	srcgad	; erstes Gadg
 dc.l	0
 dc.l	winname
scrpnt
 dc.l	0
 dc.l	0
 dc.w	0,0,0,0,1

srcgad
 dc.l	destgad
 dc.w	10,13,100,10,0,%1000000011,1
 dc.l	0,0
 dc.l	0			;srcgadtxt
 dc.l	0,0
 dc.w	1,0,0

srcgadtxt
 dc.b	3,0
 dc.b	0
 even
 dc.w	10,14
 dc.l	0
 dc.l	srcgadtxttxt
 dc.l	destgadtxt
srcgadtxttxt	dc.b	"Source:",0
 even

destgad
 dc.l	startgad
 dc.w	10,25,100,10,0,%1000000011,1
 dc.l	0,0
 dc.l	0
 dc.l	0,0
 dc.w	2,0,0
destgadtxt
 dc.b	3,0
 dc.b	0
 even
 dc.w	10,26
 dc.l	0
 dc.l	destgadtxttxt
 dc.l	startgadtxt
destgadtxttxt	dc.b	"Destination:",0
 even

startgad
 dc.l	algogad
 dc.w	35,38,50,10,0,%1000000011,1
 dc.l	0,0
 dc.l	0
 dc.l	0,0
 dc.w	3,0,0
startgadtxt
 dc.b	3,0
 dc.b	0
 even
 dc.w	40,39
 dc.l	0
 dc.l	startgadtxttxt
 dc.l	algogadtxt
startgadtxttxt	dc.b	"START",0
 even


algogad
 dc.l	dabasicgad
 dc.w	10,51,100,10,0,%1000000011,1
 dc.l	0,0
 dc.l	0
 dc.l	0,0
 dc.w	4,0,0
algogadtxt
 dc.b	3,0
 dc.b	0
 even
 dc.w	10,52
 dc.l	0
 dc.l	algogadtxttxt
 dc.l	dabasicgadtxt
algogadtxttxt	dc.b	"Algorithmus:",0
 even

dabasicgad
 dc.l	srcstrgad
 dc.w	195,51,138,10,0,%1000000011,1
 dc.l	0,0
 dc.l	0
 dc.l	0,0
 dc.w	5,0,0
dabasicgadtxt
 dc.b	3,0
 dc.b	0
 even
 dc.w	195,52
 dc.l	0
 dc.l	dabasicgadtxttxt
 dc.l	0
dabasicgadtxttxt	dc.b	"Decode AmigaBASIC",0
 even

srcstrgad:
 dc.l	deststrgad
 dc.w	120,13,400,10,3,%1000000011,4
 dc.l	0,0
 dc.l	srcstrgadtext
 dc.l	0,srcstrgadex
 dc.w	6,0,0
srcstrgadtext	ds.l	55
srcstrgadex
 dc.l	sourcepfad
 dc.l	undopuffer
 dc.w	0,100,0,0,0,0,0,0
 dc.l	0,0,0
sourcepfad	ds.l	55

deststrgad:
 dc.l	codegad
 dc.w	120,25,400,10,3,%1000000011,4
 dc.l	0,0
 dc.l	deststrgadtext
 dc.l	0,deststrgadex
 dc.w	7,0,0
deststrgadtext	ds.l	55
deststrgadex
 dc.l	destpfad
 dc.l	undopuffer
 dc.w	0,100,0,0,0,0,0,0
 dc.l	0,0,0
destpfad	ds.l	55

codegad:
 dc.l	0
 dc.w	195,38,325,10,3,%1000000011,4
 dc.l	0,0
 dc.l	codestrgadtext
 dc.l	0,codestrgadex
 dc.w	8,0,0
codestrgadtext	ds.l	55
codestrgadex
 dc.l	codepfad
 dc.l	undopuffer
 dc.w	0,100,0,0,0,0,0,0
 dc.l	0,0,0
codepfad	ds.l	55


undopuffer	ds.l	55
winname	dc.b	"CoderMiniClone V0.8",0
codewordtxt	dc.b	"Codeword:",0
 even

failinopenlib:
 rts


main:
 move.l	#0,anfangsflag
 move.l	window(pc),a0
 move.l	4,a6
 move.l	86(a0),a0
 move.l	a0,a5
 move.b	15(a0),d1
 moveq	#0,d0
 bset	d1,d0
 jsr	-318(a6)
 move.l	a5,a0
 jsr	-372(a6)
 move.l	d0,d7
 move.l	d0,a1
 jsr	-378(a6)
 move.l	d7,a2
 move.l $1c(a2),a2
 moveq	#0,d0
 move	$26(a2),d0

 cmp	#1,d0
 beq	sourcefilereq
 cmp	#2,d0
 beq	destfilereq
 cmp	#3,d0
 beq	start
 cmp	#4,d0
 beq	changealgo
 cmp	#5,d0
 beq	decodeabasic

 move.l	d7,a2
 move.l	$14(a2),a2
 move.l	a2,d3
 and.l	#%1000000000,d3
 tst.l	d3
 beq	mainw1
 rts
mainw1:
 bra	main

sourcefilereq:
 lea	sourcepfad,a5
 bra	holereqdat

holereqdat:
 move.l	reqbase,a6
 cmp.l	#1,reqda
 bne	sourcefilereqw1
 move.l	reqstruc,a0
 jsr	-42(a6)

 move.l	reqstruc,a3
 move.l	8(a3),a4	; dirname  in a4
 move.l	4(a3),a3	; filename in a3

fangendlichan:
 move.l	a4,a2
namecopw1:
 tst.b	(a4)
 beq	namecopw2
 move.b	(a4)+,(a5)+
 bra	namecopw1
namecopw2:
 move.l	a2,a4
 tst.b	(a4)
 beq	namecopw10
 cmp.b	#"/",-1(a5)
 beq	namecopw10
 cmp.b	#":",-1(a5)
 beq	namecopw10
 move.b	#"/",(a5)+
namecopw10:
 move.l	a3,a4
namecopw3:
 tst.b	(a4)
 beq	namecopw4
 move.b	(a4)+,(a5)+
 bra	namecopw3
namecopw4:
 move.b	#0,(a5)
 move.l	#srcstrgad,a0
 move.l	window,a1
 move.l	#0,a2
 move.l	intbase,a6
 jsr	-222(a6)
 bra	main

sourcefilereqw1:
 cmp.l	#2,reqda
 bne	sourcefilereqw2
 move.l	reqstruc,a1
 move.l	#undopuffer,a2
 move.l	#0,a3
 move.l	#0,a0
 jsr	-54(a6)


 move.l	#undopuffer,a3
 move.l	reqstruc,a4
 move.l	16(a4),a4
 bra	fangendlichan

sourcefilereqw2:
 cmp.l	#3,reqda
 bne	sourcefilereqw3
 bra	main

sourcefilereqw3:
 cmp.l	#4,reqda
 bne	sourcefilereqw4
 bra	main

sourcefilereqw4:
 bra main

destfilereq:
 move.l	#destpfad,a5
 bra	holereqdat

lsfg:
 move.l	4,a6
 move.l	lastmem,a1
 move.l	#260,d0
 jsr	-210(a6)
 bra	main

lastmem	dc.l	0


start:
 lea	codepfad,a0
 tst.b	(a0)
 bne	startweiter1
 lea	keincodw,a0
 bsr	msgtext
 bra	main
startweiter1:
 move.l	dosbase,a6
 move.l	#sourcepfad,d1
 move.l	#-2,d2
 jsr	-84(a6)
 move.l	d0,lock
 bne	startweiter2
 lea	cantopenfile,a0
 bsr	msgtext
 bra	main
startweiter2:
 move.l	lock,d1
 move.l	#fileinfo,d2
 move.l	dosbase,a6
 jsr	-102(a6)
 tst.l	fileinfo+4
 bpl	startweiter333
 move.l	lock,d1
 move.l	dosbase,a6
 jsr	-90(a6)
 bsr	codedecode
 bra	main

startweiter333:
 lea	zwischenspeicher,a0
 move.l	#109,d7
stwlp1333:
 move.b	#0,(a0)+
 dbf	d7,stwlp1333
 move.b	#0,sourcepfad
 bra	startweiter3

zwischenspeicher	ds.b	110

startweiter3:
;####################################################################
;#                         rekursiver algo                          #
;####################################################################
 move.l	dosbase,a6
 move.l	lock,d1
 jsr	-126(a6)
startweiter4:
 move.l	dosbase,a6
 move.l	lock,d1
 move.l	#fileinfo,d2
 jsr	-108(a6)
 tst.l	d0
 bne	stw2
 bsr	texthandlingandcod
 move.l	lock,d1
 move.l	dosbase,a6
 jsr	-90(a6)

 bra	main

stw2:
 tst.l	fileinfo+4
 bpl	startweiter4
 lea	fileinfo,a0
 add.l	#8,a0
 lea	zwischenspeicher,a1
stw1:
 move.b	(a0)+,(a1)+
 tst.b	-1(a0)
 bne	stw1
 bsr	texthandlingandcod
 lea	zwischenspeicher,a0
 lea	sourcepfad,a1
stw12:
 move.b	(a0)+,(a1)+
 tst.b	-1(a0)
 bne	stw12
 tst.l	nichtweiterflag
 beq	startweiter4
 move.l	dosbase,a6
 move.l	lock,d1
 jsr	-90(a6)
 lea	ones,a0
 bsr	msgtext
 bra	main


nichtweiterflag	dc.l	0


texthandlingandcod:
 tst.b	sourcepfad
 bne	mww3
 rts
mww3:
 move.l	dosbase,a6
 move.l	#sourcepfad,d1
 move.l	#1005,d2
 jsr	-30(a6)
 move.l	d0,d7
 bne	thacw5
thacw6:
 move.l	d7,d1
 jsr	-36(a6)
 bra	thacw4
thacw5:
 move.l	d0,d1
 move.l	#scd,d2
 move.l	#7,d3
 jsr	-42(a6)
 tst.l	d0
 beq	thacw6
 move.l	d7,d1
 jsr	-36(a6)
 move.l	codbase,a6
 lea	scd,a0
 lea	coderidstruc,a1
 jsr	-60(a6)
 tst.b	coderidstruc
 beq	thacw7
 bmi	thacw4
 move.l	#1,sc
 bra	thacw8
thacw7:
 move.l	#0,sc
thacw8: 
 lea	sourcepfad,a0
 lea	destpfad,a1
thacw2:
 move.b	(a0)+,(a1)+
 bne	thacw2
 bsr	codedecode
 tst.l	codingok
 beq	thacw3
  rts
thacw3:
 lea	destpfad,a0
 tst.l	sc
 beq	thacw9
thacw12:
 tst.b	(a0)+
 bne	thacw12
 cmp.b	#"D",-2(a0)
 bne	thacw13
 cmp.b	#"O",-3(a0)
 bne	thacw13
 cmp.b	#"C",-4(a0)
 bne	thacw13
 cmp.b	#".",-5(a0)
 bne	thacw13
 move.b	#0,-5(a0)
 bra	thacw11
thacw13:
 move.b	#".",-1(a0)
 move.b	#"D",(a0)
 move.b	#"E",1(a0)
 move.b	#"C",2(a0)
 move.b	#"O",3(a0)
 move.b	#"D",4(a0)
 move.b	#0,5(a0)
 bra	thacw11
thacw9:
 tst.b	(a0)+
 bne	thacw9
 move.b	#".",-1(a0)
 move.b	#"C",(a0)
 move.b	#"O",1(a0)
 move.b	#"D",2(a0)
 move.b	#0,3(a0)
thacw11:
 bsr	codedecode
 tst.l	codingok
 bne	thacw1
thacw4
 bsr	fehlerreq
thacw1:
 rts

sc	dc.l	0
scd	ds.l	10


fehlerreq:
 move.l	window,a0
 lea	bottomtext,a1
 lea	lefttext,a2
 lea	righttext,a3
 moveq	#0,d0
 moveq	#0,d1
 move.l	#200,d2
 move.l	#80,d3
 move.l	intbase,a6
 jsr	-348(a6)
 move.l	d0,nichtweiterflag
 rts

bottomtext
 dc.b	1,0,0,0
 dc.w	0,0
 dc.l	0,btext,0
btext	dc.b	"Error occured while coding dir",0
 even
lefttext
 dc.b	1,0,0,0
 dc.w	0,0
 dc.l	0,ltext,0
ltext	dc.b	"Stop",0
 even
righttext
 dc.b	1,0,0,0
 dc.w	0,0
 dc.l	0,rtext,0
rtext	dc.b	"Continue",0
 even

codedecode:
 move.l	#srcstrgad,a0
 move.l	window,a1
 move.l	#0,a2
 move.l	intbase,a6
 jsr	-222(a6)
 move.l	#0,lmdflag
 move.l	#0,anfangsflag
 move.l	#0,codingok
 move.b	aktuellekennung,d1
 move.l	codbase(pc),a6
 move.b	#1,coderidstruc
 move.b	d1,coderidstruc+1
 lea	coderidstruc,a0
 jsr	-108(a6)                 ; len coderID feststellen
 move	coderidstruc+2,d0
 ext.l	d0
 cmp.l	#-1,d0
 bne	startw1
 lea	zuhohevers,a0
 bsr	msgtext
 rts
startw1
 tst.l	d0
 bne	startw2
 lea	falsch,a0
 bsr	msgtext
 rts
startw2
 move.l	d0,filememlen          ; coderIDlen
 move.l	d0,infohlen            ; coderIDlen
 move.l	dosbase(pc),a6
 move.l	#1005,d2
 move.l	#sourcepfad,d1
 jsr	-30(a6)
 tst.l	d0
 bne	startw3
 lea	cantopenfile,a0
 bsr	msgtext
 rts
startw3	
 move.l	d0,sourcefilepnt
 move.l	d0,d1
 move.l	#0,d2
 move.l	#1,d3
 jsr	-66(a6)
 move.l	sourcefilepnt,d1
 move.l	#0,d2
 move.l	#-1,d3
 jsr	-66(a6)
 move.l	d0,sourcefilelen
 add.l	d0,filememlen
 move.l	4,a6
 moveq	#1,d1
 move.l	filememlen,d0
 jsr	-198(a6)
a:
 tst.l	d0
 bne	startw4
 lea	slmm(pc),a0
 bsr	msgtext
 move.l	dosbase,a6
 lea	sourcepfad,a0
 lea	destpfad,a1
vgls1:
 cmp.b	(a0)+,(a1)+
 bne	vglsw1
 tst.b	-1(a0)
 bne	vgls1
 bra	ngas



vglsw1:
 move.l	dosbase,a6
 move.l	#destpfad,d1
 move.l	#1006,d2
 jsr	-30(a6)
 move.l	d0,destfilepnt
 beq	ngas2
b:
 move.l	4,a6
 move.l	#$20001,d1
 jsr	-216(a6)
 move.l	d0,filememlen
 cmp.l	infohlen,d0
 bmi	nmdigpd          ; source und dest offen, genug speicher da!
 move.l	sourcefilelen,d1
 move.l	d1,todo
 move.l	filememlen,d0 
 moveq	#1,d1
 jsr	-198(a6)
 move.l	d0,filemem       ; speicher belegt
 beq	lksmf2


 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 move.l	filemem,d2
 move.l	filememlen,d3
 jsr	-42(a6)
 cmp.l	filememlen,d0
 bne	lmlp1er1
 move.l	codbase,a6
 lea	coderidstruc,a1
 move.l	filemem,a0
 jsr	-60(a6)
 tst.b	coderidstruc
 bmi	zhv11
 beq	lmmw1
 move.l	#1,lmdflag
 move.b	coderidstruc+1,d0
 and.l	#$ff,d0
 move.l	d0,decodekennung
 move	coderidstruc+2,d0
 ext.l	d0
 move.l	d0,infohlen
 sub.l	d0,sourcefilelen
 move.l	sourcefilelen,d0
 move.l	d0,todo
 bra	lmlp1

lmmw1
 move.l	filemem,a1
 move.b	#1,coderidstruc
 move.b	aktuellekennung,d0
 move.b	d0,coderidstruc+1
 move.l	#coderidstruc,a0
 move.l	codbase,a6
 jsr	-114(a6)
 cmp.b	#1,coderidstruc
 beq	wwww1
 lea	falsch(pc),a0
 bsr	msgtext
 bra	wwwww1

wwww1:
 move.l	dosbase,a6
 move.l	destfilepnt,d1
 move.l	filemem,d2
 move.l	infohlen,d3
 jsr	-48(a6)
 tst.l	d0
 bne	lmlp1
 lea	wed(pc),a0
 bsr	msgtext
 bra	wwwww1

lmlp1:
 move.l	filememlen,d0
 cmp.l	todo,d0
 beq	lmlp1w11		; todo>filememlen(mehrmals codieren)
 bmi	lmlp1w1
lmlp1w11:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 move.l	filemem,d2
 move.l	todo,d3
 jsr	-42(a6)
 tst.l	d0
 beq	lmlp1er1
 move.l	codbase,a6
 move.l	filemem,a0
 move.l	filemem,a1
 move.l	todo,d0
 jsr	-72(a6)

 move.l	dosbase,a6
 move.l	destfilepnt,d1
 move.l	filemem,d2
 move.l	todo,d3
 jsr	-48(a6)
 tst.l	d0
 beq	lmlp1er2
 move.l	#0,todo
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 move.l	destfilepnt,d1
 jsr	-36(a6)
 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
 bra	gggg1

lmlp1w1:
 tst.l	lmdflag
 bne	lmlp1w20
lmlp1w4:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 move.l	0,d2
 move.l	#-1,d3
 jsr	-66(a6)
lmlp1w40:
 move.l	sourcefilepnt,d1
 move.l	filemem,d2
 move.l	filememlen,d3
 jsr	-42(a6)
 cmp.l	filememlen,d0
 bne	lmlp1er1
 bra	lmlp1w30


lmlp1w20:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 move.l	infohlen,d2
 move.l	#-1,d3
 jsr	-66(a6)
 bra	lmlp1w40

lmlp1w30:
 move.l	codbase,a6
 tst.l	anfangsflag
 bne	lmlp1w2
 move.l	codbase,a6
 move.l	filemem,a0
 move.l	filemem,a1
 move.l	filememlen,d0
 move.l	#codepfad,a2
 move.b	aktuellekennung,d1
 ext	d1
 ext.l	d1
 tst.l	lmdflag
 beq	lmlp1w5
 move.l	decodekennung,d1
 jsr	-84(a6)
 bra	lmlp1w6
lmlp1w5:
 jsr	-78(a6)
lmlp1w6:
 move.l	#1,anfangsflag
 bra	lmlp1w3
lmlp1w2:
 move.l	filemem,a0
 move.l	filemem,a1
 move.l	filememlen,d0
 move.l	codbase,a6
 jsr	-72(a6)
lmlp1w3:
 move.l	dosbase,a6
 move.l	destfilepnt,d1
 move.l	filemem,d2
 move.l	filememlen,d3
 jsr	-48(a6)
 cmp.l	filememlen,d0
 bne	lmlp1er2
 move.l	filememlen,d0
 sub.l	d0,todo
 bra	lmlp1


lksmf2:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 move.l	destfilepnt,d1
 jsr	-36(a6)
 lea	ksmf2(pc),a0
 bsr	msgtext
 rts

lmlp1er1:
 lea	res(pc),a0
 bsr	msgtext
wwwww1:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 move.l	destfilepnt,d1
 jsr	-36(a6)
 move.l	#destpfad,d1
 jsr	-72(a6)
 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
 rts

lmlp1er2:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 move.l	destfilepnt,d1
 jsr	-36(a6)
 move.l	#destpfad,d1
 jsr	-72(a6)
 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
 lea	wed(pc),a0
 bsr	msgtext
 rts

nmdigpd:
 move.l	sourcefilepnt,d1
 move.l	dosbase,a6
 jsr	-36(a6)
 move.l	destfilepnt,d1
 jsr	-36(a6)
 lea	nmdigpdm1(pc),a0
 bsr	msgtext
 rts 

ngas2:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 move.l	destfilepnt,d1
 jsr	-36(a6)
 move.l	#destpfad,d1
 jsr	-72(a6)
 lea	codf(pc),a0
 bsr	msgtext
 rts

ngas:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 lea	sadmbd(pc),a0
 bsr	msgtext
 rts

zhv11:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 move.l destfilepnt,d1
 jsr	-36(a6)
 move.l	#destpfad,d1
 jsr	-72(a6)
 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
 lea	zuhohevers(pc),a0
 bsr	msgtext
 rts

startw4
 move.l	d0,filemem
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 move.l	filemem,d2
 add.l	infohlen,d2
 move.l	filememlen,d3
 sub.l	infohlen,d3
 jsr	-42(a6)
 cmp.l	#-1,d0
 bne	startw5
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
 lea	dosreader,a0
 bsr	msgtext
 rts
startw5
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 move.l	filemem,a0
 add.l	infohlen,a0
 move.l	filemem,a1
 move.l	#codepfad,a2
 tst.b	(a2)
 bne	www1
 lea	keincodw,a0
 bra	wwn2
www1:
 move.l	filememlen,d0
 sub.l	infohlen,d0
 move.l	codbase,a6
 jsr	-102(a6)
 cmp.l	#-1,d0
 bne	startw6
 lea	verszuhoch(pc),a0
wwn2:
 bsr	msgtext
 move.l	filemem,a1
 move.l	filememlen,d0
 move.l	4,a6
 jsr	-210(a6)
 rts
startw6:
 tst.l	d0
 beq	startw7
 move.l	d0,d4
 move.l	dosbase,a6
 move.l	#destpfad,d1
 move.l	#1006,d2
 jsr	-30(a6)
 move.l	d0,sourcefilepnt
 move.l	d0,d1
 beq	startn1
 move.l	filemem,d2
 move.l	d4,d3
 jsr	-48(a6)
 cmp.l	#-1,d0
 bne	startn3
 move.l	#doswer,a0
 bsr	msgtext
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 move.l	#destpfad,d1
 jsr	-72(a6)
 bra	startn2
startn3
 move.l	#datendecodok,a0
 bsr	msgtext
 move.l	#1,codingok
startn4
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
 bra	startn2
startn1
 move.l	#cantopendfile,a0
 bsr	msgtext
startn2
 move.l	filemem,a1
 move.l	filememlen,d0
 move.l	4,a6
 jsr	-210(a6)
 rts
startw7		;file unter filemem+infohlen mit filelen in memory
		;klar zum codieren! aktuellekennung(var)
 move.l	codbase,a6
 move.l	filemem,a1
 lea	coderidstruc,a0
 jsr	-114(a6)
 cmp.b	#1,coderidstruc
 beq	startw8

 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
 lea	falsch,a0
 bsr	msgtext
 rts
startw8
 move.l	filemem,a0
 add.l	infohlen,a0
 move.l	a0,a1
 lea	codepfad,a2
 tst.b	(a2)
 bne	www4
 move.l	filemem,a1
 move.l	filememlen,d0
 move.l	4,a6
 jsr	-210(a6)
 lea	keincodw,a0
 bsr	msgtext
 rts

www4
 move.l	filememlen,d0
 sub.l	infohlen,d0
 move.b	aktuellekennung,d1
 ext.w	d1
 ext.l	d1
 move.l	codbase,a6
 jsr	-78(a6)
 move.l	dosbase,a6
 move.l	#destpfad,d1
 move.l	#1006,d2
 jsr	-30(a6)
 tst.l	d0
 bne	startw9
 move.l	filemem,a1
 move.l	filememlen,d0
 move.l	4,a6
 jsr	-210(a6)
 lea	cantopenfile,a0
 bsr	msgtext
 rts
startw9
 move.l	d0,d7
 move.l	d0,d1
 move.l	filemem,d2
 move.l	filememlen,d3
 jsr	-48(a6)
 cmp.l	#-1,d0
 bne	startw10
 move.l	d7,d1
 jsr	-36(a6)
 move.l	#destpfad,d1
 jsr	-72(a6)
 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
 lea	doswer,a0
 bsr	msgtext
 rts
startw10:
 move.l	d7,d1
 jsr	-36(a6)
gggg1:
 tst.l	lmdflag
 bne	gggg2
 lea	datencodok,a0
 bra	gggg3
gggg2:
 lea	datendecodok,a0
gggg3:
 bsr	msgtext
 move.l	#1,codingok
 rts


changealgo:
 add.l	#14,infoptr
 add.l	#1,infopos
 move.l	codinfoblk,a0
 move	4(a0),d0
 ext.l	d0
 cmp.l	infopos,d0
 bne	changealgow1
 move.l	#0,infopos
 move.l	codinfoblk,d0
 add.l	#6,d0
 move.l	d0,infoptr
changealgow1:
 bsr	writecodinfo
 tst.l	caflag
 beq	changealgow2
 rts
changealgow2:
 bra	main

caflag	dc.l	0


decodeabasic:
 move.l	dosbase,a6
 move.l	#sourcepfad,d1
 move.l	#1005,d2
 jsr	-30(a6)
 move.l	d0,sourcefilepnt
 beq	daber1
 move.l	d0,d1
 moveq	#0,d2
 moveq	#1,d3
 jsr	-66(a6)
 move.l	sourcefilepnt,d1
 moveq	#0,d2
 moveq	#-1,d3
 jsr	-66(a6)
 move.l	d0,filememlen
 move.l	4,a6
 moveq	#1,d1
 jsr	-198(a6)
 move.l	d0,filemem
 beq	daber2
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 move.l	filemem,d2
 move.l	filememlen,d3
 jsr	-42(a6)
 cmp.l	filememlen,d0
 bne	daber3
 move.l	filemem,a0
 cmp.b	#$f4,(a0)
 bne	daber4
 add.l	#1,a0
 move.l	a0,a1
 move.b	#$f5,-1(a0)
 move.l	filememlen,d0
 sub.l	#1,d0
 move.l	codbase,a6
 jsr	-54(a6)
 move.l	sourcefilepnt,d1
 move.l	dosbase,a6
 jsr	-36(a6)
 move.l	#destpfad,d1
 move.l	#1006,d2
 jsr	-30(a6)
 move.l	d0,destfilepnt
 beq	daber5 
 move.l	d0,d1
 move.l	filemem,d2
 move.l	filememlen,d3
 jsr	-48(a6)
 cmp.l	filememlen,d0
 bne	daber6
 move.l	destfilepnt,d1
 jsr	-36(a6)
 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
 lea	abg,a0
 bsr	msgtext
 bra	dabe


daber6:
 lea	wed,a0
 bsr	msgtext
 move.l	dosbase,a6
 move.l	destfilepnt,d1
 jsr	-36(a6)
 move.l	#destpfad,d1
 jsr	-72(a6)
 bra	daber55

daber5:
 lea	cantopenfile,a0
 bsr	msgtext
daber55:
 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
 bra	dabe



daber4:
 lea	nabf,a0
 bsr	msgtext
 bra	dabe3

daber3:
 lea	res,a0
 bsr	msgtext
 bra	dabe2
daber2:
 lea	lowmem,a0
 bsr	msgtext
 bra	dabe1
daber1:
 lea	cantopenfile,a0
 bsr	msgtext
 bra	dabe

dabe5:
 move.l	dosbase,a6
 move.l	destfilepnt,d1
 jsr	-36(a6)
dabe4:
dabe3:
dabe2:
 move.l	4,a6
 move.l	filemem,a1
 move.l	filememlen,d0
 jsr	-210(a6)
dabe1:
 move.l	dosbase,a6
 move.l	sourcefilepnt,d1
 jsr	-36(a6)
dabe:
 bra	main

writecodinfo:
 move.l	infoptr,a0
 move.b	14(a0),d7
 move.b	#0,14(a0)
 move.b	(a0),aktuellekennung
 add.l	#6,a0
 move.l	#120,d0
 moveq	#58,d1
 add.l	dy,d1
 bsr	text
 move.l	infoptr,a0
 move.b	d7,14(a0)
 rts


msgtext:
 movem.l d0-d7/a0-a6,-(sp)
 move.l	a0,a4
 lea	leer,a0
 bsr	msstx
 move.l	a4,a0
 bsr	msstx
 movem.l (sp)+,d0-d7/a0-a6
 rts

msstx
 move.l	a0,a1
 moveq	#-1,d1
msgtextlp1:
 add.l	#1,d1
 tst.b	(a1)+
 bne.s	msgtextlp1
 move.l	#80,d0
 sub.l	d1,d0	
 lsl.l	#2,d0
 move.l	#72,d1
 add.l	dy,d1
 bsr	text
 rts

text:
 movem.l d0-d7/a0-a6,-(sp)
 move.l	a0,a4
 move.l	rp(pc),a1
 move.l	gfxbase(pc),a6
 jsr	-240(a6)
 moveq	#1,d0
 jsr	-342(a6)
 move.l	a4,a0
 moveq	#0,d0
 moveq	#0,d1
textcountlp:
 move.b	(a0)+,d1
 tst.b	d1
 beq	textcountw1
 add.l	#1,d0
 bra	textcountlp
textcountw1:
 move.l	rp(pc),a1
 move.l	a4,a0
 jsr	-60(a6)
 movem.l (sp)+,d0-d7/a0-a6
 rts

infohlen	dc.l	0
filememlen	dc.l	0
filemem		dc.l	0
sourcefilepnt	dc.l	0
txt	dc.b	"hallo",0
aktuellekennung	dc.b	0
nabf		dc.b	"No protected AmigaBasicfile",0
zuhohevers	dc.b	"Leider eine zu hohe Version!",0
falsch		dc.b	"Something is wrong(I don't know what...)",0
cantopenfile	dc.b	"I am not able to open this file",0
lowmem		dc.b	"Not enough memory for operation",0
dosreader	dc.b	"Failed in reading the file",0
verszuhoch	dc.b	"Version to high(can't decode it)",0
datendecodok	dc.b	"Data decoded, everything is all right:-)",0
datencodok	dc.b	"Data coded, everything all right...",0
cantopendfile	dc.b	"Can't open dest-file",0
doswer		dc.b	"Can't write the file",0
keincodw	dc.b	"First you must define a CODEWORD!!",0
slmm		dc.b	"Not enough memory, trying to start lowmemmode",0
sadmbd		dc.b	"In this mode srcname mustn't be destname!!!",0
nmdigpdm1	dc.b	"Even not enough memory for lowmemorymode:-(",0
codf		dc.b	"Can't open destfile",0
res		dc.b	"Readerror (source-file)",0
wed		dc.b	"Writeerror (destination-file)",0
ksmf2		dc.b	"Couldn't allocate memory",0
abg		dc.b	"AmigaBasic-fileprotection removed",0
ones		dc.b	"Operation not entirely successful!",0
leer		dc.b	"                                              ",0

