
szoveg	segment	use16
assume	cs:szoveg,ds:adat

;------------------------------------------------------------------------------
bont		proc	far			;	DS:SI-ben lev“ CX h.
		and	xown,239
		mov	bp,cx			;	sz”veget szavakra
		ncall	hulla			;	bontva hely‚re teszi.
		or	cx,cx			;	(MONDMUT/MMAXMUT-ba!)
		sjnz	bobb
		njmp	reww
nbebb:		njmp	bebb
nzaww:		njmp	zaww
ncaww:		njmp	caww
nieww:		njmp	ieww
nelvv:		njmp	elvv
bobb:		lodsb
		push	ds
		or	al,al
		pop	es
		sjz	nbebb
		cmp	al,111
		sjae	nbebb
		cmp	al,107
		sje	nbebb
		cmp	al,85
		sje	nbebb
		cmp	al,90
		sje	nzaww
		cmp	al,91
		sje	ncaww
		cmp	al,99
		sje	nieww
		cmp	al,89
		sje	nieww
		sja	nelvv
		cmp	al,81
		sjb	mekk
		cmp	al,84
		sjb	nbebb
mekk:		push	si
		dec	si
		cmp	bp,126
		mov	cx,bp
		sjbe	mikk
		mov	cx,126
mikk:		cmp	egyhossz,0
		mov	di,offset szocska
		sjne	makka
		push	wr own
		ncall	encurit
		mov	egykezd,si
		pop	wr own
makka:		lodsb
		or	al,al
		sjz	mekka
		cmp	al,85
		sje	mekka
		cmp	al,89
		sjae	mekka
		cmp	al,36
		sjb	acka
		cmp	al,70
		sja	acka
		sub	al,35
acka:		stosb
		loop	makka
mekka:		sub	di,offset szocska
		cmp	egyhossz,0
		mov	szocskho,di
		sjne	mukka
		mov	egyhossz,di
mukka:		push	di
mikka:		push	bp
		call	ertelm
		mov	di,bp
		pop	bp
		sjnc	mokka
		or	xown,16
		dec	szocskho
		sjnz	mikka
		pop	cx
		mov	ax,-19
		pop	si
		ncall	ecur
		dec	si
xlebb:		inc	bp
		ncall	szeww
xclebb:		call	encomm
xbebb:		and	xown,239
		dec	bp
		sjz	beww
		sjs	beww
		njmp	bobb
beww:		ncall	encurit
reww:		ret
zaww:		mov	al,107
		ncall	mekker
bebb:		ncall	encurit
		sjmp	xbebb
caww:		mov	al,85
		mov	bx,-17
		sjmp	keww
ieww:		mov	al,99
		mov	bx,-18
keww:		ncall	mekker
		sub	cx,1
		xchg	ax,bx
		sja	clebb
		sjmp	bebb
elvv:		cmp	al,105
		mov	bx,-20
		sje	okka
		dec	bx
		cmp	al,106
		sjb	rokka
		cmp	al,110
		sjb	okka
rokka:		cmp	al,101
		sje	okka
		dec	bx
		cmp	al,93
		sje	esand
		cmp	al,95
		sjne	okka
esand:		dec	bx
okka:		xchg	ax,bx
clebb:		ncall	encurit
		sjmp	xclebb
mokka:		cmp	ax,-16
		pop	bx
		mov	cx,szocskho
		sjb	zlebb
		cmp	al,-8
		mov	bx,aktum
		mov	dx,aktum+2
		sjae	zlebb
		xor	dx,dx
zlebb:		pop	si
		inc	bp
		dec	si
		ncall	szeww
		call	encomm
		or	own,1
		sjmp	xbebb
bont		endp

mekker:		dec	bp
		mov	di,si
		mov	cx,bp
		sjs	meww
		sjz	meww
		repne	scasb
		sje	ekk
		dec	cx
ekk:		neg	cx
		mov	di,si
		add	cx,bp
		inc	bp
szeww:		add	si,cx
		sub	bp,cx
		sjae	meww
		xor	bp,bp
meww:		ret

encurit:	;cmp	egyhossz,0
		;sje	necur
		push	cx
		push	si
		mov	cx,egymut
		push	es
		mov	si,offset vesa
		push	ds
		sub	cx,si
		pop	es
		sjbe	cecur
		push	di
		mov	di,mondmut
		push	dx
		or	di,di
		mov	dx,mmaxmut
		sjz	dicur
		sub	dx,di
		sjbe	dicur
		cmp	cx,dx
		sja	dicur
		shr	cx,1
		sjnc	picur
		movsb
picur:		rep	movsw
		cmp	di,offset stabl
		mov	mondmut,di
		sjbe	dicur
		mov	aktset,-1
dicur:		pop	dx
		pop	di
cecur:		pop	es
		pop	si
		pop	cx
hulla:		mov	egyhossz,0
		mov	egykezd,0
		mov	maxmut,offset vesa+512+aptuf
ecur:		mov	egymut,offset vesa
necur:		and	own,254
		ret

alany		proc	far
		call	montorl
		mov	ax,-25
		mov	di,			111	;	!!!
		mov	bx,			222	;	!!!
		call	encomm
		call	encurit
alany		endp

mondat		proc	far			;	A mondat be¡r sa a
		push	di			;	parancspufferba.
		mov	di,pamut		;	(MONDMUT-b¢l!)
		push	si
		mov	si,offset vesa+512+aptuf
		push	cx
		mov	cx,mondmut
		push	dx
		sub	cx,si
		mov	dx,utmret
		push	es
		sjbe	nemmon
		sub	dx,di
		mov	es,parpuf
		sjae	lemmon
		xor	dx,dx
lemmon:		cmp	cx,dx
		sjbe	emmon
		push	ax
		sub	dx,cx
		push	bx
		push	cx
		neg	dx
		push	bp
		xor	di,di
lennon:		push	dx
		call	readcom
		pop	dx
		cmp	di,dx
		jcxz	ennon
		sjb	lennon
ennon:		pop	bp
		pop	cx
		pop	bx
		pop	ax
		push	si
		mov	si,di
		push	cx
		mov	cx,pamut
		xor	di,di
		sub	cx,si
		push	ds
		sjbe	amut
		push	es
		shr	cx,1
		pop	ds
		sjnc	mamut
		movsb
mamut:		rep	movsw
amut:		pop	ds
		pop	cx
		pop	si
emmon:		shr	cx,1
		sjnc	mammon
		movsb
mammon:		rep	movsw
		mov	pamut,di
nemmon:		pop	es
		pop	dx
		pop	cx
		pop	si
		pop	di
mondat		endp

montorl		proc	far
		ncall	hulla
montorl		endp

ontorl		proc	far
		mov	mondmut,offset vesa+512+aptuf
		mov	mmaxmut,offset stabl+1024
		ret
ontorl		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
encomm		proc	far
		push	ax
		cmp	ax,129
		push	cx
		sja	vavagy
		or	al,al
		sjns	wavagy
		mov	ax,-24
vavagy:		cmp	ax,151
		sja	wavagy
		mov	ax,-23
wavagy:		push	bp
		cmp	ax,-16
		push	di
		sjae	szuu
		cmp	ax,-25
		sjb	szuu
		pushf
		ncall	necur
		popf
		sjbe	szuu
		xor	di,di
		sjmp	mamoo
szuu:		or	di,di
		sjnz	mamoo
		or	ax,ax
		sjz	mamoo
		cmp	ah,60
		sjae	naboo
		or	ah,64
naboo:		cmp	ax,-16
		sjb	hahoo
		sub	al,31
hahoo:		cmp	ah,255
		sjne	mamoo
		test	own,1
		mov	ah,127
		sjz	mamoo
		mov	ah,253
mamoo:		test	own,1
		mov	bp,di
		push	es
		sjz	papoo
		or	ah,128
		cmp	ah,255
		sjne	papoo
		dec	ah
papoo:		mov	di,egymut
		push	si
		mov	si,maxmut
		push	ds
		sub	si,di
		pop	es
		sjbe	semcom
		dec	si
		dec	si
		stosw
		sjs	semcom
		cmp	ah,254
		sja	aroo
		sjb	magoo
		inc	ah
magoo:		cmp	ah,253
		sja	aroo
		sjb	tatoo
		mov	ah,127
tatoo:		and	ah,127
aroo:		or	ax,ax
		sjz	earu
		sjs	negu
		cmp	ah,127
		sjb	daroo
		mov	ah,255
		sjmp	negu
daroo:		cmp	ah,64
		sjae	saru
negu:		cmp	ax,-16
		sjae	ragu
		cmp	ax,-32
		sja	lyehu
		cmp	ax,-47
		sjae	gagyi
lyehu:		cmp	ax,-25
		sjbe	ragu
		cmp	ax,-20
earu:		sjbe	daru
		dec	si
		xchg	ax,cx
		dec	si
		stosw
		xchg	ax,cx
		sjs	nemcom
		cmp	ax,-19
		xchg	ax,si
		pop	si
		push	si
		sjne	eerte
		cmp	egyhossz,0
		sje	serte
		mov	si,egykezd
		mov	cx,egyhossz
		sjmp	herte
saru:		sjmp	daru
semcom:		sjmp	nemcom
serte:		inc	si
eerte:		sub	si,cx
		dec	si
herte:		ncall	becsom
		mov	es:[di-2],cx
		sjae	zente
		or	br es:[di-1],128
zente:		cmp	ax,cx
		jcxz	nemcom
		sjb	nemcom
		shr	cx,1
		sjnc	degu
		movsb
degu:		rep	movsw
		sjmp	daru
gagyi:		add	al,31
		xchg	ax,bp
		sjmp	gagyu
ragu:		dec	si
		xchg	ax,bp
		dec	si
		stosw
		sjs	nemcom
		cmp	bp,-25
		sje	gagyu
		cmp	bp,-17
		sjbe	daru
gagyu:		dec	si
		mov	ax,bx
		dec	si
		stosw
		sjs	nemcom
		cmp	bp,-9
		sjbe	daru
		dec	si
		mov	ax,dx
		dec	si
		stosw
		sjs	nemcom
daru:		mov	egymut,di
nemcom:		pop	si
		pop	es
		pop	di
		pop	bp
		pop	cx
		pop	ax
		ret
encomm		endp

readcom		proc	far		;	Parancspuffer olvas sa. Vissza:
		push	di		;	AX = sz¢sorsz m,
		ncall	necur		;	BP = ragoz s,
		xor	cx,cx		;	CX = az eg‚sz bejegyz‚s hossza.
		xor	ax,ax		;	+ sz mokn l: DX:BX = ‚rt‚k.
		push	es		;	JCXZ : nincs adat!!!
		cmp	di,pamut
		mov	es,parpuf
		mov	bp,cx
		sjae	nvaksa
		mov	ax,es:[di]
		mov	cx,es:[di+2]
		or	ax,ax
		mov	bp,cx
		sjz	serd
		sjns	ser0
		cmp	ah,255
		sje	sero
		cmp	ah,254
		sjb	ser1
		inc	ah
		sjmp	serw
ser1:		cmp	ah,253
		sjb	ser2
		mov	ah,127
ser2:		and	ah,127
serw:		or	own,1
ser0:		cmp	ah,127
		sja	saska
		sjb	serk
		mov	ah,255
		sjmp	serd
nvaksa:		sjmp	vaksa
serk:		cmp	ah,64
		sjb	sarax
		and	ah,63
serd:		xor	bp,bp
		cmp	ax,-17
		sja	serox
		cmp	ax,-19
		sjae	sero
serox:		mov	cx,2
sero:		or	ax,ax
		sjns	sarax
saska:		cmp	ax,-47
		sjb	sarax
		cmp	ax,-32
		sja	sarax
		add	al,31
		xor	bp,bp
		mov	cx,2
sarax:		cmp	ax,-17
		sja	jaska
		cmp	ax,-19
		sjb	jaska
		add	cx,4
aksa:		xor	bp,bp
		sjmp	paksa
jaska:		cmp	bp,cx
		mov	cx,4
		sje	aska
		dec	cx
		dec	cx
aska:		or	ax,ax
		sjns	paksa
		cmp	ax,-25
		sje	paksa
		sja	naksa
maksa:		mov	cx,2
		sjmp	aksa
naksa:		cmp	ax,-20
		sjbe	maksa
paksa:		add	di,cx
		cmp	ax,-25
		sje	papsa
		cmp	ax,-16
		sjb	vaksa
papsa:		inc	cx
		xor	dx,dx
		inc	cx
		cmp	ax,-8
		mov	bx,es:[di]
		sjb	vaksa
		inc	cx
		mov	dx,es:[di+2]
		inc	cx
vaksa:		cmp	ax,-16
		pop	es
		sjae	taksa
		xor	dx,dx
		cmp	ax,-25
		sje	taksa
		xor	bx,bx
taksa:		or	cx,cx
		pop	di
		sjs	saksa
		add	di,cx
		ret
saksa:		push	cx
		and	ch,127
		add	di,cx
		pop	cx
		ret
readcom		endp

string		proc	far			;	-17...-19 eset‚n:
		or	cx,cx			;	DS:SI lesz a kibontott
		pushf				;	sz”veg c¡me, ‚s CX a
		and	ch,127			;	hossza. (READCOM ut n!)
		sub	cx,4			;	JCXZ: hiba!!!
		sjb	nestr
		sub	di,cx
		sjb	nestr
		popf
		mov	si,di
		push	ds
		mov	di,offset stabl-256
		mov	ds,parpuf
		pop	es
		sjns	estr
		ncall	kicsom
xwstr:		push	es
		or	ah,ah
		xchg	ax,cx
		pop	ds
		sjz	xestr
		mov	aktset,-1
		call	ontorl
xestr:		ret
estr:		mov	ax,cx
		shr	cx,1
		push	di
		sjnc	xstr
		movsb
xstr:		rep	movsw
		pop	si
		sjmp	xwstr
nestr:		pop	ax
		xor	cx,cx
		ret
string		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
ertelm		proc	far		;	A "szocska"-ban lev“ sz¢
		xor	ax,ax
		mov	di,szocskho	;	ki‚rtelmez‚se.
		and	conan,127
		mov	argozas,ax
		cmp	di,126		;	AX = sz¢sorsz m,
		mov	ragozas,ax	;	BP = ragoz s.
		mov	rugozas,ax
		sjbe	derrick
		mov	di,126
derrick:	cmp	al,angol
		mov	arrgh,-1
		push	di
		mov	rrrag,al
		sjne	memma
werrick:	mov	wr szocska[di],128
merrick:	or	di,di
		mov	al,szocska[di-1]
		sjz	nonno
		or	al,al
		sjz	errick
		cmp	al,81
		sjb	eichner
		cmp	al,89
		sjae	errick
		cmp	al,84
		sje	eichner
		cmp	al,86
		sjae	eichner
errick:		dec	di
		sjmp	merrick
memma:		;njmp	dikker
		njmp	dykker
eichner:	test	xown,16
		sjnz	zvelp
		cmp	di,2
		sjb	zvelp
		cmp	wr szocska[di-2],81+9*256
		sje	kerdo
		cmp	wr szocska[di-2],81+10*256
		sjne	zvelp
kerdo:		dec	di
		or	br argozas+1,64
		dec	di
		sjnz	eichner
nonno:		njmp	conno
zvelp:		mov	si,di
cvelp:		dec	si
		sjz	bekker
		cmp	szocska[si],84
		sjne	cvelp
		inc	si
		mov	cx,di
		sub	cx,si
bekker:		sjbe	cekker
		push	ds
		xor	bx,bx
		mov	dx,2
		pop	es
		mov	brrag,bl
		push	di
kwelp:		dec	dx
		mov	di,offset fnraglist
		mov	bp,offset fnragkod
		sjs	dwekker
		sjnz	quelp
		inc	brrag
		mov	di,offset igraglist
		mov	bp,offset igragkod
quelp:		push	di
		xor	ax,ax
		push	si
		add	si,offset szocska
		push	cx
		repe	cmpsb
		pop	cx
		pop	si
		sjne	mrick
		scasb
		pop	di
		sjne	drick
		mov	di,bp
		cmp	bh,brrag
		mov	al,[di][bx]
		mov	di,si
		sje	fonev

		sjmp	brick
dwekker:	sjmp	dekker
fonev:		cmp	bl,24
		sjb	krick
		cmp	bl,55
		sjae	krick
		cmp	bl,39
		xchg	al,ah
		sjb	trick
		cmp	bl,41
		sjb	brick
		and	ah,31
		and	br argozas+1,248
		or	ah,8
		sjmp	brick
trick:		and	ah,15
		shr	ax,1
		and	argozas,0f07fh
		sjmp	brick
cekker:		njmp	cvekker
krick:		and	br argozas,192
		and	al,63
brick:		mov	arrgh,bl
		pop	bp
		or	argozas,ax
		mov	al,brrag
		dec	di
		mov	rrrag,al
		njmp	werrick
mrick:		pop	di
drick:		push	cx
		mov	cl,16
		inc	bx
		repne	scasb
		cmp	al,[di]
		pop	cx
		sjne	quelp
		njmp	kwelp
dekker:		cmp	arrgh,-1
		pop	di
		sjne	cvekker

		push	di
		mov	dx,cx
		ncall	hekker
		push	si
		mov	di,offset szocska
		push	szocskho
		add	si,di
		mov	szocskho,cx
		rep	movsb
		mov	wr [di],128
		ncall	elso_szo
		sjc	vekker
vertlp:		cmp	cx,szocskho
		sjne	vertl
		shr	cx,1
		sjnc	verex
		cmpsb
		sjne	vertl
verex:		repe	cmpsw
		sjne	vertl
		cmp	ax,280
		sjae	vekker
		sub	ax,178
		sjb	vekker
		cmp	al,15
		mov	bx,ax
		mov	brrag,ah
		mov	al,codsyn1[bx]
		sjb	xrick
		xchg	ax,bx
		sub	al,13
		cmp	al,60
		sjb	xrick
		xchg	ax,bx
		mov	al,codsyn2[bx-60]
xrick:		pop	szocskho
		ncall	xekker
		pop	di
		njmp	krick
onno:		njmp	conno
vertl:		ncall	uj_szo
		sjnc	vertlp
vekker:		pop	szocskho
		pop	si
		ncall	xekker
dikker:		pop	di
dykker:

cvekker:	or	di,di
		mov	szocskho,di
		sjz	onno
		mov	wr szocska[di],128
		ncall	elso_szo
		sjc	nertl

;		sjnc	xertlp
;mertl:		njmp	nertl
;nartve:	njmp	ertve
;nurtl:		njmp	urtl

xertlp:		ncall	xertel
		cmp	cx,szocskho
		sjne	xertl
		shr	cx,1
		sjnc	xerex
		cmpsb
		sjne	xertl
xerex:		repe	cmpsw
		sje	ertve
xertl:		ncall	uj_szo
		sjnc	xertlp

;		ncall	elso_szo
;nertlp:	sjc	mertl
;		cmp	cx,szocskho
;		sja	nurtl
;ertlp:		ncall	xertel
;		mov	al,szbyt
;		mov	ah,angol
;		test	al,16
;		sjnz	nurtl
;		or	ah,ah
;		mov	rugszaml,offset fnragtabl
;		mov	rugszveg,offset fnragtabv
;		mov	bx,offset fnorltabl
;		mov	raggveg,offset fnorltabv
;		sjz	magy
;		mov	rugszaml,offset fnaagtabl
;		mov	rugszveg,offset fnaagtabv
;		mov	bx,offset fnarltabl
;		mov	raggveg,offset fnarltabv
;magy:		test	al,12
;		sjnz	bartlp
;		or	ah,ah
;		mov	rugszaml,offset igragtabl
;		mov	rugszveg,offset igragtabv
;		mov	bx,offset igorltabl
;		mov	raggveg,offset igorltabv
;		sjz	bartlp
;		mov	rugszaml,offset igaagtabl
;		mov	rugszveg,offset igaagtabv
;		mov	bx,offset igarltabl
;		mov	raggveg,offset igarltabv
;bartlp:	mov	raggala,bx
;		mov	raggele,bx
;artlp:		cmp	cx,szocskho
;		sjne	nertck
;		shr	cx,1
;		sjnc	erex
;		cmpsb
;		sjne	nertck
;erex:		repe	cmpsw
;artve:		sje	ertve
;nertck:	mov	ax,rugszaml
;		mov	dx,aktum+2
;		cmp	ax,rugszveg
;		mov	bx,raggala
;		xchg	ax,si
;		sjae	urtl
;		add	raggala,2
;		cmp	bx,raggveg
;		lodsw
;		sjb	raggg
;		mov	bx,raggele
;		mov	rugszaml,si
;		mov	raggala,bx
;raggg:		or	ax,[bx]
;		mov	bx,aktum
;		mov	rugozas,ax
;		xchg	ax,bp
;		mov	ax,aktszo
;		sjz	nertck
;		sjs	nertck
;		call	wordrag
;		sjnc	artlp
;urtl:		xor	ax,ax
;		test	conan,128
;		mov	rugozas,ax
;		sjnz	conno
;		ncall	uj_szo
;		sjc	nertl
;		njmp	ertlp
 
		sjmp	nertl

nertlp:		sjc	nertl
		ncall	xertel
		cmp	cx,szocskho
		sjne	nertl
		shr	cx,1
		sjnc	herex
		cmpsb
		sjne	nertl
herex:		repe	cmpsw
		sje	ertve

nertl:		test	conan,128
		sjz	szamszo
conno:		xor	ax,ax
		xor	bp,bp
		stc
		sjmp	bertl
ertve:		mov	ax,ragozas
		mov	bp,aktszo
		or	ax,rugozas
		;clc
bertl:		pop	szocskho
		mov	ragozas,ax
		xchg	ax,bp
		ret

szamszo:	mov	si,offset szocska
		mov	cx,szocskho
		mov	di,si
		jcxz	conno
szomlap:	lodsb
		or	al,al
		sjz	szallap
		cmp	al,71
		mov	al,[si]
		sjne	szallok
		or	al,al
		sjz	szallap
		cmp	al,71
		sjb	szallok
		cmp	al,81
		sjae	szallok
szallap:	loop	szomlap
		inc	cx
szallok:	dec	si
		cmp	si,di
		mov	bx,cx
		sje	szammx
		inc	cx
		push	di
		mov	szocskho,bx
		rep	movsb
		mov	cx,bx
		pop	si
szammx:		dec	bx
		mov	di,si
		mov	bp,-3
baxalp:		cmp	br [bx][si],71
		sjb	baxo
		cmp	br [bx][si],81
		sja	baxo
		sje	zarszo
arszo:		inc	bx
		dec	bp
		push	bx
		dec	bp
		sjmp	buxx
xonno:		sjmp	conno
zarszo:		push	bx
		inc	bx
buxx:		cmp	br [bx][si],11		;	"-adik"
		sja	baxx
		cmp	br [bx][si],7
		sje	barax
		inc	bx
		mov	bp,-6
baxx:		cmp	br [bx][si],17		;	"-dik"
		sjne	barax
		inc	bx
		dec	bp
barax:		cmp	wr [bx][si],7+256*22	;	"-ik"
		pop	bx
		sje	barack
		mov	bp,-1
barack:		mov	cx,bx
		sjmp	baxakk
baxo:		dec	bx
		sjns	baxalp
baxakk:		jcxz	xonno
		push	bp
		call	numstring
		pop	bx
		sjc	xonno
		or	conan,128
		or	dx,dx
		xchg	ax,bx
		sjnz	dxers
		sub	al,8
dxers:		ncall	nyers
		mov	di,offset szocska
		njmp	nertlp
ertelm		endp

xekker:		xor	dx,dx
hekker:		push	si
		or	dx,dx
		push	cx
		mov	si,offset szocska
		mov	di,offset vegszo
		mov	cx,64
		sjnz	hove
		xchg	si,di
hove:		rep	movsw
		pop	cx
		pop	si
		ret

xertel:		test	szbyt,16
		mov	ax,argozas
		sjnz	rtlan
		cmp	arrgh,-1
		sje	rtlan
		cmp	rrrag,0
		sje	nvnvn
		test	szbyt,12
		sjz	xerjo
		sjmp	rtlan
nvnvn:		test	szbyt,12
		sjnz	xerjo
rtlan:		and	ax,8192+16384
xerjo:		mov	ragozas,ax
		ret

fertelm		proc	far
		call	montorl

		;push	bx
		;push	cx
		;push	dx
		;push	si
		;push	di
		;push	es

		push	ax
		mov	si,offset szocska
		push	bp
		mov	di,offset stabl+1024-128
		push	si
		mov	cx,szocskho
		push	di
		mov	aktset,-1
		ncall	freud
		push	cx
		call	bont
		pop	cx
		pop	si
		mov	szocskho,cx
		pop	di
		ncall	freud
		push	pamut
		mov	ax,mondmut
		mov	di,offset vesa+512+aptuf
		push	parpuf
		mov	pamut,ax
		mov	parpuf,ds
frenet:		call	readcom
		clc
		jcxz	nofret
		cmp	ax,-19
		stc
		sjne	frenet
nofret:		pop	parpuf
		pop	pamut
		pop	bp
		pop	ax

		;pop	es
		;pop	di
		;pop	si
		;pop	dx
		;pop	cx
		;pop	bx

		pushf
		call	montorl
		popf
		ret
fertelm		endp

freud:		push	ds
		pop	es
		push	cx
		shr	cx,1
		push	di
		sjnc	fert
		movsb
fert:		inc	cx
		rep	movsw
		pop	si
		pop	cx
		ret
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
proba		proc	far
		mov	bl,ablak
		and	bx,3
		mov	al,pufabl[bx]
		add	bx,bx
		and	al,3
		mov	si,dszcim[bx]
		mov	puffer,al
		mov	cx,dhossz[bx]

		push	ds
		push	es
		pushad
		push	ds
		mov	szocskho,cx
		mov	di,offset szocska
		pop	es
		rep	movsb
		call	ertelm
		sjnc	westel
		njmp	kertel
westel:		pusha
		ncall	nyers
		popa
		cmp	bp,64
		mov	pixel,0
		mov	spixl,0
		sjb	felsh
		test	szbyt,28
		sjnz	aladd
		test	bp,0000111100000000b
		sjz	felsh
aladd:		mov	pixel,bp
		sjmp	alsh
felsh:		mov	spixl,bp
alsh:		push	ax
		push	aktum
		push	aktum+2
		push	ax
		xchg	ax,bx
		push	bp
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		call	pont
		pop	ax
		ncall	nyers
		test	szbyt,28
		mov	si,offset fnorltabl
		sjnz	nikl
		mov	si,offset igorltabl
nikl:		cmp	si,offset fnorltabv
		pop	dx
		pop	bx
		pop	bp
		lodsw
		push	bp
		push	bx
		push	dx
		pushf
		or	ax,pixel
		popf
		xchg	ax,bp
		sje	nertel
		cmp	si,offset igorltabv
		sje	nertel
		push	si
		call	wordwrt
		mov	al,102
		call	wchar
		pop	si
		sjmp	nikl
nertel:		ncall	nyers
		call	wstring
		call	pont
		test	szbyt,28
		mov	si,offset fnragtabl
		sjnz	mikl
		mov	si,offset igragtabl
mikl:		cmp	si,offset fnragtabv
		pop	dx
		pop	bx
		pop	bp
		lodsw
		pushf
		or	ax,spixl
		popf
		xchg	ax,bp
		sje	mertel
		cmp	si,offset igragtabv
		sje	mertel
		push	ax
		push	bx
		push	dx
		push	si
		call	wordwrt
		mov	al,102
		call	wchar
		pop	si
		sjmp	mikl
mertel:		ncall	nyers
		call	wstring
		call	pont
kertel:		popad
		pop	es
		pop	ds
		ret

		push	es
		pushad

		;ncall	vappend
		;ncall	remove

;		pushad
;		call	neword
;		popad

;		call	neword
;		push	ax
;		xchg	ax,bx
;		mov	ax,-9
;		ncall	nyers
;		call	wstring
;		call	pont
;		pop	ax
;		cmp	ax,11
;		sje	dopp
;		mov	ax,11
;		call	clrword

dopp:		mov	cx,libnum
		xor	si,si
		jcxz	donp
dolp:		mov	es,ldxpuf
		push	cx
		lodsb	es:[si]
		xor	ah,ah
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		pop	cx
		loop	dolp
donp:		call	pont

		mov	cx,lpmret1
		xor	si,si
		jcxz	fonp
folp:		mov	es,libpuf1
		push	cx
		lodsw	es:[si]
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		pop	cx
		loop	folp
fonp:		mov	al,108
		call	wchar
		mov	al,109
		call	wchar

		mov	cx,lpmret2
		xor	si,si
		jcxz	conp
colp:		mov	es,libpuf2
		push	cx
		lodsw	es:[si]
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		pop	cx
		loop	colp
conp:		call	pont

;		ncall	ananame
;		shr	cx,1
;		sjz	wex
;welp:		push	cx
;		lodsw
;		push	si
;		xchg	ax,bx
;		mov	ax,-9
;		ncall	nyers
;		call	wstring
;		xor	al,al
;		call	wchar
;		pop	si
;		pop	cx
;		loop	welp
;wex:		call	pont

		popad
		pop	es

		mov	pamut,0
		call	alany
		call	bont
		call	pont

		ncall	sentcut
		mov	dx,16
		ncall	wordcut

		pushad
		jcxz	cick
cicp:		push	cx
		lodsw
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		lodsw
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		lodsw
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		lodsw
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		pop	cx
		loop	cicp
cick:		call	pont
		popad

		and	koppany,64
		mov	ax,filepuf
		mov	monte,0
		mov	monte+2,ax
		mov	ax,fmeret
		mov	mommax,ax
		ncall	analyze
		push	dx
		mov	bx,dx
		mov	ax,-9
		ncall	nyers
		call	wstring
		call	pont
		pop	dx
		or	dx,dx
		les	di,dr monte
		sjz	nick
nipp:		push	dx
		mov	ax,es:[di]
		inc	di
		inc	di
		push	di
		push	es

		push	ax
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		mov	al,104
		call	wchar
		pop	ax

		call	showord
		ncall	trilla
		mov	ax,-9
		mov	bx,tulaj
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		mov	ax,-9
		mov	bx,mettol
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		mov	ax,-9
		mov	bx,meddig
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		call	pont

		pop	es
		pop	di
		pop	dx
		dec	dx
		sjnz	nipp
nick:		call	pont

		call	mondat
		xor	di,di
ciklus:		call	readcom
		jcxz	ciklamen
		pushad
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		popad
		cmp	ax,-16
		sjae	zizi
		cmp	ax,-19
		sjae	texas
		cmp	ax,-25
		sja	ciklus
zizi:		pushad
		mov	bx,bp
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		popad
		cmp	ax,-25
		sje	clit
		cmp	ax,-16
		sjb	ciklus
clit:		cmp	ax,-25
		pushad
		sjne	clytt
		mov	ax,-9
clytt:		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		popad
		sjmp	ciklus
texas:		pushad
		push	es
		mov	al,89
		call	wchar
		pop	es
		call	string
		jcxz	texno
		call	wstring
texno:		mov	al,99
		call	wchar
		popad
		njmp	ciklus
ciklamen:	call	pont
		ret

		call	numstring
		mov	cx,8
		xchg	ax,bx
		sjc	nunuw
popo:		push	dx
		push	cx
		neg	cx
		mov	ax,-1
		add	cx,8
		push	bx
		sub	ax,cx
		ncall	nyers
		mov	al,kthang
		call	wstring
		xor	al,al
		call	wchar
		pop	bx
		pop	cx
		pop	dx
		loop	popo
		call	pont

nunuw:		;ret
		mov	ax,gyilkos
		inc	gyilkos
		cmp	ax,128
		sjae	kikiw
		call	wordwrt
		xor	al,al
		call	wchar
		sjmp	nunuw
kikiw:		ret
proba		endp

gyilkos		dw	0

kiirax		proc	far
		pushad
		push	es
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	es
		popad
		ret
kiirax		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
fzip		proc	far
		ncall	zip
		ret
fzip		endp

funzip		proc	far
		ncall	unzip
		ret
funzip		endp

sbelso:		shr	bx,1
		or	bl,128
		sjmp	belso

szovan:		cmp	nagybet,-1
		sje	nanagy
		mov	bx,62
szoros:		cmp	ax,wr ziptab[bx+120]
		sje	sbelso
		sub	bl,2
		sjns	szoros
		cmp	ah,4
		sjae	nenagy
		push	bp
		mov	bp,ax
		mov	bl,6
		sjmp	nelso
nanagy:		stc
nenagy:		adc	ax,ax
		push	bp
		mov	bp,ax
		mov	bl,7
		ncall	beforg
		mov	bx,bp
		mov	cl,10
		shr	bx,cl
nelso:		ncall	beforg
		mov	bx,bp
		mov	cl,5
		shr	bx,cl
		ncall	beforg5
		mov	bx,bp
		pop	bp
		sjmp	elso

zip:		push	si		;	Sz”veg bet”m”r¡t‚se DS:[SI]-b“l
		push	di		;	ES:[DI]-be, CX db. byte-ot.
		push	cx		;	(DS = ADAT!!!)
		mov	bp,cx
		mov	ch,16
		or	bp,bp
		sjz	zilveg
zilp:		lodsb
		or	al,al
		sjz	nemszo
		cmp	al,89
		sjae	nemszo
		ncall	szip
		sjnc	szovan
nemszo:		mov	bx,8
nelp:		cmp	al,ziptab[bx-8]
		sje	szomv
		inc	bl
		sjns	nelp
		mov	bh,al
		mov	bl,5
		ncall	beforg
		mov	bl,bh
		sjmp	zelso5
szomv:		cmp	bl,32
		sjb	elso
belso:		mov	bh,bl
zelso5:		mov	cl,5
		shr	bl,cl
		ncall	beforg5
		mov	bl,bh
elso:		ncall	beforg
ziltov:		dec	bp
		sjnz	zilp
zilveg:		mov	bx,bp
		ncall	beforg
		mov	cl,ch
		shl	dx,cl
		mov	ax,dx
		xchg	al,ah
		stosw
		cmp	ch,8
		sjb	zilw
		dec	di
zilw:		pop	dx
		sjmp	xilw

beforg:		mov	cl,5
beforg5:	sub	ch,cl
		sjb	foforg
		shl	dx,cl
		and	bl,31
		or	dl,bl
		ret
foforg:		add	cl,ch
		sjz	dxforg
		add	bl,bl
		add	bl,bl
		add	bl,bl
forcl:		add	bl,bl
		adc	dx,dx
		dec	cl
		sjnz	forcl
		mov	ax,dx
		xchg	al,ah
		stosw
		mov	cl,ch
forbl:		add	bl,bl
		adc	dx,dx
		inc	cl
		sjnz	forbl
		add	ch,16
		ret
dxforg:		mov	ax,dx
		xchg	al,ah
		stosw
		mov	ch,11
		mov	dl,bl
		ret

unzip:		push	si		;	Sz”veg kit”m”r¡t‚se DS:[SI]-b“l
		push	di		;	ES:[DI]-be, CX db. byte-ot.
		xor	bp,bp
		mov	bx,bp
		mov	cx,bp
		sjmp	unkezd
unzilp:		cmp	bl,8
		sjae	tartab
		mov	cl,5
		cmp	bl,4
		sjae	csomag
		shl	bl,cl
		mov	bh,bl
		ncall	kiforg5
		or	bl,bh
		xor	bh,bh
tartab:		push	ds
		mov	ax,adat
		mov	ds,ax
		mov	al,ziptab[bx-8]
		pop	ds
teltar:		stosb
unkezd:		ncall	kiforg
		sjnz	unzilp
xilw:		pop	si
		mov	cx,di
		pop	di
		sub	cx,si
		ret
csomag:		sje	szavak
		cmp	bl,6
		sje	szo10
		sja	szo15
		ncall	kiforg5
		mov	cl,5
		shl	bl,cl
		mov	bh,bl
		ncall	kiforg5
		or	bl,bh
		xor	bh,bh
		mov	al,bl
		sjmp	teltar
szo15:		ncall	kiforg5
		mov	bp,bx
		mov	cl,5
		shl	bp,cl
		ncall	kiforg5
		or	bp,bx
		mov	cl,5
		shl	bp,cl
		ncall	kiforg5
		or	bp,bx
		mov	ax,bp
		xor	bp,bp
		sjmp	szavam
szo10:		ncall	kiforg5
		or	bp,bx
		mov	cl,5
		shl	bp,cl
		ncall	kiforg5
		or	bp,bx
		mov	ax,bp
		xor	bp,bp
		sjmp	szvamax
szavak:		ncall	kiforg5
		add	bx,bx
		push	ds
		mov	ax,adat
		mov	ds,ax
		mov	ax,wr ziptab[bx+120]
		pop	ds
szvamax:	add	ax,ax
szavam:		push	cx
		push	si
		push	ds
		ncall	sunzip
		pop	ds
		xor	bx,bx
		pop	si
		xor	bp,bp
		pop	cx
		sjmp	unkezd

dkforg:		lodsw
		xchg	al,ah
		mov	dx,ax
		mov	ch,16
kiforg:		mov	cl,5
kiforg5:	sub	ch,cl
		sjb	felforg
kifli:		rol	dx,cl
		mov	bl,dl
		and	bl,31
		ret
felforg:	add	cl,ch
		sjz	dkforg
kurcl:		rol	dx,1
		adc	bl,bl
		dec	cl
		sjnz	kurcl
		lodsw
		xchg	al,ah
		mov	dx,ax
		mov	cl,ch
kurbl:		rol	dx,1
		adc	bl,bl
		inc	cl
		sjnz	kurbl
		add	ch,16
		and	bl,31
		ret
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
igevonz		proc	far		;	AX. ige vonzatait adja vissza.
		xor	si,si		;	VONZ[...] = a vonzatok,
		cmp	ax,vonzat	;	CX = mennyi van (db.),
		push	ds		;	AX = a legels“ vonzat (LODSW!).
		mov	di,offset vonz	;	(JCXZ: nincs vonzat!!!)
		mov	cx,maxvonz
		pop	es
		xchg	ax,si
		push	di
		rep	stosw
		pop	di
		push	di
		sjae	nevvo
		push	ds
		add	si,si
		mov	bp,vonmret
		mov	ds,vnzpuf
		lodsw
		sjz	devvo
		add	ax,ax
		mov	ds,es:vonpuf
		xchg	ax,si
		sjz	devvo
		cmp	si,bp
		mov	ax,targyrag
		sjae	claudex
claude:		cmp	si,bp
		sjae	devvo
		cmp	cl,maxvonz
		lodsw
		sjae	devvo
claudex:	or	ax,ax
		pushf
		inc	cx
		and	ah,127
		popf
		stosw
		sjs	claude
devvo:		pop	ds
nevvo:		pop	si
		lodsw
		ret
igevonz		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
sentcut:	mov	cutwer,offset vesa+512+aptuf
		ret

wordcut:	push	ds			;	Sz¢sorsz m-sorozat
		mov	si,offset szocska	;	sz‚ttagol sa 4 word-”s
		mov	ax,mondmut		;	szavakra:
		pop	es			;	MONDAT-b¢l SZOCSKA-ba.
		mov	di,cutwer		;	+Be: DX: max. h ny sz¢.
		push	si
		inc	dx
		push	pamut
		xor	cx,cx
		push	parpuf
		mov	pamut,ax
		mov	parpuf,ds
		mov	mennyit,cx
kivag:		dec	dx
		push	dx
		sjz	ivag
vivag:		push	cx
		push	si
		call	readcom
		pop	si
		or	cx,cx
		pop	cx
		sjz	ivag
		cmp	ax,-16
		sjae	vahet
		cmp	ax,-18
		sjae	vivag
		cmp	ax,-25
		sje	vivag
		cmp	ch,br mennyit
		sjne	vakar
		cmp	ax,-23
		sje	vivag
		cmp	ax,-24
		sje	vivag
		cmp	ax,127
		sjbe	vakar
		inc	br mennyit
vakar:		or	ax,ax
		sjz	vivag
		sjs	ivag
vahet:		xchg	si,di
		inc	cx
		stosw
		xchg	ax,bp
		mov	cutwer,si
		stosw
		xchg	ax,bx
		cmp	cx,16
		stosw
		xchg	ax,dx
		pop	dx
		stosw
		xchg	si,di
		sjb	kivag
		push	dx
ivag:		pop	dx
		mov	mennyit,cx
		pop	parpuf
		mov	di,cutwer
		pop	pamut
		jcxz	civag
		mov	szocskho,0
civag:		pop	si
		ret

analyze:	push	monte		;	DS:SI/CX sz¢sorsz m-sorozat
		xor	di,di		;	azonos¡t sa, n‚vt rban keresve.
		mov	uccso,-1	;	Vissza:
omana:		push	cx		;	 MONTE - egyez“ nevek sorozata,
		mov	bp,lpmret1	;	 DX - h ny darabot tal lt.
		push	si		;	Ha sz mn‚v (ha STC !!!):
		lodsw			;	 DX = 0,
		jcxz	semana2		;	 BX:AX = a sz m‚rt‚k.
		cmp	ax,-16
		mov	cx,bp
		sjb	kihi
		mov	ah,63
kihi:		or	ax,ax
		sjz	semana2
		cmp	ah,64
		sjae	semana2
		cmp	di,bp
		mov	es,libpuf1
		sjae	onana
		sub	cx,di
		add	di,di
		repne	scasw
		sjne	neman
		shr	di,1
		sjmp	mana
neman:		xor	di,di
		sjmp	omnia
semana2:	njmp	semana
onana:		sub	di,bp
omnia:		mov	cx,lpmret2
		cmp	di,cx
		mov	es,libpuf2
		sjae	semana2
		sub	cx,di
		add	di,di
		repne	scasw
		sjne	semana2
		shr	di,1
		add	di,bp
mana:		push	di
		mov	cx,libnum
		xor	ax,ax
		dec	di
		push	ds
		mov	bx,cx
		xor	si,si
		mov	ds,ldxpuf
		jcxz	danal
analp:		cmp	ax,di
		mov	dx,ax
		lodsb
		sje	anal
		and	ax,31
		add	ax,dx
		cmp	ax,di
		sja	anal
		loop	analp
		sjmp	danal
anal:		sub	bx,cx
manal:		mov	al,[bx]
		test	al,31
		sjnz	danal
		inc	bx
		loop	manal
danal:		pop	ds
		jcxz	nemana2
		cmp	dx,uccso
		mov	cl,al
		sje	nemana2
		and	cx,31
		mov	uccso,dx
		sjz	nemana2
		test	al,64
		sjz	esszi
		or	al,128
		dec	cx
		sjz	nemana2
esszi:		or	al,al
		sjns	nesszi
		dec	cx
		sjz	nemana2
nesszi:		push	ax
		cmp	dx,bp
		mov	es,libpuf1
		push	bx
		sjb	inana
		sub	dx,bp
		mov	es,libpuf2
inana:		push	ds
		mov	si,dx
		push	es
		mov	di,offset vegszo
		pop	ds
		add	si,si
		pop	es
brolf:		xor	bx,bx
		xor	dx,dx
		push	di
		xor	bp,bp
		xor	di,di
rolf:		xor	ax,ax
		jcxz	gwolf
		lodsw
		dec	cx
		cmp	ah,63
		sjb	olf
		mov	ah,255
		sja	rolf
olf:		push	ax
		xor	di,di
golf:		jcxz	wolf
		lodsw
		dec	cx
		or	ax,ax
		sjns	oolf
		cmp	ax,32768
		sjne	ooolf
		jcxz	wolf
		inc	si
		dec	cx
		inc	si
ooolf:		and	ax,8191
		sjz	golf
		xchg	ax,bp
		sjmp	golf
olph:		dec	si
		inc	cx
		dec	si
		sjmp	wolf
nemana2:	njmp	nemana
oolf:		cmp	ah,64
		sjb	olph
		push	bp
		cmp	di,3
		push	di
		sjae	poci
		push	cx
		and	ah,63
		xor	bp,bp
pox1:		dec	di
		mov	cl,14
		sjs	poxox
pox2:		add	ax,ax
		rcl	bp,1
		loop	pox2
		sjmp	pox1
poxox:		or	dx,bp
		pop	cx
		or	bx,ax
poci:		pop	di
		pop	bp
		jcxz	wolf
		lodsw
		inc	di
		dec	cx
		sjmp	oolf
wolf:		pop	ax
gwolf:		or	ax,ax
		pop	di
		sjz	fasz
		stosw
		xchg	ax,bp
		stosw
		xchg	ax,bx
		stosw
		xchg	ax,dx
		stosw
fasz:		cmp	di,offset vegszo+128
		jcxz	holf
		sjb	brolf
holf:		pop	bx
		pop	bp
		mov	cx,di
		pop	ax
		pop	si
		mov	di,offset vegszo
		pop	dx
		push	es
		sub	cx,di
		pop	ds
		push	dx
		push	si
		push	ax
		sjbe	nemana
		shr	cx,1
		shr	cx,1
		shr	cx,1
		sjz	nemana
fimana:		push	cx
		lodsw
		push	di
femme:		scasw
		sjne	fatal
		push	si
		push	di
		cmpsw
		sje	metal
		cmp	wr [di-2],-2
		sja	datal
		test	bp,32
		sjz	ige
		cmp	dx,1
		sja	datal
metal:		cmpsw
		sjne	datal
		cmpsw
datal:		pop	di
		pop	si
		sje	femana
fatal:		add	di,6
		loop	femme
		sjmp	emana
ige:		cmp	ax,sorszam
		mov	di,ax
		sjae	datal
		add	ax,ax
		add	ax,ax
		mov	ds,szoseg
		xchg	ax,si
		lodsw
		mov	si,[si]
		and	si,63
		add	si,si
		xchg	ax,di
		mov	ds,es:dseg[si]
		push	es
		test	br [di],28
		pop	ds
		sjmp	datal
femana:		mov	wr [di],-1
emana:		pop	di
		add	si,6
		or	cx,cx
		pop	cx
		sjz	nemana
		dec	dx
		sjnz	fimana
		or	bx,bx
		les	di,dr monte
		sjz	nemana
		cmp	di,mommax
		xchg	ax,bx
		sjae	nemana
		stosw
		mov	monte,di
nemana:		pop	di
		pop	si
		pop	cx
		njmp	omana
semana:		pop	si
		pop	cx
		mov	dx,monte
		pop	monte
		sub	dx,monte
		sjz	szamana
szassem:	shr	dx,1
sassze:		mov	mennyit,dx
		ret
szamana:	jcxz	szassem
		push	cx
		push	si
szalap:		lodsw
		add	si,6
		cmp	ax,-16
		sjae	szaha
		cmp	ax,127
		sjbe	szaha
		pop	si
		pop	cx
		sjmp	szassem
szaha:		loop	szalap
		pop	si
		pop	cx
		push	cx
		push	si

		xor	ax,ax	;	!!! szamnevek !!!
		xor	bx,bx

		pop	si
		xor	dx,dx
		pop	cx
		stc
		sjmp	sassze
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
showord		proc	far		;	AX. n‚vhez visszaadja a 4 word-
		xor	cx,cx		;	”kre felbontott sz¢list t.
		cmp	ax,libnum	;	(DS:SI/CX + egy‚b!)
		mov	di,offset vegszo
		mov	es,ldxpuf
		mov	dx,cx
		mov	bp,cx
		push	di
		sjae	nyewo
		xchg	ax,cx
		xor	bx,bx
		xor	si,si
		mov	mennyit,ax
		jcxz	nyewo
		inc	cx
showop:		add	si,ax
		mov	al,es:[bx]
		inc	bx
		mov	dl,al
		and	al,31
		loop	showop
		mov	bx,lpmret1
		xchg	ax,cx
		cmp	si,bx
		mov	es,libpuf1
		sjb	shewo
		sub	si,bx
		mov	es,libpuf2
shewo:		mov	bx,si
		dec	bx
		add	bx,cx
		add	si,si
		add	bx,bx
		test	dl,192
		jcxz	nyewo
		sjz	nyewo
		mov	ax,es:[bx]
		test	dl,64
		mov	bp,ax
		sjz	yewo
		dec	cx
		or	dl,128
		jcxz	nyewo
		mov	bp,es:[bx-2]
yewo:		dec	cx
nyewo:		push	es
		mov	tulaj,dx
		push	ds
		mov	mettol,bp
		pop	es
		mov	meddig,ax
		pop	ds
sholop:		xor	bx,bx
		xor	dx,dx
		push	di
		xor	bp,bp
		xor	di,di
rolx:		xor	ax,ax
		jcxz	gwolx
		lodsw
		dec	cx
		cmp	ah,63
		sjb	olx
		mov	ah,255
		sja	rolx
olx:		push	ax
		xor	di,di
golx:		jcxz	wolx
		lodsw
		dec	cx
		or	ax,ax
		sjns	oolx
		cmp	ax,32768
		sjne	ooolx
		jcxz	wolx
		inc	si
		dec	cx
		inc	si
ooolx:		and	ax,8191
		sjz	golx
		xchg	ax,bp
		sjmp	golx
olgh:		dec	si
		inc	cx
		dec	si
		sjmp	wolx
oolx:		cmp	ah,64
		sjb	olgh
		push	bp
		cmp	di,3
		push	di
		sjae	qoci
		push	cx
		and	ah,63
		xor	bp,bp
qox1:		dec	di
		mov	cl,14
		sjs	qoxox
qox2:		add	ax,ax
		rcl	bp,1
		loop	qox2
		sjmp	qox1
nolop:		sjmp	sholop
qoxox:		or	dx,bp
		pop	cx
		or	bx,ax
qoci:		pop	di
		pop	bp
		jcxz	wolx
		lodsw
		inc	di
		dec	cx
		sjmp	oolx
wolx:		pop	ax
gwolx:		or	ax,ax
		pop	di
		sjz	qasz
		stosw
		xchg	ax,bp
		inc	br es:mennyit
		stosw
		xchg	ax,bx
		stosw
		xchg	ax,dx
		stosw
qasz:		cmp	di,offset vegszo+128
		jcxz	holx
		sjb	nolop
holx:		push	es
		pop	ds
		mov	cx,mennyit
		pop	si
		ret
showord		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
neword		proc	far		;	—j sz¢: DS:SI (CX b.), ANANAME
		xor	ax,ax		;	ut n, besz£r¢dik a n‚vt rba.
		push	ax		;	Vissza: AX - a n‚vsorsz m.
		ncall	ananame		;	(Ha nem sikerlt, nulla!)
		sjbe	nanlib
		cmp	cx,62
		mov	ax,lpmret2
		sjbe	neox
		mov	cx,62
neox:		mov	di,emret
		shr	cx,1
		mov	bx,ebnum
		sjz	anlib
		sub	ax,di
		mov	dx,libnum
		sjb	anlib
		sub	dx,bx
		mov	bp,128
		sjb	anlib
		sub	bp,ax
		mov	es,ldxpuf
nanlib:		sjbe	anlib
scaca:		cmp	bx,libnum
		mov	al,es:[bx]
		sjae	scaci
		and	ax,31
		sjz	scica
		inc	bx
		add	di,ax
		sjmp	scaca
scaci:		cmp	dx,usrmax
		sjae	anlib
		inc	libnum
scica:		cmp	cx,bp
		sjbe	reox
		mov	cx,bp
reox:		mov	ax,cx
		mov	bp,lpmret2
		add	lpmret2,ax
		add	bp,bp
		or	al,32
		add	di,di
		mov	es:[bx],al
		pop	ax
		sub	bp,di
		push	bx
		mov	es,libpuf2
		mov	bx,cx
		sjbe	meox
		add	di,bp
		add	bx,bx
kent:		dec	di
		mov	al,es:[di]
		dec	bp
		mov	es:[di][bx],al
		sjnz	kent
meox:		rep	movsw
anlib:		pop	ax
neword		endp

scanlib		proc	far		;	Gazd tlan sz¢foszl nyok
		push	ax		;	eltakar¡t sa.
		mov	ax,vgszamb
scalp:		push	ax
		mov	cx,lpmret1
		xor	di,di
		jcxz	scart
		mov	es,libpuf1
		repne	scasw
		sje	sqax
scart:		mov	cx,lpmret2
		xor	di,di
		jcxz	sqart
		mov	es,libpuf2
		repne	scasw
		sje	sqax
sqart:		ncall	remove
sqax:		pop	ax
		inc	ax
		cmp	ax,sorszam
		sjb	scalp
		pop	ax
		ret
scanlib		endp

clrword		proc	far		;	AX. n‚v kiirt sa a n‚vt rb¢l
		or	ax,ax		;	(a szavaival egytt).
		mov	dx,libnum
		sjz	scanlib
		xor	bp,bp
		cmp	ax,dx
		mov	bx,ebnum
		sjae	scanlib
		cmp	ax,bx
		mov	es,ldxpuf
		xchg	ax,bp
		sjb	scanlib
		xchg	al,es:[bp]
		dec	dx
		and	al,31
		mov	cx,lpmret2
		sjz	scanlib
		sub	lpmret2,ax
		cmp	bp,dx
		mov	di,emret
		xchg	ax,si
		sjb	lilib
		dec	libnum
sclib:		sjmp	scanlib
lilib:		cmp	bx,bp
		mov	al,es:[bx]
		sjae	lilip
		and	ax,31
		inc	bx
		add	di,ax
		sjmp	lilib
lilip:		add	si,di
		mov	es,libpuf2
		sub	cx,si
		sjbe	sclib
		push	ds
		add	si,si
		push	es
		add	di,di
		pop	ds
		rep	movsw
		pop	ds
		sjmp	sclib
clrword		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
ananame:	push	ds		;	DS:SI (CX byte) nevet szavakra
		cmp	cx,126		;	bontva bepakolja a sz¢t rba.
		mov	di,offset vesa	;	(+AL: neme!!! - ld. fent.)
		pop	es		;	(Azaz visszaadja SI+CX-ben...)
		xchg	ax,bp
		push	wr own
		sjbe	azalea
		mov	cx,126
azalea:		and	wr own,242+31*256
		push	di
		sjmp	ocho
osho:		or	own,1
ocho:		push	bp
		and	xown,63
		push	di
		mov	di,offset vegszo
		push	es
		jcxz	anand
ancik:		lodsb
		or	al,al
		sjz	ancix
		cmp	al,84
		sje	anand
		cmp	al,81
		sjb	anand
		sja	manc
		or	xown,64
manc:		cmp	al,86
		sjb	ancix
		cmp	al,89
		sjb	anand
		sje	mancix
		cmp	al,99
		sje	mancix
		cmp	al,90
		sjne	manci
		or	xown,32
		sjmp	ancix
manci:		cmp	al,107
		sjne	ancix
		and	xown,223
		sjmp	ancix
mancix:		or	xown,128
ancix:		and	own,254
		loop	ancik
anand:		and	own,251
		cmp	al,36
		push	di
		jcxz	amanda
		sjb	kisab
		cmp	al,71
		sjae	kisab
sisab:		or	own,4
kisab:		cmp	al,36
		sjae	isab
		test	own,1
		sjnz	isab
		add	al,35
		sjmp	sisab
isab:		test	own,4
		sjz	visab
		and	own,254
visab:		test	xown,32
		sjz	amcik
		and	wr own,250+63*256
amcik:		cmp	di,offset vegszo+30
		stosb
		mov	al,[si]
		sjae	amand
		or	al,al
		sjz	amand
		cmp	al,36
		sjb	amcix
		cmp	al,71
		sjb	amand
		cmp	al,81
		sjb	amcix
		cmp	al,84
		sje	amcix
		cmp	al,86
		sjb	amand
		cmp	al,89
		sjae	amand
amcix:		inc	si
		loop	amcik
		inc	cx
amand:		dec	cx
amanda:		pop	ax
		mov	wr [di],128
		push	cx
		mov	cx,di
		push	si
		sub	cx,ax
		xchg	ax,si
		xchg	ax,bp
		sjb	tappe
		ncall	vappend
tappe:		pop	si
		pop	cx
		pop	es
		pop	di
		sjc	szojo
		cmp	ax,-16
		sjb	szokc
		mov	ah,63
		sjmp	szox
szokc:		or	ax,ax
		sjs	szojo
		sjz	szojo
		cmp	ax,sorszam
		sjae	szojo
		cmp	ah,63
		sjae	szojo
szox:		stosw
		xchg	ax,bp
		push	cx
		and	ah,31
		test	own,1
		mov	cl,14
		sjz	irra
		or	ah,32
irra:		test	xown,32
		sjz	xirra
		or	ah,64
xirra:		or	ax,ax
		sjz	nirra
		or	ah,128
		stosw
nirra:		mov	ax,wr own
		shr	ax,cl
		test	own,4
		sjz	terra
		or	al,4
terra:		or	ax,ax
		sjz	werra
		push	ax
		mov	ax,32768
		stosw
		pop	ax
		or	ah,64
		stosw
werra:		xchg	ax,bp
		cmp	ah,63
		sjne	szojox
		cmp	al,-8
		mov	dx,aktum+2
		mov	bx,aktum
		sjae	szasz
		xor	dx,dx
szasz:		ncall	szaegy
		ncall	szaegy
		ncall	szaegy
szojox:		pop	cx
szojo:		pop	bp
		jcxz	szoco
		njmp	osho
szoco:		pop	si
		mov	cx,di
		pop	wr own
		sub	cx,si
		ret

szaegy:		mov	ax,bx
		or	ax,dx
		mov	ax,bx
		sjz	pocko
		and	ah,63
		or	ah,64
		shr	bx,cl
		stosw
		mov	ax,dx
		add	ax,ax
		add	ax,ax
		shr	dx,cl
		or	bx,ax
pocko:		ret

vappend:	push	ds		;	Ellen“rzi is: l‚tezik-e m r.
		cmp	cx,126		;	(APPEND b“v¡t‚se.)
		mov	di,offset szocska
		pop	es
		jcxz	nappe
		push	cx
		sjbe	vapp
		mov	cx,126
vapp:		cmp	si,di
		push	si
		mov	szocskho,cx
		push	ax
		sje	nevapp
		rep	movsb
nevapp:		call	ertelm
		pop	di
		pop	si
		pop	cx
		;sjc	ppend
		;or	bp,bp
		;sjz	appe
		sjnc	appe
ppend:		xchg	ax,di

append:		and	al,3		;	—j sz¢val b“v¡ti a sz¢t rt:
		cmp	cx,31		;	SI: a sz¢ (f“n‚v!) kezdete,
		xchg	al,bh		;	CX: hossza,
		jcxz	nappe		;	AL: 0 - it, 1 - him, 2 - her,
		sjbe	jorro		;	    3 -them.
		mov	cx,31		;	Vissza: STC - hiba!!!
jorro:		cmp	br [si],36	;	AX: az £j sz¢ sorsz ma.
		mov	ax,64*256+32	;	(+BP: ragoz sa is!!!) !!!
		mov	bl,2
		sjb	bapt
		cmp	br [si],70
		sja	bapt
		mov	al,32
		sub	br [si],35
bapt:		push	ax
		xor	dx,dx
		cmp	cl,bl
		push	si
		sjae	pikl
		mov	bl,cl
pikl:		lodsb
		inc	dx
		cmp	al,15
		sjae	ptov
		test	al,1
		sjz	phoss
		cmp	dl,bl
		sjne	phoss
		loop	priss
		dec	bx
priss:		inc	cx
phoss:		cmp	al,7
		sjb	mely
		cmp	al,11
		sjb	pedra
		mov	ah,96
		sjmp	ptov
pedra:		test	ah,64
		sjnz	aliz
		cmp	al,9
		sjae	aliz
mely:		mov	ah,32
		sjmp	ptov
nappe:		xor	bp,bp
xappe:		xor	ax,ax
		stc
appe:		ret
aliz:		mov	ah,64
ptov:		loop	pikl
		mov	cl,3
		or	bl,ah
		shl	bh,cl
		mov	si,offset aellj
		mov	cl,aelljv-aellj
ciklj:		cmp	al,[si]
		sje	ninj
		inc	si
		loop	ciklj
		or	bh,32
ninj:		cmp	al,15
		mov	si,offset aellk
		mov	cl,aellkv-aellk
		sjb	nink
ciklk:		cmp	al,[si]
		sje	nink
		inc	si
		loop	ciklk
		or	bh,64
nink:		pop	si
		or	uan,2
		mov	cx,dx
		pop	ax
		or	bl,4
		ncall	becsom
		sjae	tapp
		or	al,64
		mov	dx,cx
tapp:		mov	di,vegyesb
		and	uan,253
		or	al,cl
		add	dx,5
		add	di,255
		xor	bp,bp
		cmp	dx,vegyesm
		xchg	ax,bx
		sjg	nappe
		sub	di,vegyesm
		cmp	bp,vgszamm
		mov	es,dseg
		sjge	nappe
		push	di
		sub	vegyesm,dx
		stosw
		xchg	ax,bx
		dec	vgszamm
		stosb
		push	es
		;mov	ax,2
		mov	ax,vgszamb
		rep	movsb
		mov	es,szoseg
ulti:		cmp	ax,sorszam
		sjae	ujszam
		push	ax
		add	ax,ax
		push	di
		add	ax,ax
		xor	di,di
		xchg	ax,di
		scasw
		sjne	oreg
		scasw
oreg:		pop	di
		pop	ax
		sje	regi
		inc	ax
		sjmp	ulti
ujszam:		inc	sorszam
regi:		cmp	ax,vgszamb
		pop	es
		mov	cx,ax
		sjae	aegi
		inc	vgszamm
aegi:		add	ax,ax
		push	ax
		shr	al,1
		stosw
		mov	al,-1
		stosb
		pop	di
		mov	es,szoseg
		pop	ax
		add	di,di
		stosw
		mov	ax,bp
		stosw
		xchg	ax,cx
nerow:		ret

remove:		or	ax,ax		;	AX. sorsz m£ sz¢ elt vol¡t sa a
		sjz	nerow		;	sz¢t rb¢l.
		cmp	ax,sorszam
		sjae	nerow
		cmp	ax,vgszamb
		sjb	nerow
		push	ax
		xor	di,di
		add	ax,ax
		mov	es,szoseg
		add	ax,ax
		mov	cx,vegyesb
		xchg	ax,di
		mov	bp,es
		xchg	ax,es:[di]
		inc	ch
		push	ax
		xor	ax,ax
		xchg	ax,es:[di+2]
		or	ax,ax
		pop	ax
		mov	es,dseg
		xchg	ax,di
		pop	ax
		sjnz	nerov
		or	di,di
		sjz	nerov
		push	ax
		sub	cx,vegyesm
		push	ds
		push	es
		mov	si,di
		pop	ds
		lodsw
		lodsb
		and	ax,31
		add	si,ax
		lodsw
		mov	dx,si
		sub	dx,di
		cmp	br [si],0
		sjs	serov
		sub	cx,si
		sjbe	serov
		push	di
		rep	movsb
		pop	si
		mov	es,bp
celop:		lodsw
		or	al,al
		sjs	cern
		cmp	si,di
		lodsb
		sjae	cern
		and	ax,31
		add	si,ax
		lodsw
		add	al,al
		add	ax,ax
		xchg	ax,di
		cmp	es:[di],dx
		sjbe	cerx
		sub	es:[di],dx
cerx:		xchg	ax,di
		sja	celop
cern:		push	ds
		dec	di
		pop	es
serov:		mov	al,-1
		pop	ds
		stosb
		add	vegyesm,dx
		cmp	di,vegyesb
		pop	ax
		sjae	erov
		mov	vegyesb,di
erov:		cmp	ax,vgszamb
		sjb	nerov
		inc	vgszamm
nerov:		ret
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
clrdic		proc	far		;	Teljes t”rl‚s.
		mov	ax,vgszamb
		mov	vegyesm,256
		mov	sorszam,ax
		mov	ax,ebnum
		mov	vgszamm,ujszmax
		mov	libnum,ax
		mov	ax,emret
		mov	lpmret2,ax
		ret
clrdic		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
xsprosszo:	njmp	sprosszo

nyers:		cmp	ah,127
		mov	ucsorag,-1
		sje	xprosszo
		cmp	ah,253
xprosszo:	sjae	xsprosszo
		and	ah,63
		or	ax,ax		;	Az AX. sz¢t bet”lti a sz¢t rb¢l
		sjz	rosszo		;	egy pufferba. Kimenet:
		cmp	ax,sorszam	;	DS:[SI] = kezd“c¡m (szavacska),
		sjae	rosszo		;	CX = a sz¢ hossza,
		cmp	ax,aktszo	;	AX = sorsz m,
		mov	aktszo,ax	;	CF = 1, ha rossz volt az input,
		sje	marad		;	ZF = 0, ha nagybet–s a sz¢.
		mov	nktszo,ax
		add	ax,ax		;	(+bemenet sz mn‚v eset‚n:
		add	ax,ax		;	BX/DX = a sz m‚rt‚k!!!)
		push	ds
		mov	di,ax
		mov	ds,szoseg
		mov	si,[di]
		mov	ax,[di+2]
		pop	es
		mov	di,offset szbyt
		mov	bx,ax
		and	bx,63
		add	bx,bx
		mov	ds,es:dseg[bx]
		movsw
		sjz	vegyes
		stosw
		mov	bl,2
vegyes:		lodsb
		test	al,64
		mov	es:ksbyt,al
		pushf
		and	ax,31
		popf
		mov	cx,ax
		sjz	timpike
		jcxz	timpike
		ncall	kicsom
timpike:	add	al,bl
timea:		cmp	cx,112
		sja	nattim
timike:		shr	cx,1
		sjnc	vevex
		movsb
vevex:		push	es
		rep	movsw
		pop	ds
		mov	szohossz,ax
		ncall	utsmegh
		ncall	ximpl
		mov	ax,aktszo
		cmp	ax,128
		sjb	szammo
marad:		mov	si,offset szavacska
		mov	cx,szohossz
		and	ksbyt,32
		ret
sprosszo:	mov	ah,255
rosszo:		cmp	ax,-16
		sjae	russzo
		ncall	marad
		stc
osszo:		ret

szammo:		mov	cl,utsbet
		mov	ntsbet,cl
		sjmp	marad

nattim:		mov	cx,112
		sjmp	timike

russzo:		push	ax
		cmp	al,-8
		push	bx
		xchg	ax,bx
		sjae	rousseau
		xor	dx,dx
rousseau:	push	dx
		call	sztram
		pop	dx
		pop	bx
		pop	ax
		sjc	osszo
		cmp	ax,aktszo
		mov	aktszo,ax
		sjne	nemmar
		cmp	bx,aktum
		sjne	nemmar
		cmp	dx,aktum+2
		sjne	nemmar
		xor	bx,bx
		sjmp	marad
nemmar:		mov	nktszo,ax
		add	di,cx
		or	al,8
		mov	ucsorag,-1
		cmp	al,-2
		mov	aktum,bx
		mov	aktum+2,dx
		sje	kettt
		push	ax
		sja	minegy
		cmp	al,-8
		mov	al,-7
		sjbe	kattt
minegy:		push	cx
		dec	ax
		push	si
		push	di
		push	aktszo
		;push	nktszo
		ncall	nyers
		;pop	nktszo
		pop	aktszo
		pop	di
		pop	si
		pop	cx
kattt:		pop	ax
kettt:		cmp	al,-2
		mov	ah,al
		sjae	usszo
		cmp	al,-7
		sjbe	szaszo
		test	al,2
		mov	al,81		;	"-"
		sjnz	ssz1
		inc	cx
		stosb
ssz1:		test	ah,1
		sjnz	ssz2
resszo:		mov	al,17		;	"d"
		inc	cx
		stosb
ssz2:		inc	cx
		ncall	ikikk
		inc	cx
usszo:		sjne	wesszo
szaszo:		cmp	al,-7
		mov	ah,conan
		mov	bx,di
		sje	qsszo
		xor	dx,dx
		mov	wr vegszo,ax
		mov	si,offset vegszo+4
		xor	bp,bp
		mov	wr vegszo+2,dx
		mov	al,33
		ncall	kszazas
		inc	bp
		mov	al,32
		ncall	kszazas
		inc	bp
		mov	al,31
		ncall	kszazas
		cmp	aktum+2,0
		sjb	ninc
		sja	binc
		cmp	aktum,10000
		sjb	ninc
binc:		inc	bp
ninc:		xor	al,al
		ncall	kszazas
		cmp	bx,di
		mov	al,30
		sjne	nenula
		ncall	kozvetl
nenula:		cmp	vegszo,-2
		xchg	ax,dx
		mov	si,offset vegszo+16
		sjae	noztv
		cmp	al,34
		sjae	noztv
		cmp	si,bx
		mov	di,bx
		sjne	neegy
		cmp	al,1
		sjne	ehegy
		mov	al,84		;	"els“"
		ncall	kozvetl
		sjmp	noztv
wesszo:		sjmp	vesszo
qsszo:		sjmp	esszo
ehegy:		cmp	al,2
		sjne	neegy
		mov	al,36		;	"m sodik"
neegy:		xor	bp,bp
		add	al,33
		ncall	kozvetl
		ncall	ikikk
noztv:		mov	ax,71*(1+256)
		mov	cx,di
		mov	wr vegszo,ax
		mov	wr vegszo+2,ax
		sub	cx,si
vesszo:		mov	wr [di],128
		xor	bx,bx
		mov	ax,cx
		and	szbyt,252
		mov	di,offset szavacska
		mov	ksbyt,bl
		njmp	timea

esszo:		mov	al,81
		inc	cx
		stosb
		push	si
		mov	al,dl
		mov	si,7
		xor	dx,dx
hattlp:		cmp	al,blagga[si]
		sjne	blatto
		cmp	si,2
		mov	al,11
		pop	si
		sjb	tatto
		mov	al,3
		sjmp	tatto
blatto:		dec	si
		sjns	hattlp
		mov	al,kthang
		pop	si
		cmp	al,3
		sje	sbatto
		cmp	al,11
		sjne	hatto
sbatto:		dec	ax
		dec	ax
hatto:		and	al,63
tatto:		inc	cx
		stosb
		njmp	resszo

kszazas:	push	ax
		xor	ax,ax
		and	conan,191
		xchg	al,vegszo+2
		or	vegszo+3,al
		lodsb
		sub	al,71
		sjbe	zsz1
		cmp	al,1
		sja	tbbsz
		cmp	ah,vegszo+3
		sjz	egysz
tbbsz:		ncall	kozvetl
egysz:		mov	al,29
		ncall	kozvetl
zsz1:		lodsw
		xchg	al,ah
		sub	ax,71*(1+256)
		cmp	ax,200h
		sjb	kissz
		sje	hussz
		push	ax
		mov	al,ah
		add	al,19
		ncall	kozvetl
		pop	ax
		sjmp	viss
hussz:		mov	al,10
kissz:		or	ah,ah
		sjz	viss
		add	al,10
viss:		pop	cx
		mov	ah,vegszo+2
		or	cl,cl
		mov	ch,vegszo+1
		sjnz	sraml
		and	ch,64
		or	conan,ch
sraml:		cmp	al,1
		push	cx
		sjb	zsz2
		sja	zbbsz
		or	ah,vegszo+3
		sjnz	zbbsz
		cmp	cl,31
		sje	azvetl
zbbsz:		ncall	kozvetl
zsz2:		cmp	vegszo+2,0
		pop	ax		
		sje	nuztv
		push	ax
azvetl:		pop	ax

kozvetl:	or	al,al
		cbw
		mov	br [di],81
		sjz	nuztv
		test	conan,64
		push	ax
		sjz	kztl
		cmp	al,2
		sje	ketto
		cmp	al,12
		sjne	kztl
ketto:		add	al,66
kztl:		cmp	ah,vegszo+3
		push	si
		sje	kozvtl
		or	bp,bp
		mov	vegszo+3,ah
		sjz	kozvtl
		inc	di
kozvtl:		push	di
		inc	vegszo+2
		push	aktszo
		;push	aktum
		;push	aktum+2
		ncall	nyers
		;pop	aktum+2
		;pop	aktum
		pop	aktszo
		xor	bp,bp
		pop	di
		shr	cx,1
		mov	bx,di
		sjnc	nyulb
		movsb
nyulb:		rep	movsw
		pop	si
		pop	dx
nuztv:		ret

ikikk:		and	attr,223
		mov	ax,7+256*22	;	"ik"
		and	szbyt,223
		or	attr,64
		stosw
		ret

cutsmegh:	xor	cx,cx

utsmegh:	push	bp
		mov	al,szbyt
		cmp	di,offset vegszo
		mov	cl,5
		mov	bp,offset szavacska
		push	ax
		sjb	utu
		cmp	di,offset vegszo+128
		sjae	utu
		mov	bp,offset vegszo
utu:		cmp	di,offset regszo
		sjb	cutu
		cmp	di,offset regszo+128
		sjae	cutu
		mov	bp,offset regszo
cutu:		shr	ax,cl
		pop	si
		and	ax,3
		mov	wr [di],128
		xchg	ax,si
		push	di
		test	al,12
		mov	ah,64
		mov	al,ktmgh[si]
		sjnz	fnvsz
		mov	ah,16
		mov	al,ktmgh1[si]
fnvsz:		test	ah,attr
		sjnz	kellh
		or	al,128
kellh:		mov	kthang,al
		mov	al,ktmgh2[si]
		lea	si,[di-2]
		mov	kthang2,al
		cmp	si,bp
		mov	utsbet,ch
		lodsw
		sjb	utslp
		cmp	ah,20
		sjne	utslp
		;cmp	al,15
		;sjb	utslp
		cmp	al,16
		sje	utslp
		cmp	al,26
		sje	utslp
		cmp	al,34
		sje	utslp
		dec	di
		mov	utsbet,64
utslp:		mov	si,offset utstabl
		xor	ax,ax
		sjmp	xutslp
utslap:		add	si,cx
		add	di,cx
xutslp:		mov	cl,[si]
		inc	ax
		inc	si
		sub	di,cx
		and	utsbet,64
		jcxz	uccse
		cmp	di,bp
		mov	utscim,di
		sjb	utslap
		repe	cmpsb
		sjne	utslap
		push	ax
		mov	ax,aktszo
		cmp	ax,vgszamb
		pop	ax
		sjb	oyuy
		or	kthang,128
		cmp	al,2
		sje	oyuy
		cmp	al,3
		sje	oyuy
		cmp	al,6
		sje	oyuy
		cmp	al,9
		sje	oyuy
		cmp	al,11
		sje	oyuy
		cmp	al,12
		sje	oyuy
		cmp	al,18
		sje	oyuy
		cmp	al,27
		sje	oyuy
		and	kthang,127
oyuy:		cmp	al,27
		sjne	yuyuy
		dec	di
		dec	di
		cmp	di,bp
		sjb	yuyuy
		cmp	br [di],3
		sje	yuyuy
		cmp	br [di],5
		sjne	uccse
yuyuy:		add	al,35
		pop	di
		or	utsbet,al
		sjmp	dupla
uccse:		pop	ax
		test	utsbet,64
		mov	di,ax
		sjz	xuccs
		dec	ax
xuccs:		mov	utscim,ax
dupla:		test	utsbet,63
		mov	si,utscim
		sjnz	vanpl
		dec	si
		cmp	si,bp
		lodsb
		sjb	vanpl
		cmp	al,36
		sjae	vanpl
		dec	si
		or	utsbet,al
		dec	utscim
vanpl:		dec	si
		cmp	si,bp
		lodsb
		pop	bp
		sjb	simpl
		cmp	al,[si]
		sjne	simpl
		cmp	al,15
		sjb	simpl
		dec	si
		or	utsbet,128
		dec	utscim
simpl:		test	szbyt,16
		mov	al,ch
		sjnz	kimpl
		test	szbyt,12
		sjz	kimpl
		mov	al,attr
		and	al,7
		cmp	al,3
		sje	timpl
		and	ksbyt,32
		mov	al,utsbet
		sjz	impl
		test	al,192
		sjnz	timpl
impl:		and	al,63
		cmp	al,45
		mov	al,ch
		sjb	kimpl
timpl:		mov	al,81
kimpl:		mov	kvaljl,al
		ret

ximpl:		mov	al,kthang
		mov	xthang,al
		mov	al,kthang2
		mov	xthang2,al
		mov	al,kvaljl
		mov	xvaljl,al
		mov	ax,utscim
		mov	xtscim,ax
		mov	al,utsbet
		mov	xtsbet,al
		mov	al,sjattr
		mov	xjattr,al
		mov	al,specr
		mov	specr,al
		mov	al,xown
		and	al,11
		mov	xxown,al
		ret

qimpl:		mov	al,xthang
		mov	kthang,al
		mov	al,xthang2
		mov	kthang2,al
		mov	al,xvaljl
		mov	kvaljl,al
		mov	ax,xtscim
		mov	utscim,ax
		mov	al,xtsbet
		mov	utsbet,al
		mov	al,xjattr
		mov	sjattr,al
		mov	al,xpecr
		and	xown,240
		mov	specr,al
		mov	al,xxown
		or	xown,al
		ret

sunzip:		push	ds
		shr	ax,1		;	Kit”m”r¡t‚skor tal lt sz¢t
		pushf			;	teszi be, ahov  kell.
		push	di
		mov	di,adat
		push	es
		mov	ds,di
		ncall	nyers
		pop	es
		pop	di
		sjc	srro
		popf
		sjnc	kisbet
		lodsb
		cmp	al,36
		sjae	kiskis
		add	al,35
kiskis:		stosb
		dec	cx
kisbet:		shr	cx,1
		sjnc	skisbet
		movsb
skisbet:	rep	movsw
		pop	ds
		ret
srro:		popf
		pop	ds
		ret

kicsom:		push	dx
		mov	al,3
		push	bx
		cmp	al,es:zelyik
		push	wr es:zelyik
		sje	csocsom
		ncall	kocsom
csocsom:	ncall	unzip
		pop	ax
		mov	di,si
		cmp	al,es:zelyik
		pop	bx
		sje	ecsom
		ncall	kocsom
ecsom:		add	di,cx
		xor	ax,ax
		pop	dx
		xchg	ax,cx
		ret

kocsom:		push	cx
		cmp	al,3
		push	si
		mov	cx,92
		push	di
		mov	si,adat
		push	ds
		mov	ds,si
		push	es
		mov	di,offset ziptab
		mov	es,si
		mov	zelyik,al
		mov	si,offset siptab
		sje	ocsom
		cmp	al,1
		mov	si,offset miptab
		sje	ocsom
		mov	si,offset diptab
ocsom:		rep	movsw
		pop	es
		pop	ds
		pop	di
		pop	si
		pop	cx
		ret

becsom:		push	ax
		push	di
		mov	al,3
		push	dx
		push	es
		cmp	al,zelyik
		push	bx
		push	wr zelyik
		sje	xcocsom
		ncall	kocsom
xcocsom:	push	ds
		mov	di,offset stabl-256
		pop	es
		ncall	zip
		or	ch,ch
		pop	ax
		sjz	xcoco
		mov	aktset,-1
		call	ontorl
xcoco:		cmp	al,zelyik
		pop	bx
		sje	xecsom
		ncall	kocsom
xecsom:		cmp	cx,dx
		pop	es
		sjb	jocsom
		mov	cx,dx
		mov	si,di
jocsom:		pop	dx
		pop	di
		pop	ax
		ret

fnyers		proc	far
		ncall	nyers
		ret
fnyers		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
elso_szo:	mov	al,szocska	;	A "sz¢cska" pufferban l‚v“ sz¢t
		cmp	al,36		;	keressk a sz¢t rban, ehhez
		sjb	kisbesz		;	jelen¡ti meg az els“ illeszked“
		cmp	al,71		;	sz¢t a "szavacska" pufferban.
		sjae	kisbesz		;	(El“sz”r a saj t blokkj ban,
		sub	szocska,35	;	azut n a vegyesblokkban keres.)
		mov	al,-1
kisbesz:	mov	nagybet,al
		mov	ax,szocskho
		cmp	ax,126
		sjbe	szocske
		mov	ax,126
		mov	szocskho,ax
szocske:	mov	bx,ax
		dec	ax
		mov	wr szocska[bx],128
		sjz	vegyszo2
		sjs	nincszo
		mov	cx,ax
		mov	bx,wr szocska
		or	bl,bl
		sjz	vegyszo
		or	bh,bh
		sjz	vegyszo
		mov	al,36
		cmp	bl,al
		sjae	vegyszo
		cmp	bh,al
		sjae	vegyszo
		mov	blokker,bx
		add	bx,bx
		mul	bl
		add	al,bh
		adc	ah,ch
		mov	si,ax
		xor	bh,bh
		mov	ax,blokk[si]
bloblok:	mov	cx,dseg[bx]
		cmp	ax,-1
		sje	vegyszo
		jcxz	megyszo
		mov	wr szavmut,ax
		mov	wr szavmut+2,cx

uj_szo:		mov	di,blokker	;	A k”vetkez“ illeszked“ sz¢.
		mov	bp,szocskho
		push	ds
		pop	es
		push	ds
		lds	si,szavmut
		sjmp	uscikl

megyszo:	or	bx,bx
		sjnz	vegyszo
nincszo:	stc
		ret
ujveg:		or	di,di
		pop	ds
		sjz	nincszo
vegyszo:	xor	ax,ax
vegyszo2:	mov	bx,ax
		mov	blokker,ax
		sjmp	bloblok

suttyo:		lds	si,dr es:suttog
		mov	es:suttog,0
		sjmp	sutox

sajblok:	lodsw
		dec	si
		cmp	cl,3
		sjb	sajaj
		cmp	ah,es:szocska+2
		sjne	austov
sajaj:		mov	bl,al
		and	ax,31
		mov	cx,ax
		add	al,2
		cmp	ax,bp
		sja	xustov
		mov	wr es:szavacska,di
		mov	es:szohossz,ax
		mov	di,offset szavacska+2
		sjmp	dekezb

csajblok:	sjmp	sajblok

ustov:		lodsb
austov:		and	ax,31
sustov:		add	al,2
xustov:		add	si,ax
uscikl:		cmp	es:suttog,0
		sjne	suttyo
sutox:		lodsw
		or	al,al
		sjs	ujveg
		mov	cx,ax
		push	ax
		mov	al,[si]
		test	al,64
		sjz	ninus

		lodsb
		pop	dx
		and	ax,31
		add	si,ax
		lodsw
		add	al,al
		pop	ds
		shr	ax,1
		mov	wr szavmut,si
		ncall	nyers
		add	si,cx
		mov	bl,ksbyt
		mov	suttog,0
		mov	dx,wr szbyt
		mov	wr [si],128
		sjmp	tomor
ninus:		and	cx,3
		pop	dx
		sjz	nemkezb
		cmp	cx,bp
		sja	ustov
		or	di,di
		mov	ax,si
		sjnz	csajblok
		inc	si
		mov	di,offset szocska
		repe	cmpsb
		mov	di,0
		xchg	ax,si
		sjne	ustov
nemkezb:	lodsb
		mov	bl,al
		and	ax,31
		cmp	ax,bp
		sja	sustov
		mov	cx,ax
		mov	di,offset szavacska
		mov	es:szohossz,ax
dekezb:		shr	cx,1
		sjnc	nemcec
		movsb
nemcec:		rep	movsw
		lodsw
		pop	ds
		add	al,al
		mov	suttog,cx
		mov	wr [di],128
		shr	ax,1
		mov	ucsorag,-1
		mov	wr szavmut,si
		mov	wr szbyt,dx
		mov	aktszo,ax
		mov	nktszo,ax
tomor:		and	bl,32
		mov	cx,szohossz
		mov	si,offset szavacska
		mov	di,offset szocska
		mov	ksbyt,bl
		ret
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
szip:		push	ax		;	Sz”vegt”m”r¡t‚skor, a
		push	cx		;	DS:[SI]-b“l bet”lti az ott l‚v“
		push	si		;	sz¢t, ‚s ellen“rzi, benne van-e
		push	di		;	a sz¢t rban. (Fontos: el“tte
		push	es		;	m r be kell olvasni a legels“
		mov	bx,adat		;	karaktert egy LODSB-bal!!!)
		mov	es,bx
		mov	di,offset szocska
		mov	cx,bp
		jcxz	csip
		cmp	cx,62
		sjbe	szippant
		mov	cx,62
		sjmp	szippant
szipbe:		lodsb
		;or	al,al
		;sjz	szipveg
		cmp	al,89
		sjae	szipveg
szippant:	stosb
		loop	szipbe
szipveg:	mov	wr es:[di],128
		sub	di,offset szocska
		cmp	di,3
		sjb	csip
		push	dx
		push	bp
		push	ds
		mov	ds,bx
		xor	ax,ax
		test	uan,2
		mov	szocskho,di
		sjnz	csup
		mov	ucsorag,-1
		mov	aktszo,ax
		mov	aktum,ax
		mov	aktum+2,ax
		ncall	elso_szo
		sjc	csup
szipcik:	cmp	cx,3
		mov	bx,cx
		sjb	sziptov
		cmp	cx,aktum+2
		sjbe	sziptov
		cmp	ax,vgszamb
		sjae	sziptov
		shr	cx,1
		sjnc	szipog
		cmpsb
		sjne	sziptov
szipog:		repe	cmpsw
		sjne	sziptov
		mov	aktum,ax
		mov	aktum+2,bx
sziptov:	ncall	uj_szo
		sjnc	szipcik
		mov	ax,aktum
		or	ax,ax
		mov	bx,aktum+2
		sjnz	szup
csup:		pop	ds
		pop	bp
		pop	dx
csip:		pop	es
		pop	di
		pop	si
		pop	cx
		pop	ax
		stc
		ret
szup:		pop	ds
		pop	bp
		pop	dx
		pop	es
		pop	di
		pop	si
		pop	cx
		dec	bx
		add	si,bx
		sub	bp,bx
		pop	bx
		ret
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
msg		proc	far		;	Rezidens sz”vegek ki¡r sa.
		or	ax,ax
		sjs	dsk
msg		endp

msk		proc	far
		push	ds
		and	ah,127
		cmp	zelyik,1
		pop	es
		mov	mitisir,ax
		sje	mesug
		mov	cx,92
		mov	si,offset miptab
		mov	di,offset ziptab
		mov	zelyik,1
		rep	movsw
mesug:		mov	cx,ax
		cmp	ax,uzenet
		jcxz	nemsg
		sjae	nemsg
		xor	si,si
		dec	cx
		mov	ds,useg
		sjz	smesg
mkeres:		lodsw
		add	si,ax
		loop	mkeres
smesg:		lodsw
		or	ax,ax
		sjz	sejm
		njmp	smirgli
msk		endp

sejm:		push	es
		pop	ds

nemsg		proc	far
		test	uan,32
		mov	mitisir,0
		sjz	coco
		add	sp,8
		and	uan,223
coco:		ret
nemsg		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
dsg		proc	far		;	Lemezes sz”vegek ki¡r sa.
		or	ax,ax
		sjs	msk
dsg		endp

dsk		proc	far
		or	ah,128
		push	ds
		mov	mitisir,ax
		and	ah,127
		cmp	zelyik,2
		pop	es
		sje	desug
		mov	cx,92
		mov	si,offset diptab
		mov	di,offset ziptab
		mov	zelyik,2
		rep	movsw
desug:		or	ax,ax
		sjz	nemsg
		cmp	ax,duzenet
		xchg	ax,dx
		mov	bx,dusmut
		mov	ax,dpszab_max
		sjae	nemsg
		cmp	bx,ax
		sjbe	besug
		mov	bx,ax
		mov	dusmut,ax
besug:		sub	ax,bx
		xor	si,si
		mov	dpszab,ax
		mov	ds,duseg
dkeres:		cmp	si,bx
		sjae	dnincs
		lodsw
		cmp	ax,2
		sjb	dnincs
		cmp	dx,[si]
		sje	edesg
		add	si,ax
		sjmp	dkeres
slejm:		call	farclose
pemsg:		pop	ax
		sjmp	nemsg
edesg:		njmp	sdesg
dnincs:		push	es
		mov	ax,501h
		pop	ds
		push	dx
		call	fastopen
		sjc	pemsg
		pop	dx
		xor	cx,cx
		push	dx
		xor	ax,ax
		add	dx,dx
		adc	cx,cx
		add	dx,dx
		adc	cx,cx
		add	dx,184
		mov	bx,file
		adc	cx,ax
		mov	ah,42h
		int	21h
		sjc	slejm
		mov	dx,offset vesa
		mov	cx,4
		call	farread
		sjc	pemsg
		mov	dx,wr vesa
		mov	cx,wr vesa+2
		mov	bx,file
		mov	ax,4200h
		int	21h
		sjc	slejm
		mov	dx,offset vesa
		mov	cx,2
		call	farread
		mov	dl,suan
		sjc	pemsg
		and	dl,8
		push	ds
		mov	cx,wr vesa
		mov	ax,dpszab_max
		pop	es
		sjz	suhan
		jcxz	slejm
suhan:		add	cx,6
		mov	bx,dpszab
		cmp	cx,512+aptuf+1024
		mov	si,dusmut
		sjbe	csuhaj
		mov	cx,512+aptuf+1024
csuhaj:		cmp	cx,ax
		mov	ds,duseg
		sjb	nettul
		xchg	ax,cx
cttul:		mov	ax,es:dpszab_max
		xor	si,si
		mov	es:dpszab,ax
		mov	es:dusmut,si
		sjmp	ettul
nettul:		or	dl,dl
		sjnz	cttul
		cmp	cx,bx
		mov	dx,cx
		sjbe	ettul
		mov	cx,si
		xor	si,si
		xor	di,di
nerc:		cmp	si,es:dusmut
		sjae	cttul
		lodsw
		add	si,ax
		cmp	ax,2
		lea	ax,[bx][si]
		sjb	cttul
		cmp	dx,ax
		sja	nerc
		sub	cx,si
		push	ds
		add	es:dpszab,si
		sub	es:dusmut,si
		shr	cx,1
		pop	es
		sjnc	derc
		movsb
derc:		rep	movsw
		xor	ax,ax
		mov	cx,dx
		mov	si,di
		stosw
ettul:		pop	ax
		lea	dx,[si+4]
		push	si
		sub	cx,6
		mov	[si+2],ax
		push	cx
		sjbe	cobbol
		call	farread
cobbol:		mov	ax,adat
		sjc	rovvol
		push	ds
		mov	ds,ax
		push	ax
		call	farclose
		pop	ax
		pop	ds
rovvol:		pop	bx
		mov	es,ax
		pop	si
		sjnc	ejm
dejm:		njmp	sejm
ejm:		inc	bx
		inc	bx
		xor	ax,ax
		mov	[si],bx
		inc	bx
		inc	bx
		sub	es:dpszab,bx
		mov	[bx][si],ax
		sjnc	susm
		mov	es:dpszab,ax
susm:		add	es:dusmut,bx
		lodsw
sdesg:		cmp	ax,2
		lodsw
		sjbe	dejm
dsk		endp

smirgli		proc	far
		mov	di,offset vesa
		;ncall	unszvip
		ncall	unzip
		push	es
		cmp	cx,512+aptuf
		pop	ds
		sjb	wstring
		mov	aktset,-1
smirgli		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
wstring		proc	far	;	DS:SI string ki¡r sa a k‚perny“re, a
		test	uan,32	;	string hossza CX-ben van.
		sjnz	schrveg
		jcxz	wstrnul
wstrcik:	lodsb
		cmp	al,121
		sjae	specko
ecpec:		ncall	wchr
westov:		jcxz	wstrnul
		loop	wstrcik
wstrnul:	mov	mitisir,cx
		ret

specko:		cmp	al,127
		sjae	ecpec
		test	kwan,16
		mov	bx,ax
		sjnz	ecpec
		or	al,128
ujnum:		push	bx
		ncall	numchr
		pop	bx
		sjc	westov
		push	bx
		cmp	bl,126
		push	cx
		push	si
		push	dx
		sjb	schrd
schrc:

schrveg:	pop	ax
		pop	si
		pop	cx
		and	uan,223
		pop	bx
		sjmp	ujnum
schrd:		cmp	bl,125
		push	mitisir
		sjne	schrr
		call	dsg
		sjmp	schdr
schrr:		cmp	bl,124
		sjne	schrg
		call	msg
schdr:		pop	ax
		or	uan,32
		or	ax,ax
		mov	mitisir,ax
		sjz	schrveg
		jmp	msg
schrg:		cmp	bl,123
		pop	di
		sjne	schrw

		sjmp	schrveg
schrw:		cmp	bl,122
		sjne	schrveg
		pop	bp
		pop	si
		pop	cx
		xchg	ax,bp
		ncall	numchr
		push	cx
		push	si
		xchg	ax,bp
		push	dx
		push	di
		call	wordwrt
		pop	mitisir
		sjmp	schrveg
wstring		endp

numchr:		or	al,al
		mov	ax,0
		cwd
		jcxz	numveg
		sjs	nummog
numveg:		stc
		ret
numnem:		xchg	ax,bx
		lodsb
		mov	dx,ax
		and	ax,63
		or	bx,ax
		test	dl,64
		xchg	ax,bx
		sjz	numvan
		push	cx
		mov	cl,6
		shl	ax,cl
		pop	cx
nummog:		loop	numnem
numvan:		ret
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
wchar		proc	far	;	Egyetlen bet– ki¡r sa.
		ncall	wchr
		ret
wchar		endp

pont		proc	far
		mov	al,101		;	Pontkirak s, de csak, ha kell!
pont		endp

pont2		proc	far
		mov	ah,utolso
		cmp	al,ah
		sje	nempont
		cmp	ah,107
		sje	pont2b
		cmp	ah,99
		sje	pont2b
		cmp	ah,89
		sjae	nempont
pont2b:		ncall	wchr
nempont:
pont2		endp

pret		proc	far		;	RETURN, de csak, ha kell!
		mov	al,113
		or	wrbit,128
		cmp	al,utolso
		sje	nempret
		ncall	wchr
nempret:	mov	nrbit,0
		ret
pret		endp

oriab:		cmp	al,71
		sjae	noriab
		call	pret
		pop	ax
		and	owan,247
		push	ax
		cmp	al,36
		push	cx
		sjb	oriza
		sub	al,35
oriza:		cbw
		push	si
		add	ax,ax
		mov	cx,11
		add	ax,ax
		mov	si,offset ormabk
		add	al,113
		cmp	al,185
		push	ax
		sjne	nemf12
		mov	al,149
nemf12:		cmp	al,221
		sjne	nemq12
		mov	al,125
nemq12:		mov	ah,al
		dec	ax
		mov	wr [si+3],ax
		pop	ax
		mov	ah,al
		add	ax,201h
		push	mitisir
		mov	wr [si+8],ax
		call	wstring
		pop	mitisir
		xchg	ax,cx
		pop	si
		mov	wrbit,al
		mov	nrbit,al
		pop	cx
		mov	utolso,al
noriab:		pop	ax
		ret
soriab:		sjmp	oriab

nvezrl:		njmp	nvezerl
vezerl:		cmp	al,114
		sjae	nvezrl
		and	kwan,239
		cmp	al,113
		sje	veztov
		ret

space:		xor	al,al
szokoz:		cmp	al,utolso
		sje	swissza
		or	wrbit,64
		mov	utolso,al
swissza:	ret
ponpon:		mov	utolso,al
unspon:		inc	wrbit
		and	wrbit,63
		sjz	unspon
		ret
ell0:		and	nrbit,127
		and	wrbit,127
ell1:		cmp	al,36
		sjb	kisbetu
		cmp	al,71
		sjb	nagybetu
ell2:		cmp	al,96
		sjae	sjael
		cmp	al,89
		sjb	kisbetu
		sjmp	specjel

wchr:		or	al,al
		sjz	szokoz
		cmp	al,101
		sje	ponpon
		cmp	al,112
		sjae	vezerl
veztov:		test	owan,8
		push	ax
		sjnz	soriab
		push	si
		mov	ah,utolso
		mov	si,holtart
		push	ax
		mov	al,wrbit
		and	ax,63
		sjz	sempont
		mov	wrbit,192
		dec	ax
		mov	al,101
		sjz	egypont
		mov	al,108
		mov	kispuf[si],al
		inc	si
		inc	ax
egypont:	mov	kispuf[si],al
		inc	si
sempont:	test	wrbit,128
		pop	ax
		sjz	ell1
		test	nrbit,128
		sjnz	ell0
		cmp	al,114
		sjae	lyel
		cmp	al,81
		sjae	ell2
lyel:		and	wrbit,127
		cmp	al,71
		sjae	kisbetu
		cmp	al,36
		sjae	nagybetu
		add	al,35
nagybetu:	cmp	ah,71
		sjae	kisbetu
		cmp	ah,36
		sjb	specjel
kisbetu:	cmp	ah,93
		sjb	jel
		cmp	al,113
sjael:		sjae	jel
specjel:	cmp	ah,113
		sje	jel
		cmp	ah,89
		sjb	mehet
		cmp	ah,93
		sjb	jel
mehet:		push	ax
		ncall	space
		pop	ax
jel:		test	wrbit,64
		sjz	jejel
		and	wrbit,191
		test	nrbit,64
		sjnz	nrspc
		cmp	al,114
		sjae	jajel
		cmp	al,98
		sjae	jejel
		cmp	al,85
		sje	jejel
jajel:		mov	kispuf[si],0
		inc	si
		cmp	al,81
		sjne	jejel
		mov	kispuf[si],92
		mov	al,98
		inc	si
jejel:		cmp	al,101
		sjb	jejejel
		cmp	ah,101
		sjb	jejejel
		cmp	al,105
		sjae	jejejel
		cmp	ah,107
		sjb	wissza
jejejel:	mov	kispuf[si],al
		mov	utolso,al
		inc	si
		cmp	al,113
		sje	kiiras
		cmp	al,91
		sjb	krell
		sje	nagyjon
		cmp	al,99
		sje	krell
		cmp	al,101
		sje	nagyjon
		cmp	al,105
		sjb	kisjon
		cmp	al,107
		sje	krell
		cmp	al,110
		sjae	krell
nagyjon:	or	wrbit,128
		sjmp	krell
nrspc:		and	nrbit,191
		sjmp	jejel
kisjon:		and	wrbit,127
krell:		cmp	si,wmeret-4
		sjb	wissza
kiiras:		push	bx
		push	cx
		push	di
		mov	cx,si
		push	es
		mov	si,offset kispuf
		test	tewan,4
		sjnz	stawri
		ncall	write
stissza:	pop	es
		pop	di
		xor	si,si
		pop	cx
		pop	bx
wissza:		mov	holtart,si
		pop	si
		pop	ax
		ret

kozvet:		njmp	veztov
nvezerl:	test	kwan,16
		sjnz	kozvet
		or	al,al
		sjs	kozvet
		cmp	al,114
		sjne	vnenkis
		or	nrbit,128
		and	owan,247
vnenkis:	cmp	al,115
		sjne	vnenspc
		or	nrbit,64
vnenspc:	cmp	al,116
		sjne	vnorj
		push	ax
		mov	al,owan
		test	al,1
		sjz	norj
		test	al,4
		sjnz	norj
		test	al,2
		sjnz	orj
		test	al,64+128
		sjnz	norj
orj:		test	tewan,4
		sjnz	norj
		test	nrbit,128
		sjnz	norj
		or	owan,8
norj:		pop	ax
		or	wrbit,128
vnorj:		cmp	al,127
		sjne	vezt
		or	kwan,16
vezt:		ret

stawri:		jcxz	ntissza
		push	ds
		mov	al,puffer
		and	ax,3
		mov	bx,ax
		pop	es
		add	bx,bx
		mov	ax,dszcim[bx+10]
		mov	di,dhossz[bx+10]
		add	ax,di
		xchg	ax,di
		neg	ax
		add	ax,bhmax
		sjz	ntissza
		sjs	ntissza
		cmp	cx,ax
		sjbe	stalc
		xchg	ax,cx
stalc:		add	dhossz[bx+10],cx
stalp:		lodsb
		cmp	al,112
		sjb	statv
		xor	al,al
statv:		stosb
		loop	stalp
		mov	si,wr ablak
		and	si,3
		mov	al,pufabl[si]
		and	ax,3
		add	ax,ax
		cmp	ax,bx
		sjne	ntissza
		or	br output,32
ntissza:	njmp	stissza
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
write:		jcxz	wcend
		ncall	felszab
		push	di
		push	cx
		shr	cx,1
		sjnc	wcicc
		movsb
wcicc:		test	mode,8
		sjnz	w386
		rep	movsw
		sjmp	wctov
w386:		shr	cx,1
		sjnc	wcicc2
		movsw
wcicc2:		rep	movsd
wctov:		pop	cx
		mov	pnnen[bx],di
		sub	pszab[bx],cx
		mov	al,113
		pop	di
		add	pkrit[bx],cx
		repne	scasb
		sje	ujbek
		mov	ax,pkrit[bx]
		cmp	ax,pkmax
		sjb	wcend
ujbek:		mov	ax,pnnen[bx]
		mov	pvege[bx],ax
		xor	ax,ax
		mov	pkrit[bx],ax
		mov	al,puffer
		mov	si,ax
		shr	bx,1
		and	pfadat[si],251
		mov	si,3
wcikl:		mov	al,pufabl[si]
		test	al,4
		sjz	wcikok
		mov	al,4
		sjmp	wcikokk
wcikok:		and	al,3
wcikokk:	cmp	al,bl
		sjne	wcitov
		and	alabl[si],251
		test	alabl[si],8
		sjnz	wcitov
		or	alabl[si],2
wcitov:		dec	si
		sjns	wcikl
wcend:		ret
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
clrp:		call	clrpuf
		pop	ax
		pop	cx
		ret

felszab:	push	si
		push	cx		;	A sz”vegpufferban felszabad¡t
		push	ax		;	CX db. byte-ot, a be¡rand¢
		mov	ax,cx		;	sz”vegek sz m ra. Ut na:
		mov	bl,puffer	;	ES:DI = az els“ szabad byte
		xor	bh,bh		;	c¡me, BX = puffersorsz m SHL 1.
		add	bx,bx
		mov	es,pseg[bx+2]
		cmp	bx,8
		mov	pseg,es
		mov	di,pnnen[bx]
		sja	felvex
		cmp	ax,pmeret
		sjae	clrp
		sub	ax,pszab[bx]
		sjbe	felvex
		shr	bx,1
		and	pfadat[bx],251
		add	bx,bx
		or	ch,ch
		sjnz	felmer
		inc	ah
felmer:		xchg	bl,bh
		cmp	ax,sortab[bx]
		sjae	felmer2
		mov	ax,sortab[bx]
		dec	ax
felmer2:	xchg	bl,bh
		mov	si,ax
		mov	cx,pvege[bx]
		mov	di,ax
		sub	cx,di
		sja	elszab
		mov	pvege[bx],di
		sjmp	lszab
elszab:		mov	al,113
		repne	scasb
		sje	lszab
		mov	di,si
lszab:		mov	cx,pnnen[bx]
		sub	pvege[bx],di
		sub	cx,di
		mov	si,di
		xor	di,di
		shr	cx,1
		push	ds
		push	es
		mov	al,mode
		pop	ds
		sjnc	szab
		movsb
szab:		test	al,8
		sjnz	szab386
		rep	movsw
		sjmp	szabtov
szab386:	shr	cx,1
		sjnc	szabmas
		movsw
szabmas:	rep	movsd
szabtov:	pop	ds
		mov	pnnen[bx],di
felvex:		ncall	pksub
		mov	ax,di
		sub	ax,pvege[bx]
		mov	pkrit[bx],ax
		mov	ax,pmeret
		sub	ax,di
		mov	pszab[bx],ax
		pop	ax
		pop	cx
		pop	si
		ret
		
pksub:		shr	bx,1
		test	pfadat[bx],16
		sjnz	pknem
		mov	si,3
		or	pfadat[bx],16
pscikl:		mov	al,pufabl[si]
		test	al,4
		sjz	pscic
		mov	al,4
		sjmp	pscicc
pscic:		and	al,3
pscicc:		cmp	al,bl
		sjne	pstov
		mov	al,phany[bx]
		or	al,al
		sjz	szbtov
		sub	al,pksor[si]
		sjae	psaxlic
		mov	al,bh
psaxlic:	mov	pkend[si],al
pstov:		dec	si
		sjns	pscikl
szbtov:		add	bx,bx
		mov	ax,pvege[bx]
		mov	pvreg[bx],ax
		ret
pknem:		add	bx,bx
		ret
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
clrpuf		proc	far		;	Sz”vegpuffer t”rl‚se.
		push	si
		mov	bl,puffer
		mov	si,3
		and	bx,7
		test	bl,4
		sjz	psusi
		mov	bl,4
psusi:		;cmp	bx,si
		;sja	nemclr
pusic:		mov	al,pufabl[si]
		and	al,7
		test	al,4
		sjz	nsusi
		mov	al,4
nsusi:		cmp	bl,al
		sjne	nepus
		mov	pksor[si],bh
		mov	eltolas[si],bh
		mov	scroll[si],bh
		mov	tovabb[si],bh
		mov	tszaml[si],bh
		and	pufabl[si],223
		test	alabl[si],1
		mov	alabl[si],36
		sjz	nepus
		or	mode,128
nepus:		dec	si
		sjns	pusic
		and	pfadat[bx],241
		mov	phany[bx],bh
		add	bx,bx
		inc	si
		cmp	bl,8
		mov	ax,pmeret
		sjne	sushi
		mov	ax,jmeret
sushi:		mov	pvege[bx],si
		mov	pnnen[bx],si
		mov	pkrit[bx],si
		mov	pszab[bx],ax
nemclr:		pop	si
		ret
clrpuf		endp
;------------------------------------------------------------------------------




;**********************************

trilla:		push	es
		pushad
		mov	si,offset vegszo
		jcxz	trilip
		push	ds
		pop	es
		mov	di,offset vesa
		push	cx
		push	di
		add	cx,cx
		rep	movsd
		pop	si
		pop	cx
		push	cx
filip:		push	cx
		lodsw
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		lodsw
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		lodsw
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		lodsw
		push	si
		xchg	ax,bx
		mov	ax,-9
		ncall	nyers
		call	wstring
		xor	al,al
		call	wchar
		pop	si
		pop	cx
		loop	filip

;		call	pont

		mov	al,108
		call	wchar
		mov	al,109
		call	wchar

		pop	cx
		push	ds
		pop	es
		mov	si,offset vesa
		mov	di,offset vegszo
		add	cx,cx
		rep	movsd
trilip:		popad
		pop	es
		ret

drilla:		push	es
		pushad
		mov	bx,di
		mov	ax,-9
		ncall	nyers
		call	wstring
		call	pont
		popad
		pop	es
		ret

srilla:		push	ds
		push	es
		pushad
		mov	ax,adat
		mov	bx,si
		mov	ds,ax
		mov	ax,-9
		ncall	nyers
		call	wstring
		call	pont
		popad
		pop	es
		pop	ds
		ret


;**********************************





;------------------------------------------------------------------------------
wordrag		proc	far		;	AX. sz¢ BP. ragozott alakja.
		mov	cl,conan	;	(Sz mn‚v: AX/BX/DX !!!)
		and	own,254
		mov	ch,brown
		and	brown,31
		or	ax,ax		;	CF = 1: neml‚tez“ sz¢!
		push	cx
		sjz	enye		;	AX = 0...16383 => szavak,
		sjs	nyeny		;	16384,..32511 => uez rag n‚lk.
		cmp	ah,64		;	-256...-1 => spec. sz¢,
		sjb	nyuny		;	32512...32767 => uez rag n‚lk.
		cmp	ah,127		;	32768...49151 => szavak egybe,
		sje	henye		;	49152...64767 => uez rag n‚lk.
genye:		and	ah,63		;	-512...-255 => spec. sz¢ egybe,
		sjmp	enye		;	-768...-511 => uez rag n‚lk.
nyeny:		cmp	ah,255
		sje	nyuny
		and	ah,127
		or	own,1
		cmp	ah,64
		sjb	nyuny
		cmp	ah,125
		sjb	genye
henye:		mov	ah,255
		sjne	nyuny
enye:		xor	bp,bp
nyuny:		test	ch,16
		sjz	roun
		test	ch,8
		sjnz	nioun
		and	ch,231
		or	dx,dx
		sjnz	szavs
		cmp	bx,hatar
		sjb	roun
szavs:		or	ch,8
roun:		cmp	ax,-16
		sjb	nioun
		cmp	al,-8
		sjae	ioun
		add	al,8
		xor	dx,dx
ioun:		cmp	al,-2
		sjae	icsk
		mov	al,-8
		sjmp	nicsk
icsk:		mov	al,-2
nicsk:		test	ch,8
		sjz	nioun
		inc	ax
nioun:		or	conan,64
		test	bp,0001111111111111b
		sjz	heket
		or	ax,ax
		mov	cx,bp
		sjs	beket
		cmp	ax,78
		sja	heket
		sje	beket
		cmp	al,68
		sje	beket
		cmp	al,12
		sje	netzet
		cmp	al,2
		sjne	heket
netzet:		add	al,66
beket:		add	cx,cx
		test	ch,16
		sjnz	heket
		and	ch,15
		sjnz	sbirt
		or	cl,cl
		sjs	heket
		and	cl,63*2
		cmp	cl,20*2
		sje	fasirt
		cmp	cl,46*2
		sje	fasirt
		cmp	cl,53*2
		sjne	heket
		sjmp	fasirt
sbirt:		cmp	ch,12
		sje	fasirt
		cmp	ch,7
		sjb	heket
		cmp	ch,10
		sja	heket
fasirt:		and	conan,191
		or	ax,ax
		sjs	jeket
		sub	al,66
heket:		or	ax,ax
		sjns	seket
jeket:		push	ax
		mov	al,conan
		mov	ah,ucsan
		and	ax,64*(1+256)
		cmp	al,ah
		mov	ax,-1
		sje	ceket
		mov	ucsorag,ax
		mov	aktszo,ax
ceket:		pop	ax
seket:		push	bp
		ncall	enteo
		cmp	ax,309
		pop	si
		mov	cx,bp
		mov	abbath,ax
		mov	sabbath,0
		sjae	jahun
		cmp	ax,300
		sjb	secet
		and	cx,127+15*256
		cmp	ch,8
		sjne	cecet
cecee:		add	al,18
		sjmp	bahun
cecet:		cmp	ch,12
		sjne	mecet
		add	al,27
bahun:		and	bp,1110000000111111b
jahun:		njmp	nahun
secet:		njmp	ecet
mecet:		cmp	cl,64
		sjae	cecee
		or	cl,cl
		sjz	bahun
		add	al,9
		and	bp,1110000000000000b
		cmp	cl,targyrag
		sje	jahun
		xchg	ax,si
		and	ax,128
		cmp	ah,angol
		sjne	menga
		mov	sabbath,ax
menga:		xor	al,al
		mov	ah,enrag[si-309]
		or	bp,ax
		xchg	ax,cx
		cmp	al,25
		sjae	ratvan
		cmp	al,12
		mov	si,4
		sje	ratman
		cmp	al,14
		sje	ratman
		cmp	al,17
		mov	si,15
		sje	ratman
		cmp	al,18
		sje	ratman
		cmp	al,20
		mov	si,3
		sjb	ratvan
ratman:		cbw
		or	bp,ax
		xchg	ax,si
ratvan:		cmp	al,60
		sjb	hatvan
		mov	al,2
hatvan:		cmp	al,29
		sjne	korott
		mov	al,72
korott:		cmp	ch,14
		sjne	nektek
		cmp	al,9
		sje	ektek
		cmp	al,13
		sjne	nektek
ektek:		or	bp,128
nektek:		cmp	ch,15
		sje	nekik
		cmp	ch,11
		sjne	neki
		cmp	al,8
		sje	hekki
		cmp	al,10
		sje	hekki
		cmp	al,11
		sje	hekki
nekik:		cmp	al,9
		sje	neki1
		cmp	al,13
		sjne	neki
		mov	al,8
neki1:		sub	al,19
neki2:		cmp	ch,15
		sjne	hekki
		or	bp,4096
hekki:		and	bp,1111000000111111b
neki:		cbw
		add	ax,191
sahun:		sjmp	nahun
ecet:		cmp	ax,167
sjahun:		sjae	nahun
		cmp	al,157
		sjb	nahun
		cmp	al,161
		sje	nahun
		cmp	al,163
		sje	nahun
		cmp	al,158
		sjne	mehun
		mov	al,161
		sjmp	nahun
mehun:		cmp	al,165
		sjne	mahun
		mov	al,163
		sjmp	nahun
mahun:		cmp	al,162
		sjae	nehun
		mov	al,160
		sjmp	nahun
nehun:		mov	al,162
nahun:		mov	cx,bp
		and	ch,00011111b
		test	szbyt,28
		sjz	igehun
		cmp	angol,0
		mov	si,offset fnhlytabl-8
		mov	di,offset fnhlytabv
		sje	anmag
		mov	si,offset fnalytabl-8
		mov	di,offset fnalytabv
anmag:		cmp	cx,64
		sjb	hun
		and	cl,11000000b
		sjmp	hun
igehun:		cmp	angol,0
		mov	si,offset ighlytabl-8
		mov	di,offset ighlytabv
		sje	angma
		mov	si,offset igalytabl-8
		mov	di,offset igalytabv
angma:		test	ch,00001111b
		sjz	hun
		and	cx,0000111100000000b
hun:		add	si,8
		cmp	si,di
		sjae	jehun
		cmp	ax,[si+4]
		sjne	hun
		cmp	cx,[si+6]
		sjne	hun
		lodsw
		cmp	di,offset fnhlytabv
		mov	si,[si]
		sje	fnhely
		cmp	di,offset fnalytabv
		sjne	ighely
fnhely:		and	bp,1110000000111111b
		cmp	cx,64
		sjb	beorp
		and	si,0001111111000000b
		sjmp	lyehun
beorp:		and	bp,1110000000000000b
		sjmp	lyehun
ighely:		and	bp,1111000011111111b
		test	ch,00001111b
		sjz	georp
		and	si,0000111100000000b
		sjmp	lyehun
georp:		and	bp,1111000000000000b
lyehun:		or	bp,si
jehun:		test	szbyt,28
		mov	harag,bp
		mov	cx,bp
		mov	si,bp
		sjz	nigell
		and	cx,63
		and	si,0001111111000000b
		sjz	jarom
		cmp	si,0000010010000000b	;	-f‚le-
		sje	nketts
		cmp	si,0000010100000000b	;	-fajta-
		sje	nketts
		cmp	si,0000011100000000b	;	-ka-
		sje	nketts
		cmp	si,0000011110000000b	;	-cska-
		sje	nketts
		cmp	si,0000101100000000b	;	-(j)a-
		sje	nketts
egyre:		cmp	si,ucsorag
		mov	di,sabbath
		sjne	nujrag
		cmp	ax,xktszo
		sjne	nujrag
		cmp	di,xabbath
		sjne	nujrag
		cmp	ax,-16
		sjb	neaktum
		cmp	al,-8
		sjae	reaktum
		xor	dx,dx
		add	al,8
reaktum:	cmp	bx,xktum
		sjne	nujrag
		cmp	dx,xktum+2
		sje	neaktum
nujrag:		mov	xktszo,ax
		mov	ucsorag,si
		mov	xktum,bx
		mov	xktum+2,dx
		mov	xabbath,di
		njmp	ujrag
nigell:		sjmp	igell
jarom:		sjmp	harom
nketts:		sjmp	ketts
neaktum:	push	ds
		mov	si,offset honnmas
		mov	di,hovamas
		xor	cx,cx
		pop	es
		ncall	qimpl
		mov	ax,bp
		movsw
		mov	dl,szbyt
		mov	bx,offset regszo
		and	al,63
		movsw
		test	dl,28
		mov	dh,xown
		movsw
		push	bx
		sjz	ittar
		cmp	al,targyrag
		sjne	nettar
		or	dh,4
		mov	xown,dh
nettar:		njmp	elrag
ittar:
		njmp	igelrag
ketts:		cmp	cl,20
		jcxz	negyre
		sjb	kegye
		cmp	cl,60
		sjb	negyre
kegye:		inc	si
negyre:		njmp	egyre
harom:		cmp	cl,2
		jcxz	negyre
		sjb	kette
		sja	negye
		inc	si
		inc	si
negye:		cmp	cl,17
		sje	kette
		cmp	cl,18
		sje	kette
		cmp	cl,20
		sjb	kegye
		cmp	cl,60
		sjb	negyre
		cmp	cl,61
		sje	kegye
kette:		inc	si
		sjmp	kegye
igell:		and	si,0000111100000000b
		or	si,8192
		njmp	egyre
ujrag:		mov	cl,conan
		mov	ucsan,cl
		mov	cx,bp
		and	cx,0000111110000000b
		cmp	cx,128
		sjne	weweny
		cmp	ax,-16
		sjb	weweh
		cmp	al,-8
		sjae	wertz
		add	al,8
		sjmp	dwertz
weweh:		cmp	ax,cx
		sjae	weweny
		mov	bx,ax
		mov	bl,szamertek[bx]
		or	bl,bl
		sjns	woke
		neg	bl
woke:		cmp	bl,100
		sjbe	dwertz
		cmp	bl,102
		sje	ezer
		cmp	bl,103
		sje	millio
		cmp	bl,104
		sje	milliard
		cmp	bl,105
		sjne	weweny
masfel:		mov	bl,1
		sjmp	dwertz
milliard:	test	mode,8
		mov	bx,51712
		mov	dx,15258
		sjz	weweny
		sjmp	hertz
millio:		mov	bx,16960
		mov	dx,15
		sjmp	hertz
ezer:		mov	bx,1000
dwertz:		xor	dx,dx
hertz:		mov	ax,-8
wertz:		and	bp,1111000001111111b
		cmp	al,-7
		mov	ucsorag,-1
		sjbe	weweny
		cmp	al,-2
		mov	al,-7
		sjne	weweny
		dec	ax
weweny:		mov	di,offset regszo
		cmp	br sabbath,0
		push	di
		push	bp
		push	ucsorag
		push	di
		sje	wers
		push	ax
		mov	ax,abbath
		cmp	al,low 305
		sjne	oook
		dec	ax
		dec	ax
oook:		ncall	nyers
		pop	ax
		sjc	wers
		pop	di
		push	ds
		pop	es
		rep	movsb
		push	di
wers:		ncall	nyers
		pop	di
		pop	ucsorag
		pop	bp
		sjc	wrosz
		push	ds
		shr	cx,1
		pop	es
		sjnc	womo
		movsb
womo:		mov	dl,szbyt
		rep	movsw
		ncall	utsmegh
		ncall	ximpl
		and	bp,8191+16384
		mov	al,attr
		sjmp	wrag
wnrag:		mov	ucsorag,-1
		njmp	nerrax
wrosz:		pop	di
		ret

wrag:		and	xown,240
		and	al,7
		test	bp,4096
		sjz	egsz
		or	xown,8
egsz:		test	dl,16
		mov	sjattr,al
		sjnz	wnrag
		test	dl,12
		mov	ax,bp
		sjnz	fnrag
		njmp	igerag
netta:		push	ax
		mov	ax,bp
		add	ax,ax
		and	ah,15
		mov	specr,ah
		pop	ax
		cbw
		sjmp	bretta
fnrag:		and	al,63
		test	ah,8
		mov	specr,ch
		sjz	netta
		and	ah,7
		test	ah,3
		sjz	eeee
		or	xown,2
bretta:		test	bp,64
		sjz	britta
eeee:		or	xown,1
britta:		cmp	al,targyrag
		sjne	etta
		or	xown,4
etta:		mov	cl,sjattr
		mov	al,utsbet
		mov	bx,utscim
		mov	dh,xown
		cmp	cl,3
		jcxz	nhetti
		sje	nhetti
		cmp	cl,4
		sjne	netti
		cmp	specr,1
		sje	betti
		sja	nhetti
		test	dh,2
		sjz	nhetti
		test	dh,8
		sjnz	betti
		cmp	ah,3
		sje	betti
		cmp	ah,7
		sjne	nhetti
betti:		cmp	al,7
		mov	al,1
		sjb	metti
		mov	al,9
metti:		mov	utsbet,al
		mov	[bx],al
thetti:		njmp	hetti
ttbell:		test	dh,2
		sjz	hirt
		cmp	cl,7
		sjae	cetti
		test	attr,32
		sjz	cetti
		cmp	ah,3
		sje	chetti
		cmp	ah,7
		sje	chetti
hirt:		test	dh,10
		mov	ax,bp
		sjnz	cetti
		test	dh,1
		sjnz	chetti
		and	al,63
		sjz	chetti
		cmp	al,2
		;sjbe	cetti
		sjb	cetti
		sja	aetti
		cmp	cl,2
		sjae	cetti
aetti:		cmp	al,17
		sje	cetti
		cmp	al,18
		sje	cetti
		cmp	al,60
		sje	cetti
		cmp	al,62
		sjae	cetti
chetti:		pop	ax
nhetti:		sjmp	thetti
netti:		push	ax
		mov	al,specr
		or	al,al
		sjz	ttbell
		cmp	al,14
		sje	chetti
		cmp	al,12
		sja	cetti
		cmp	al,6
		sje	cetti
		cmp	al,5
		sjae	chetti
		cmp	al,1
		sjne	cetti
		cmp	di,offset regszo+1
		sjne	cetti
		cmp	regszo,4
		mov	ax,31+8*256
		sjne	cetti
		stosw
		mov	ax,30*(1+256)
		mov	regszo,1
		stosw
		pop	ax
		njmp	amga
cetti:		pop	ax
zetti:		mov	si,di
tetti:		dec	si
		cmp	cl,7
		mov	al,[si]
		sje	spec7
		or	al,al
		sjz	nhetti
		cmp	al,89
		sjae	nhetti
		cmp	al,15
		sjae	tetti
		cmp	cl,2
		sjne	xetti
		;test	al,1
		;sjz	nhetti
		dec	si
		push	bx
		lodsb
		dec	di
		cmp	al,20
		mov	bx,1
		sjne	letti
		mov	[di][bx],al
		dec	si
		inc	bx
letti:		mov	al,[si][bx]
		cmp	si,di
		mov	[si],al
		sjae	yetti
		inc	si
		sjmp	letti
yetti:		pop	bx
		xor	cl,cl
		sjmp	zetti
xetti:		or	cl,cl
		sjnz	lenni
		cmp	wr [si+1],23+22*256
		sjne	nnhetti
lenni:		test	al,1
		sjnz	retti
		dec	br [si]
retti:		cmp	cl,5
		sjb	nnhetti
		sje	novtov
tetv:		cmp	al,14
		sjne	nemmuv
		cmp	br [si-1],24
		sjne	nemmuv
		inc	br [si]
novtov:		sjmp	lovtov
spec7:		cmp	br [si-1],21
		sje	borja
		test	bp,0001111110000000b
		sjz	hetti
borja:		cmp	al,6
		sje	sp0007
		cmp	al,21
		sjne	bond
		test	dh,2
		sjz	hetti
		test	dh,8
		sjnz	hetti
		mov	utsbet,2
sp007:		dec	di
nnhetti:	sjmp	hetti
sp0007:		mov	utsbet,36+128
		sjmp	sp007
bond:		test	dh,2
		sjz	hetti
		cmp	al,15
		sjb	atya
		test	dl,64
		mov	al,1
		sjz	batya
		mov	al,9
batya:		inc	si
		stosb
atya:		or	brown,128
		cmp	ah,3
		sje	anya
		cmp	ah,7
		sjne	anyam
anya:		test	dh,8
		sjnz	anyam
		cmp	utsbet,40
		sjne	sp0007
		mov	si,16+29*256
		inc	di
		mov	[di-3],si
		sjmp	sp0007
anyam:		inc	br [si]
		mov	utsbet,2
		sjmp	hetti
nemmuv:		and	al,7
		sub	br [si],2
		cmp	al,4
		sje	lovtov
		mov	di,si
lovtov:		mov	al,31
		stosb
		push	ax
		ncall	cutsmegh
		pop	ax
hetti:		cmp	ch,specr
		sje	amiga
		cmp	sjattr,3
		mov	al,81
		sjne	elga
		mov	sjattr,ch
		mov	utsbet,al
		stosb
elga:		ncall	szamkhja
		sjc	malga
		mov	al,specr
		cmp	al,1
		sje	alga
		cmp	al,7
		sjb	almga
		;cmp	al,10
		;sje	almga
		cmp	al,11
		sje	almga
		cmp	al,12
		sjbe	alga
almga:		mov	al,utsbet
		cmp	al,34
		sje	alga
		cmp	al,15
		sjae	malga
		test	al,1
		sjz	alga
		test	al,4
		sjnz	alga
		;cmp	sjattr,4
		;sje	alga
		inc	br [bx]
		sjmp	alga
amiga:		njmp	amga
malga:		mov	al,specr
		cmp	al,6
		mov	cl,al
		sje	algax
		cmp	al,5
		sje	alga
		cmp	al,10
		sje	alga
		cmp	al,11
		sje	alga
		cmp	al,12
		sje	alga
		cmp	al,14
		mov	al,kthang
		sje	alga
		and	al,63
		cmp	al,11
		sjne	naooe
		cmp	cl,3
		sjb	naooe
		cmp	cl,5
		sja	naooe
		mov	al,9
naooe:		stosb
alga:		mov	al,specr
		cmp	al,2
		sjne	welga
		cmp	nktszo,68
		sje	kelga
		cmp	nktszo,78
		sjne	melga
kelga:		mov	br [di-1],9
welga:		or	brown,128
melga:		cmp	al,6
		mov	cl,al
		sjne	algax
		mov	al,21
		stosb
algax:		or	cl,cl
		mov	al,specr
		mov	si,offset spragl
		mov	bl,cl
		sjz	enga
		cmp	al,7
		sjb	marcha
		cmp	al,9
		sja	marcha
		or	brown,64
marcha:		dec	cx
		mov	sjattr,ch
		sjz	changa
clanga:		inc	si
		cmp	ch,[si-1]
		sjne	clanga
		loop	clanga
		cmp	bl,7
		mov	al,[si]
		mov	bx,nktszo
		sje	caxxa
		cmp	al,25
		sje	caxxa
		cmp	al,18
		sjne	changa
caxxa:		cmp	bx,164
		sjae	changa
		cmp	bl,160
		sjb	changa
		dec	di
		cmp	br [si+1],34
		sje	czanga
		cmp	al,25
		sje	changa
		cmp	al,29
		sje	changa
enga:		sje	cenga
czanga:		stosb
changa:		push	ax
		mov	al,specr
		cmp	al,5
		mov	ah,38
		sje	linga
		cmp	al,7
		mov	ah,41
		sjne	clhanga
linga:		mov	al,utsbet
		test	al,64
		sjnz	clhanga
		push	ax
		and	al,63
		cmp	al,ah
		pop	ax
		sjne	clhanga
		dec	di
		or	al,al
		sjns	clhanga
		dec	di
clhanga:	mov	al,[si]
		dec	di
		mov	ah,al
		dec	di
		scasw
		sjne	alhanga
		test	ksbyt,32
		mov	al,81
		sjz	kanga
		stosb
kanga:		inc	si
alhanga:	pop	ax
lhanga:		cmp	ch,[si]
cenga:		sje	canga
		test	dl,64
		lodsb
		sjz	calac
		cmp	al,1
		sje	calval
		cmp	al,2
		sje	calval
		cmp	al,6
		sjne	calac
calval:		cmp	specr,10
		sjne	calmac
		or	brown,32
		sjmp	calac
calmac:		or	al,8
calac:		cmp	si,offset talan+2
		sjne	malac
		cmp	br [di-2],15
		sjb	nalac
malac:		cmp	al,7
		sjne	alex
		dec	di
		scasb
		sje	nalac
alex:		stosb
nalac:		sjmp	lhanga
nnmga:		njmp	nemga2
canga:		push	ax
		ncall	cutsmegh
		pop	ax
amga:		test	dh,10
		mov	al,utsbet
		sjz	nnmga
		cmp	sjattr,3
		mov	bx,utscim
		sje	nsnegga
		ncall	szamkhja
		sjc	nmegga
		cmp	al,34
		sje	emga
		cmp	al,15
		sjae	nmegga
		test	al,1
		sjz	emga
		test	al,4
		sjnz	emga
		cmp	sjattr,4
		sje	emga
		inc	br [bx]
emga:		test	dh,2
		mov	al,specr
		sjnz	gmk
		or	al,al
		sjz	mghx
		cmp	al,9
		sjae	mghx
		test	brown,64
		mov	al,9
		sjnz	boekh
		test	dl,64
		sjnz	boekh
		mov	al,1
		sjmp	boekh
nsnegga:	sjmp	snegga
nmegga:		njmp	megga
mghx:		sjmp	mghk
gmk:		test	dh,8
		sjz	nettb
aink:		cmp	ah,3
		mov	al,7
		sje	mghp
		cmp	al,ah
mghnk:		stosb
		sje	mghk
nettb:		cmp	ah,1
		mov	al,24
		sje	mghp
		cmp	ah,2
		mov	al,17
		sje	mghp
unk:		cmp	ah,5
		mov	al,25
		sje	mghnk
		cmp	ah,6
		mov	al,30
		sjne	nnitok
		stosb
gmbh:		mov	al,kthang
		and	al,63
		cmp	al,1
		sjne	eokh
		mov	al,3
eokh:		cmp	al,11
		sjne	oekh
		test	dh,8
		sjz	oekh
		mov	al,9
oekh:		test	brown,128
		sjz	boekh
		cmp	al,11
		sjne	coekh
		mov	al,9
coekh:		cmp	al,1
		sjne	boekh
		mov	al,3
boekh:		cmp	ch,specr
		sje	norekh
		cmp	specr,2
		sje	norekh
orekh:		or	brown,128
norekh:		stosb
mghk:		mov	al,22
mghp:		stosb
nigga:		njmp	nemga
nnitok:		sjmp	nitok
nygga:		or	brown,128
		sjmp	nigga
snegga:		mov	al,81
		mov	sjattr,ch
		stosb
megga:		mov	al,kthang
		and	al,63
		test	dh,2
		sjnz	birt
		cmp	specr,11
		sje	nygga
		cmp	al,9
		sjb	moekh
		test	brown,32
		sjz	oekh
		mov	al,3
		sjmp	oekh
moekh:		cmp	specr,4
		sjb	joekh
		cmp	specr,5
		sja	joekh
		and	brown,127
		mov	al,1
joekh:		test	brown,64
		sjz	oekh
		mov	al,9
oekh2:		sjmp	oekh
jaje:		test	attr,32
nitok:		mov	al,21
		sjz	njitok
		stosb
njitok:		test	dl,64
		pushf
		cmp	ah,7
		sje	juk
		popf
		mov	al,1
		sjz	mghp
		mov	al,9
		sjmp	mghp
nmga:		sjmp	nemga2
juk:		popf
		mov	al,5
		sjz	oekh2
		mov	al,13
		sjmp	oekh2
nenk:		test	bp,128
		sjz	tttb
		cmp	ah,6
		sje	ettb
tttb:		stosb
ettb:		njmp	nettb
birt:		test	dh,8+1
		sjnz	wirth
		test	ah,3
		sjz	wirth
		cmp	ah,3
		sjne	tirt
wirth:		or	brown,128
tirt:		test	dh,8
		sjnz	tbirt
		cmp	ah,3
		sje	jaje
		cmp	ah,7
		sje	jaje
		cmp	ah,5
		sjne	nenk
		test	dl,64
		mov	al,ah
		sjz	uunk
		mov	al,13
uunk:		stosb
		njmp	unk
tbirt:		test	bp,128
		sjnz	imim
		test	attr,32
		mov	al,21
		sjz	sija
		stosb
sija:		test	dl,64
		mov	al,1
		sjz	alac
		mov	al,9
alac:		stosb
imim:		njmp	aink
nemga:		push	ax
		ncall	cutsmegh
		pop	ax
nemga2:		test	dh,1
		mov	bx,bp
		mov	al,utsbet
		pushf
		sjnz	tuts
		and	bl,63
		sjz	xemga
		cmp	bl,60
		sjae	tuts
		cmp	bl,25
		sjae	xemga
tuts:		cmp	sjattr,3
		sjne	puts
		mov	al,81
		mov	sjattr,ch
		stosb
puts:		ncall	szamkhja
		sjc	xemga
		popf
		pushf
		sjnz	xuts
		cmp	bl,60
		sjae	xuts
		cmp	bl,20
		sjae	xemga
xuts:		cmp	al,15
		mov	bx,utscim
		sjae	xemga
		test	al,1
		sjz	xemga
		test	al,4
		sjnz	xemga
		;cmp	sjattr,4
		;sje	xemga
		inc	br [bx]
xemga:		popf
		mov	al,10
		sjz	neee
		stosb
		cmp	ah,4
		mov	al,7
		sjne	neee
		stosb
neee:		ncall	cutsmegh
		ncall	ximpl
		lea	si,[di-6]
		mov	wordend,di
		mov	di,offset honnmas
		cmp	si,offset regszo
		mov	ax,bp
		sjae	mommas
		mov	si,offset regszo
mommas:		mov	hovamas,si
		movsw
		movsw
		movsw
elrag:		and	ax,63
		mov	di,wordend
		mov	bx,utscim
		mov	cx,ax
		sjz	serrax
		cmp	al,21
		sjb	sragad
		cmp	al,60
		sjae	sragax
		push	ax
		push	nktszo
		mov	dh,ksbyt
		push	dx
		push	di
		push	bp
		add	ax,191
		push	ucsorag
		ncall	nyers
		pop	ucsorag
		pop	bp
		pop	di
		pop	dx
		test	bp,0001111111000000b
		pop	bx
		pop	ax
		mov	nktszo,bx
		sjnz	rendes
		cmp	bx,164
		sjae	rendes
		cmp	bl,160
		sjb	rendes
		cmp	br [si],15
		sjb	remma
		dec	di
		cmp	al,46
		sje	rupla
		cmp	al,53
		sje	rupla
		cmp	al,55
		sje	remma
		cmp	al,56
		sje	remma
		cmp	al,58
		sje	remma
		cmp	al,59
		sje	remma
		cmp	al,25
		sjae	remma
rupla:		mov	al,[si]
		stosb
		sjmp	remma
serrax:		sjmp	errax
sragad:		sjmp	ragad
sragax:		sjmp	ragax
rendes:		cmp	al,25
		sjb	remma
		cmp	al,46
		sje	rymma
		cmp	al,53
		sje	rymma
		cmp	al,55
		sje	rymma
		cmp	al,56
		sje	rymma
		cmp	al,58
		sje	rymma
		cmp	al,59
		sjne	nymma
rymma:		cmp	bx,128
		sjae	nymma
		test	bp,0001111111000000b
		sjz	remma
nymma:		xor	al,al
ymma:		stosb
remma:		mov	al,[si]
		dec	di
		mov	ah,al
		dec	di
		scasw
		jcxz	errax
		sjne	makk
		test	dh,32
		mov	al,81
		sjnz	ymma
		dec	cx
		inc	si
makk:		shr	cx,1
		sjnc	emma
		movsb
emma:		rep	movsw
errax:		njmp	nerrax
ragax:		sub	cl,4
ragad:		mov	si,offset fnraglist
		sjmp	lepra
rapla:		inc	si
		cmp	ah,[si-1]
		sjne	rapla
lepra:		loop	rapla
		ncall	szamkhya
		mov	ah,utsbet
		sjc	nekkot
		cmp	sjattr,3
		sjne	nekkot
		mov	ah,81
		mov	[di],ah
		inc	di
nekkot:		mov	bl,al
		mov	al,kthang
		mov	bh,al
		and	al,63
		and	bh,128
		test	brown,128
		sjz	firhang
		cmp	al,1
		sjne	alhang
		mov	al,3
		sjmp	firhang
alhang:		cmp	al,11
		sjne	firhang
		mov	al,9
firhang:	cmp	bl,2
		mov	onhang,ch
		sje	onen
		cmp	bl,11
		sje	onen
		cmp	bl,20
		sje	onen
		cmp	bl,60
		sje	onen
		cmp	bl,62
		sjb	orhan
		sja	onen
		cmp	al,3
		sjne	nenno
		mov	al,1
nenno:		cmp	al,11
		sjne	orhan
		mov	al,9
		sjmp	orhan
onen:		push	di
onker:		dec	di
		cmp	ch,[di]
		sje	onnop
		cmp	br [di],81
		sje	onker
		cmp	br [di],89
		sjae	onnop
		cmp	br [di],15
		sjae	onker
		cmp	br [di],11
		sjb	onnop
		mov	onhang,11
onnop:		cmp	al,1
		pop	di
		sjne	orhan
		mov	al,3
orhan:		test	brown,96
		sjz	norhan
		test	brown,32
		sjz	zorhan
		cmp	al,9
		sjb	norhan
		mov	al,3
		sjmp	norhan
zorhan:		cmp	al,7
		sjae	norhan
		mov	al,9
norhan:		cmp	bl,2
		sjbe	kahha
		cmp	bl,17
		sje	kahha
		cmp	bl,18
		sje	kahha
		cmp	bl,60
		sjb	snekha
		cmp	bl,61
		sje	snekha
kahha:		ncall	szamkhya
		sjc	noshka
		cmp	bl,targyrag
		sjne	netha
		test	bp,0001111111000000b
		sjz	uretha
		test	bp,0001000001000000b
		sjnz	oretha
		cmp	specr,3
		sje	ekha
oretha:		cmp	al,3
		sje	sbetha
		cmp	al,11
		sjne	netha
sbetha:		dec	ax
		dec	ax
		sjmp	netha
uretha:		or	bh,bh
		sjs	snekha
netha:		cmp	bl,62
		sjne	ethan
		push	ax
		test	bp,0001111111000000b
		mov	ax,nktszo
		push	bx
		sjnz	nyikhaj
		or	ah,ah
		mov	bx,12
		sjnz	nyikhaj
nyilp:		cmp	al,nyien[bx]
		sje	nyian
		dec	bx
		sjns	nyilp
		dec	ax
		sjnz	nyikhaj
		cmp	di,offset regszo+3
		mov	ax,9+17*256
		pop	bx
		sja	bikhaj
		stosw
		mov	ax,13+23*256
		stosw
		pop	ax
		njmp	nerrax
snekha:		sjmp	nekha
nyian:		dec	bx
		dec	bx
		mov	al,30
		sjns	nyix
		dec	br [di-2]
		stosw
nyix:		dec	bx
		mov	ax,25+34*256
		dec	bx
		pop	bx
		sjs	ketten
		stosw
		mov	al,7
		stosw
ketten:		pop	ax
		dec	di
noshka:		sjmp	oshka
nyikhaj:	pop	bx
bikhaj:		pop	ax
		cmp	ah,4
		sjb	nekha
		cmp	ah,9
ekha:		sje	nekha
		cmp	ah,10
		sjne	oshka
ethan:		cmp	ah,15
		sjb	nekha
		cmp	ah,34
		sje	nekha
oshka:		cmp	bl,2
		push	ax
		sje	soska
		cmp	bl,60
		sje	soska
		cmp	bl,63
		sjne	joska
soska:		cmp	ch,onhang
		sje	joska
		mov	al,onhang
joska:		stosb
		pop	ax
nekha:		mov	kthang,al
		cmp	nktszo,68
		mov	al,bl
		sjne	nketh
		cmp	al,14
		sjne	nketh
		test	bp,0001111111000000b
		sjnz	nketh
		dec	di
		mov	utsbet,30
		dec	di
nketh:		mov	bl,utsbet
		or	kthang,bh
		and	bx,63
		cmp	bl,45
		sjb	nephal
		mov	bl,dubbet[bx-45]
nephal:		mov	bh,bl
		mov	bl,al
		lodsb
		cmp	bl,14
		sjb	nalve
		cmp	bl,20
		sje	nalve
		cmp	bl,61
		sjae	nalve
		cmp	bl,16
		sja	valvel
		cmp	bh,15
		sjb	valvel
		cmp	bh,34
		sje	valvel
		mov	al,bh
		sjmp	valvel
nalve:		cmp	bl,3
		sjb	valvel
		cmp	nktszo,164
		sjae	valvel
		cmp	br nktszo,160
		sjb	valvel
		test	bp,0001111111000000b
		sjnz	valvel
		dec	di
		cmp	bl,20
		sje	eszter
		cmp	bl,61
		sjb	nesser
		dec	di
		cmp	bl,62
		sje	eszter
		sjb	igyugy
		dec	di
		cmp	br [di],9
		mov	al,7
		sje	ittott
		mov	al,3
ittott:		dec	si
		stosb
		sjmp	lekha2
igyugy:		cmp	br [di],9
		mov	al,8
		sje	gyugy
		mov	al,6
gyugy:		stosb
		mov	ax,19+34*256
		stosw
		njmp	nerrax
eszter:		mov	ax,25*257
		stosw
		mov	ax,34+7*256
		dec	si
		stosw
		cmp	bl,62
		mov	al,[di-5]
		sje	sekha
lekha2:		sjmp	lekha
nesser:		cmp	bl,12
		sjne	nemmig
		mov	al,17
		dec	si
nemmig:		stosb
valvel:		cmp	al,bh
		mov	bh,utsbet
		sjne	sekha
		and	bh,63
		cmp	al,bh
		sje	ukha
cukha:		cmp	br [di-1],81
		sje	alkha
		mov	br [di],81
		inc	di
alkha:		cmp	al,36
		sjb	sekha
		sjmp	hujra
ukha:		test	utsbet,128
		sjz	sympla
		test	utsbet,64
		sjnz	sympla
		test	ksbyt,32
		sjnz	cukha
		cmp	bl,3
		sjb	sekha
		sjmp	lekha
sympla:		cmp	al,36
		sjb	sekha
		cmp	br [di-1],81
		sje	hujra
		dec	di
		cmp	al,43
		sjne	hujra
		dec	di
hujra:		and	ax,63
		add	ax,ax
		mov	bx,ax
		mov	ax,wr dubchr[bx-36*2]
		stosb
		mov	al,ah
		cmp	al,36
		sjae	hujra
		stosb
lekha:		lodsb
sekha:		cmp	al,7
		sjae	stekha
		or	al,al
		sjz	nerrax
		cmp	al,3
		sjne	nakkha
		mov	al,onhang
		or	al,al
		sjnz	stekha
		mov	al,kthang
		and	al,63
		cmp	al,1
		sjne	stekha
		mov	al,3
		sjmp	stekha
nakkha:		test	brown,64
		sjnz	bakkha
		test	dl,64
		sjz	stekha
bakkha:		test	brown,32
		sjnz	stekha
		or	al,8
stekha:		stosb
		sjmp	lekha
nerrax:		test	bp,16384
		mov	ax,81+9*256
		sjz	nekkr
		stosw
nekkr:		pop	si
		mov	cx,di
		pop	ax
		mov	wr [di],128
		sub	cx,si
		mov	conan,al
		mov	brown,ah
		ret

igerag:		test	attr,4
		mov	cx,bp
		sjz	tugrik
		and	ch,00001110b
		cmp	ch,2*3
		sje	ugrik
		cmp	ch,2*4
		sje	ugrat
		cmp	ch,2*7
		sjne	tugrik
ugrat:		test	attr,64
		sjz	tugrik
ugrik:		ncall	bugri
tugrik:		mov	al,ah
		mov	dh,xown
		shr	al,1
		and	ax,7
		mov	cx,ax
		and	al,3
		sjz	nokhje
		cmp	al,3
		mov	si,di
		sje	nokhje
regla:		cmp	si,offset szavacska
		sje	regula
		cmp	si,offset vegszo
		sje	regula
		cmp	si,offset regszo
		sje	regula
		dec	si
		cmp	br [si],15
		sjae	regla
		inc	ah
		sjmp	regla
regula:		mov	al,kthang2
		and	al,63
		cmp	al,1
		sjne	reggh
		inc	ax
		inc	ax
reggh:		cmp	al,3
		sjne	xeggh
		ncall	xokjon
xeggh:		dec	ah
		sjnz	nokhje
		stosb
nokhje:		test	bp,256
		sjnz	okhje
		jcxz	cokhje
okhje:		cmp	cl,4
		sje	tat
		cmp	cl,7
		sjne	ntat
tat:		test	attr,64
		mov	al,30
		sjnz	ntat
		stosb
ntat:		mov	si,offset igraglist
		xor	ax,ax
		jcxz	xokhje
coxe:		lodsb
		add	si,ax
		loop	coxe
xokhje:		lodsb
		xchg	ax,cx
		jcxz	cokhje
xoxe:		lodsb
		cmp	al,7
		sjae	coke
		test	dl,64
		sjz	coke
		add	al,8
coke:		stosb
		loop	xoxe
		cmp	si,offset igraglist+4
		sjbe	cokhje
		test	bp,256
		sjnz	ntat
cokhje:		ncall	cutsmegh
		ncall	ximpl
		lea	si,[di-6]
		mov	wordend,di
		cmp	si,offset regszo
		mov	di,offset honnmas
		sjae	immas
		mov	si,offset regszo
immas:		mov	hovamas,si
		movsw
		movsw
		movsw
igelrag:	mov	ax,bp
		mov	di,wordend
		and	ah,16
		test	al,3
		sjz	xigelr
		test	al,12
		sjnz	rrax
		and	al,3
		sjmp	jelen
rrax:		test	al,8
		sjz	xigelr
		test	al,4
		sjz	xelen
		test	al,32
		sjnz	xelen
		and	al,247
		sjmp	xigelr
xelen:		and	al,239
jelen:		or	al,32
xigelr:		cmp	ch,angol
		mov	si,offset gratz
		sje	emmang
		mov	si,offset aratz
emmang:		cmp	si,offset gratzv
		sje	mmang
		cmp	si,offset aratzv
		sjae	mmang
		cmp	ax,[si]
		sje	mmagv
		inc	si
		inc	si
		sjmp	emmang
mmang:		test	al,3
		sjz	xerrax
		test	al,64
		sjz	cyrix
		and	al,191
		sjmp	xigelr
xerrax:		njmp	czerr
cyrix:		cmp	al,00100111b
		sjne	xerrax
		cmp	ch,angol
		mov	si,offset gratz
		sje	mmagv
		mov	si,offset aratz
mmagv:		mov	cx,si
		xor	ax,ax
		sub	cx,offset gratz
		sjb	xerrax
		shr	cx,1
		mov	si,offset igragz
		mov	bx,cx
		sjz	cerrax
		test	attr,8
		sjz	aglap
		cmp	bl,17
		sje	celef
		cmp	bl,20
		sje	celef
		cmp	bl,22
		sjne	aglap
celef:		inc	cx
		inc	bx
aglap:		cmp	bl,9
		mov	al,[di-1]
		sje	aleph
		cmp	bl,50
		sjne	glap
aleph:		cmp	al,29
		sje	alef
		cmp	al,35
		sje	alef
glap:		test	attr,128
		sjz	raglap
		cmp	bl,8
		mov	al,5
		sje	ikkok
		cmp	bl,49
		sjne	raglap
		inc	ax
ikkok:		test	bp,64
		sjnz	balef
		add	bl,al
alef:		test	bp,64
		sjnz	balef
		inc	bx
		mov	cx,bx
balef:		mov	bx,cx
raglap:		lodsb
		add	si,ax
		loop	raglap
cerrax:		test	attr,4
		sjz	nugrik
		test	attr,16
		mov	ax,bp
		sjnz	vankth
		or	bl,bl
		sjz	rubrik
		cmp	bl,8
		sjb	nugrik
		cmp	bl,9
		sje	nugrik
		cmp	bl,12
		sje	nugrik
		cmp	bl,13
		sje	nugrik
		cmp	bl,77
		sjb	vankth
		cmp	bl,91
		sjb	nugrik
vankth:		cmp	bl,15
		sje	nugrik
		cmp	bl,17
		sje	nugrik
		cmp	bl,19
		sje	nugrik
		cmp	bl,20
		sje	nugrik
		cmp	bl,22
		sje	nugrik
		cmp	bl,62
		sjb	rubrik
		cmp	bl,77
		sjb	nugrik
		cmp	bl,94
		sjb	rubrik
		cmp	bl,97
		sjb	nugrik
		cmp	bl,100
		sje	nugrik
		cmp	bl,105
		sje	nugrik
rubrik:		and	ax,0001111110111111b
		sjz	nugrik
		cmp	ax,0000000000100111b
		sjne	bugrik
		test	attr,128
		sjz	nugrik
bugrik:		test	ah,00001111b
		sjnz	nugrik
		ncall	bugri
nugrik:		mov	cl,[si]
		mov	ax,bp
		inc	si
		test	al,3
		sjz	zefsz
		and	al,12
		cmp	al,8
		mov	al,attr
		sjne	nefsz
		and	al,3
		cmp	al,1
		sjne	hess
		dec	br [di-1]
hess:		cmp	al,2
		sjne	fess
		dec	di
fess:		cmp	br [di-1],30
		mov	al,29
		sjne	efsz
		cmp	bl,71
		stosb
		sje	efsz
		dec	cx
		inc	si
efsz:		cmp	br [si],21
		mov	al,[di-1]
		sjne	nefsz
		cmp	al,29
		sje	xefsz
		cmp	al,35
		sjne	nefsz
xefsz:		stosb
		dec	cx
		mov	al,[di-3]
		inc	si
		cmp	al,16
		sje	mefsz
		cmp	al,17
		sje	mefsz
		cmp	al,29
		sje	mefsz
		cmp	al,35
		sjne	nefsz
mefsz:		mov	[di-2],al
nefsz:		cmp	bl,8
		sje	elaph
		cmp	bl,10
		sje	elaph
		cmp	bl,14
		sje	elaph
		cmp	bl,16
		sjne	zefsz
elaph:		mov	al,kthang
		and	al,63
		cmp	al,1
		sjne	paph
		inc	ax
		inc	ax
paph:		ncall	lokjon
		stosb
zefsz:		cmp	bl,24
		mov	ah,[di-2]
		sjb	yefsz
		cmp	bl,36
		mov	al,[di-1]
		sjae	yefsz
		cmp	al,15
		sjb	yefsz
		cmp	bl,26
		sjne	tefsz
		cmp	al,23
		sje	lnr
		cmp	al,25
		sje	lnr
		cmp	al,28
		sjne	kofsz
lnr:		cmp	ah,25
		sje	kofsz
		test	attr,4
		sjnz	kofsz
yofsz:		inc	si
		dec	cx
		sjmp	yefsz
tefsz:		cmp	al,30
		sje	kofsz
		cmp	ax,29+35*256
		sje	sssz
		cmp	ax,35+29*256
		sje	sssz
		cmp	ax,19+25*256
		sje	sssz
		cmp	ax,17+25*256
		sjne	psssz
sssz:		mov	ah,[di-3]
psssz:		cmp	ah,15
		sjb	yofsz
kofsz:		mov	al,kthang
		and	al,63
		ncall	lokjon
		stosb
yefsz:		test	attr,16
		mov	bh,[si]
		sjz	nepph
		test	bp,0000111100000000b
		mov	al,kthang
		sjnz	nepph
		and	al,63
		cmp	al,3
		sjne	stepph
		dec	ax
		dec	ax
stepph:		cmp	bl,12
		sjne	reph
		cmp	al,1
		sjne	apph
		inc	ax
		inc	ax
apph:		sjmp	epph
lepph:		test	attr,4
		sjz	epph
		sjmp	nepph
reph:		cmp	bl,15
		sje	lepph
		cmp	bh,25
		sje	epph
		cmp	bh,29
		sjne	nepph
epph:		cmp	al,11
		sjne	srepph
		dec	ax
		dec	ax
srepph:		stosb
nepph:		mov	al,[di-1]
		cmp	al,29
		sje	creph
		cmp	al,35
		sjne	nreph
creph:		cmp	bl,17
		sje	breph
		cmp	bl,19
		sje	breph
		cmp	bl,20
		sje	breph
		cmp	bl,22
		sjne	nreph
breph:		stosb
		dec	cx
		mov	al,[di-3]
		inc	si
		cmp	al,16
		sje	xreph
		cmp	al,17
		sje	xreph
		cmp	al,29
		sje	xreph
		cmp	al,35
		sjne	nreph
xreph:		mov	[di-2],al
nreph:

		jcxz	czerr
raklap:		lodsb
		cmp	al,7
		sjae	naglap
		test	dl,64
		sjz	naglap
		cmp	al,3
		sjne	ogopp
		mov	al,1
ogopp:		add	al,8
		cmp	bl,65
		sje	logla
		cmp	bl,2
		sje	logla
		cmp	bl,3
		sje	logla
		cmp	bl,6
		sje	logla
		cmp	bl,12
		sje	logla
		cmp	bl,92
		sje	logla
		cmp	bl,107
		sje	logla
		cmp	bl,103
		sjne	naglap
		cmp	cl,2
		sje	naglap
logla:		ncall	lokjon
naglap:		stosb
		loop	raklap
czerr:		mov	ax,bp
		and	ax,0001111110111111b
		cmp	ax,0000011000100111b
		sje	cirrax
		cmp	ax,0000011000000000b
		sje	cirrax
		test	attr,128
		sjz	cyrax
		cmp	ax,0000000000100111b
		sjne	cyrax
cirrax:		mov	wr [di],7+22*256
		inc	di
		inc	di
cyrax:		test	al,3
		sjz	terrax
		and	al,44
		cmp	al,12
		mov	ax,0+31*256
		sjne	terrax
		stosw
		mov	ax,3+23*256
		stosw
		mov	ax,25+1*256
		stosw
terrax:		njmp	nerrax
wordrag		endp

lokjon:		cmp	al,9
		sjne	lokje
xokjon:		push	di
lokjop:		dec	di
		cmp	br [di],15
		sjae	lokjop
		cmp	br [di],11
		pop	di
		sjb	lokje
		mov	al,11
lokje:		ret

bugri:		xor	cx,cx
buglop:		dec	di
		inc	cx
		cmp	br [di],15
		sjae	buglop
cuglof:		mov	al,[di+1]
		stosb
		loop	cuglof
		dec	di
		ret

szamkhya:	cmp	regszo,71
		push	ax
		sjb	szankhe
		cmp	regszo,80
		sja	czankhe
		test	bp,0001111111000000b
		mov	al,ntsbet
		sjnz	czankhe
		mov	utsbet,al
		sjmp	ankhe

szamkhja:	cmp	br [di-1],71
		push	ax
		sjb	szankhe
		cmp	br [di-1],80
		mov	ax,bp
		sja	czankhe
		mov	br [di],81
		inc	di
		test	ah,8
		sjnz	ankhe
		add	ax,ax
		and	ah,15
		cmp	ah,1
		sje	czankhe
		cmp	ah,5
		sjb	ankhe
		cmp	ah,12
		sjb	szankhe
ankhe:		mov	ax,aktum
		or	ax,aktum+2
		sjz	czankhe
szankhe:	cmc
czankhe:	pop	ax
		ret

enteo:		cmp	ax,350
		sjb	nyuxx
		ret
nyuxx:		cmp	ax,300
		sjb	nuyuxx
		cmp	al,low 336
		sjb	engem
		xchg	ax,bx
		mov	bl,bingo[bx-336]
		xchg	ax,bx
engem:		cmp	al,low 318
		sjb	sun
		test	bp,4096+1024
		pushf
		and	bp,1110000000111111b
		popf
		sjz	enyem
		or	bp,1024
enyem:		sub	al,18
		or	bp,2048
		cmp	al,low 309
		sjb	kun
		sub	al,9
		or	bp,1024
sun:		cmp	al,low 309
		sjb	kun
		sub	al,9
		test	bp,63
		sjnz	kun
		or	bp,targyrag
kun:		cmp	al,low 305
		mov	cx,bp
		sjae	ayux
		test	bp,4096
		sjz	ayux
		cmp	al,low 300
		sje	enux
		cmp	al,low 301
		mov	al,low 305
		sja	ayux
		mov	al,low 307
		sjmp	ayux
nuyuxx:		sjmp	nuyux
enux:		mov	al,low 306
ayux:		and	ch,11
		cmp	ch,8
		sjne	byux
		and	bp,1110111101111111b
		sjmp	nyulux
byux:		and	bp,1110000001111111b
		test	cl,64
		sjz	nyulux
		or	bp,2048
nyulux:		cmp	angol,0
		sjne	nyux
		cmp	ax,302
		sjne	nyux
		inc	ax
nyux:		ret
nuyux:		cmp	ax,178
		sjb	nyux
		cmp	ax,280
		sjae	nyux
		xchg	ax,si
		mov	ax,bp
		test	ah,8
		sjnz	girt
		test	ax,0000111111000000b
		sjnz	girny
		cmp	si,192
		sjbe	hozza
		cmp	si,199
		sje	hozza
		cmp	si,201
		sje	hozza
		cmp	si,202
		sjne	girny
hozza:		or	ah,3
		test	ah,16
		sjz	girt
		or	ah,4
girt:		mov	al,ah
		and	ax,7
		add	ax,ax
		xchg	ax,si
		test	bp,128
		mov	si,sonteo[si]
		xchg	ax,si
		sjz	firny
		cmp	al,low 302
		sjne	firny
		inc	ax
firny:		or	ax,ax
		sjnz	genny
girny:		mov	ax,si
		ret
genny:		and	bp,1110000000111111b
		test	bp,63
		sjnz	gyux
		cmp	si,193
		sjb	gyuluy
		cmp	si,251
		sjae	gyuluz
		sub	si,191
gyulux:		or	bp,si
gyux:		ret
gyuluy:		mov	si,wr codsyn1[si-178]
		sjmp	gyulum
gyuluz:		mov	si,wr codsyn2[si-251]
gyulum:		and	si,63
		sjmp	gyulux

wordwrt		proc	far
		call	wordrag
		sjc	seww
		jmp	wstring
seww:		ret
wordwrt		endp
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
clearlines	proc	far
		mov	wr wrbit,128	;	llapotsorok t”rl‚se.
		or	tewan,4
		;or	br output,32
		push	ds
		xor	ax,ax
		mov	cx,bhmax
		mov	di,offset all0
		pop	es
		rep	stosb
		inc	ax
		mov	dhossz+5*2,ax
		;ret
clearlines	endp

fourlines	proc	far
		mov	ax,dhossz+5*2	;	llapotsor t”bbsz”r”z‚se.
		or	br output,32
		mov	cx,bhmax
		push	ds
		mov	si,offset all0
		mov	dhossz+6*2,ax
		pop	es
		mov	dhossz+7*2,ax
		mov	di,offset all1
		mov	dhossz+8*2,ax
		push	cx
		rep	movsb
		pop	cx
		sub	si,cx
		push	cx
		rep	movsb
		pop	cx
		sub	si,cx
		rep	movsb
		ret
fourlines	endp 
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
biff:		cmp	al,asctabl[bx]
		sje	sniff
		inc	bx
		cmp	bl,112
		sjb	biff
sniff:		push	bx
		xchg	ax,bx
		ncall	hoffmann
		pop	dx

nstring		proc	far		;	Filen‚v ill. path ki¡r sa,
nstring		endp			;	csupa nagybet–vel, sz¢k”z”k
					;	n‚lkl... stb.
		lodsb
		xor	bx,bx
		or	al,al
		cbw
		sjnz	biff
		mov	al,83
		cmp	al,dl
		sje	jurgen
		cmp	dl,88
		sje	urgen
		cmp	dl,105
		sjae	urgen
		cmp	si,offset xesa
		sjb	urgen
		ncall	hoffmann
jurgen:		mov	si,offset advnev
		sjmp	nstring
urgen:		mov	wr wrbit,0
		retf

hoffmann:	push	si
		or	wrbit,128
		call	wchar
		mov	wr wrbit,128+64*256
		pop	si
		ret
;------------------------------------------------------------------------------

szoveg	ends
