
XLENFIL		EQU	012
XAKT		EQU	0C
XPZAZ		EQU	0D
XPUS		EQU	0F
XPEXT		EQU	011

INFBEG:
INFKV:		DEFW	0
INFKO:		DEFW	0
INFKC:		DEFW	0
INFPV:		DEFW	0
INFPO:		DEFW	0
INFPC:		DEFW	0
INFBV:		DEFW	0
INFBO:		DEFW	0
INFBC:		DEFW	0
INFEND:

XSTOPA:		DEFW	0
XSEKTOR:	DEFW	0
XSEKMAX:	DEFW	0
XPOR:		DEFB	0
XPOC:		DEFW	0
XFL2:		DEFB	0
XFL3:		DEFB	0
IXADRS:		DEFW	0
IXPOC:		DEFB	0

XWINFO1		EQU	051A
XWINFO2		EQU	01537
XINF1		EQU	2
XINF2		EQU	0B
XINF3		EQU	014
YINF		EQU	6

MREKL:		DEFB	1,1,2,1,'       (C) 1992 NIPSOFT       '
		DEFM	'                              '
		DEFM	'  Distrib'
		COND	CESKY
		DEFB	'u'
		ELSE	
		DEFB	0D5
		ENDC
		DEFM	'tor: mZx software   '
		DEFM	'               P.O. Box 83    '
		DEFM	'        370 04 ',0E3,'. Bud',0C5,'jovice  '
		DEFB	01E,KODVO
		DEFB	1,XINF1,2,YINF+2,'Disk '
MREKLD:		DEFB	'A:'
		DEFB	1,XINF2+6,2,YINF+1,'kB'
		DEFB	1,XINF2+6,2,YINF+2,'kB'
		DEFB	1,XINF2+6,2,YINF+3,'kB'
		COND	CESKY
		DEFB	1,XINF1,2,YINF+6,'Polo',0DA,'ek:'
		DEFB	1,XINF1,2,YINF+0A,0F5,'sek',0CA,':'
		ELSE
		DEFB	1,XINF1,2,YINF+6,'Polo',0DA,'iek:'
		DEFB	1,XINF1,2,YINF+0A,0F5,'sekov:'
		ENDC
		DEFB	0


XMDIR:		DEFM	'DIR'
		DEFB	0
XMSYS:		DEFM	'SYS'
		DEFB	0
XMHF1:		DEFB	1,1,2,1,KODDLH,0C,KODDVO,KODMH
		DEFB	KODDVO,KODDVO,KODMH
		DEFB	5,KODDVO,KODMH
		DEFB	3,KODDVO,KODMH
		DEFB	4,KODDVO,KODMH
		DEFB	3,KODDVO,KODMH
		DEFB	3,KODDVO,KODDPH
		DEFB	0
XMSF:		DEFB	1,1,KODDZV
		DEFB	1,0E,KODZV
		DEFB	1,011,KODZV
		DEFB	1,017,KODZV
		DEFB	1,01B,KODZV
		DEFB	1,020,KODZV
		DEFB	1,024,KODZV
		DEFB	1,028,KODDZV
		DEFB	0
		DEFB	KODML,0C,KODVO,KODKR
		DEFB	KODVO,KODVO,KODKR
		DEFB	5,KODVO,KODKR
		DEFB	3,KODVO,KODKR
		DEFB	4,KODVO,KODKR
		DEFB	3,KODVO,KODKR
		DEFB	3,KODVO,KODMP
		DEFB	0
XMHF2:		DEFB	1,2,2,2
		DEFM	'   N'
		DEFB	0C1
		DEFM	'z'
		COND	CESKY
		DEFM	'e'
		ELSE
		DEFM	'o'
		ENDC
		DEFM	'v    ',KODZV
		DEFB	'U',0DA,KODZV
		DEFB	'Z',0C1,'z','n','.',KODZV
		DEFM	'Pol',KODZV
		DEFM	' kB ',KODZV
		COND	CESKY
		DEFB	'P',0D2,0C9,KODZV,'T','y','p'
		ELSE
		DEFB	'Pr',0C9,KODZV,'T','y','p'
		ENDC
		DEFB	0

XMSF2:		DEFB	1,1,KODDZV
		DEFB	0C,' ',KODZV
		DEFB	'  ',KODZV
		DEFB	5,' ',KODZV
		DEFB	3,' ',KODZV
		DEFB	4,' ',KODZV
		DEFB	3,' ',KODZV
		DEFB	3,' ',KODDZV
		DEFB	0

XMHB1:		DEFB	1,1,2,1,KODDLH
		DEFB	0C,KODDVO,KODMH
		DEFB	0C,KODDVO,KODMH
		DEFB	0C,KODDVO,KODDPH
		DEFB	0
XMSB:		DEFB	1,1,KODDZV
		DEFB	1,0E,KODZV
		DEFB	1,01B,KODZV
		DEFB	1,028,KODDZV
		DEFB	0
		DEFB	KODML,0C,KODVO,KODKR
		DEFB	0C,KODVO,KODKR
		DEFB	0C,KODVO,KODMP
		DEFB	0
XMHB2:		DEFB	1,2,2,2
		COND	CESKY
		DEFB	3,' N',0C1,'zev'
		DEFB	8,' N',0C1,'zev'
		DEFB	8,' N',0C1,'zev',4,' '
		ELSE
		DEFB	3,' N',0C1,'zov'
		DEFB	8,' N',0C1,'zov'
		DEFB	8,' N',0C1,'zov',4,' '
		ENDC
		DEFB	0

XMSB2:		DEFB	1,1,KODDZV
		DEFB	0C,' ',KODZV
		DEFB	0C,' ',KODZV
		DEFB	0C,' ',KODDZV
		DEFB	0

XMDF:		DEFB	1,1,KODML
		DEFB	0C,KODVO,KODTD
		DEFB	KODVO,KODVO,KODTD
		DEFB	5,KODVO,KODTD
		DEFB	3,KODVO,KODTD
		DEFB	4,KODVO,KODTD
		DEFB	3,KODVO,KODTD
		DEFB	3,KODVO,KODMP
		DEFB	0
XMD:		DEFB	KODDZV,1,028,KODDZV
		DEFB	KODDLD,013,KODDVO,013,KODDVO
		DEFB	0
XMDB:		DEFB	1,1,KODML
		DEFB	0C,KODVO,KODTD
		DEFB	0C,KODVO,KODTD
		DEFB	0C,KODVO,KODMP
		DEFB	0

LODPTR:		LD	L,(IX+HOPTRAL-HOL)
		LD	H,(IX+HOPTRAL+1-HOL)
		RET
LODSUB:		LD	L,(IX+HOSUBAL-HOL)
		LD	H,(IX+HOSUBAL+1-HOL)
		RET

CMPFCB:		CALL	CMPUZIV
		RET	NZ
CMPSUB:		CALL	PUA
		LD	B,0B
		JR	CMPME1
CMPMENO:	CALL	PUA
		LD	B,08
CMPME1:		INC	DE
		INC	HL
CMPRET:		CALL	PUA
		EX	DE,HL
CMPRET1:	LD	A,(HL)
		AND	07F
		CALL	UPCASE
		CP	'?'
		JR	Z,CMPRET2
		LD	C,A
		LD	A,(DE)
		AND	07F
		CALL	UPCASE
		CP	'?'
		JR	Z,CMPRET2
		CP	C
		RET	NZ
CMPRET2:	INC	DE
		INC	HL
		DJNZ	CMPRET1
		RET

XCMP:		LD	A,(IX+HOSORTL-HOL)
		DEC	A
		JR	Z,XCMP1
		DEC	A
		JR	Z,XCMP2
		DEC	A
		JR	Z,XCMP3
		XOR	A
		RET
XCMP1:		CALL	CMPMENO
		RET	NZ
		CALL	CMPPRIP
XCM1:		RET	NZ
CMPUZIV:	EX	DE,HL
		LD	A,(DE)
		CP	(HL)
		EX	DE,HL
		RET
XCMP2:		CALL	CMPPRIP
		RET	NZ
		CALL	CMPMENO
		JR	XCM1
XCMP3:		CALL	CMPUZIV
		RET	NZ
		CALL	CMPMENO
		RET	NZ
CMPPRIP:	CALL	PUA
		LD	BC,9
		ADD	HL,BC
		EX	DE,HL
		ADD	HL,BC
		LD	B,3
		JR	CMPRET1
		
XTSTPOC:	LD	A,(IX+HOPOCETL-HOL)
		OR	A
		RET

XTSTAPR:	LD	A,(IX+HOAKTL-HOL)
		OR	A
		RET

XTSTAPO:	CALL	XTSTPOC
		RET	Z
		DEC	A
		CP	(IX+HOAKTL-HOL)
		RET

XTSTBRF:	LD	A,(IX+HOFULLL-HOL)
		OR	A
		RET

XFIRST:		CALL	PUAL
XFIRS1:		LD	C,(IX+HODISKL-HOL)
		PUSH	IX
		BIOS	ISELDSK
		POP	IX
		LD	A,H
		OR	L
		JR	NZ,XFIRS2
XFIRS3:		LD	A,(IX+HODISKL-HOL)
		ADD	A,'A'
		CALL	ZLYDISK
		SUB	'A'
		JR	C,XFIRS3
		LD	(IX+HODISKL-HOL),A
		JR	XFIRS1
XFIRS2:		LD	A,(IX+HODISKL-HOL)
		CALL	STDISK
		LD	BC,0A
		ADD	HL,BC
		LD	E,(HL)
		INC	HL
		LD	D,(HL)
		LD	(IX+HOBDPAL-HOL),E
		LD	(IX+HOBDPAL+1-HOL),D
		PUSH	DE
		POP	IY
		LD	L,(IY+0D)
		LD	H,(IY+0E)
		LD	(XSTOPA),HL
		LD	L,(IY+0)
		LD	H,(IY+1)
		LD	(XSEKMAX),HL
		LD	L,(IY+7)
		LD	H,(IY+8)
		INC	HL
		LD	(XPOC),HL
		LD	(INFPC),HL
		LD	A,(IY+6)
		LD	(XFL2),A
		LD	D,A
		LD	E,(IY+5)
		INC	DE
		LD	H,(IY+9)
		LD	L,(IY+0A)
XFIRS4:		ADD	HL,HL
		DEC	DE
		JR	C,XFIRS4
		INC	DE
		EX	DE,HL
		LD	(INFBC),HL
		LD	(INFKC),HL
		XOR	A
		LD	L,A
		LD	H,A
		LD	(XFL3),A
		LD	(XSEKTOR),HL
		LD	(XPOR),A
		RET

XNEXT:		CALL	PUH
		LD	HL,(XPOC)
		LD	A,H
		OR	L
		RET	Z
		DEC	HL
		LD	(XPOC),HL
		LD	A,(XPOR)
		OR	A
		PUSH	AF
		INC	A
		CP	4
		JR	NZ,XNEXT7
		XOR	A
XNEXT7:		LD	(XPOR),A
		POP	AF
		JR	Z,XNEXT1
		RRCA
		RRCA
		RRCA
XNEXT2:		LD	C,A
		LD	B,0
		LD	HL,BDMA
		ADD	HL,BC
		XOR	A
		INC	A
		RET
XNEXT1:		LD	A,(IX+HODISKL-HOL)
		LD	BC,(XSTOPA)
		LD	DE,(XSEKTOR)
		LD	HL,BDMA
		CALL	SETHEAD
		JR	NC,XNEXT5
		CALL	RDERR
		JR	NZ,XNEXT1
		CCF
		RET	C
XNEXT5:		PUSH	IX
		BIOS	IREAD
		POP	IX
		OR	A
		SCF
		RET	NZ
XNEXT4:		LD	HL,(XSEKTOR)
		LD	BC,(XSEKMAX)
		INC	HL
		XOR	A
		SBC	HL,BC
		ADD	HL,BC
		JR	NZ,XNEXT6
		LD	HL,(XSTOPA)
		INC	HL
		LD	(XSTOPA),HL
		LD	L,A
		LD	H,A
XNEXT6:		LD	(XSEKTOR),HL
		JR	XNEXT2

IXFIRST:	CALL	PUAL
		CALL	LODSUB
		LD	(IXADRS),HL
		XOR	A
		LD	(IXPOC),A
		RET

IXNEXT:		CALL	PUH
		LD	HL,(IXADRS)
		LD	A,(IXPOC)
		CP	(IX+HOPOCETL-HOL)
		RET	Z
		INC	A
		LD	(IXPOC),A
		LD	DE,XLENFIL
		EX	DE,HL
		ADD	HL,DE
		LD	(IXADRS),HL
		EX	DE,HL
		RET

XGENFLS:	CALL	PUAL
		XOR	A
		LD	(IX+HOPOCETL-HOL),A
		LD	(IX+HOAKTL-HOL),A
		LD	(IX+HOOFSL-HOL),A
		CALL	PRACUJEM
		CALL	XFIRST
XGF1:		CALL	XNEXT
		JP	C,XGFXC
		JP	Z,XGFX0
		LD	A,(HL)
		CP	010
		JR	NC,XGF1
		CP	(IX+HOUSERL-HOL)
		JR	Z,XGF12
		LD	A,(IX+HOUSERL-HOL)
		CP	010
		JR	C,XGF1
XGF12:		CALL	IXFIRST
XGF2:		EX	DE,HL
		CALL	IXNEXT
		EX	DE,HL
		PUSH	DE
		POP	IY
		JR	Z,XGFI0
		CALL	CMPFCB
		JR	NZ,XGF2
		INC	(IY+XPEXT)
		LD	BC,0C
		ADD	HL,BC
XGF9:		LD	A,(HL)
		LD	C,3
		ADD	HL,BC
		CP	(IY+XPZAZ)
		JR	C,XGF3
		LD	(IY+XPZAZ),A
		LD	A,(HL)
		LD	(IY+XPZAZ+1),A
XGF3:		INC	HL
		CALL	XNBL
		ADD	A,(IY+XPUS)
		LD	(IY+XPUS),A
		JR	NC,XGF8
		INC	(IY+XPUS+1)
XGF8:		JR	XGF1
XGFI0:		LD	A,(IX+HOPOCETL-HOL)
		INC	A
		CP	081
		JR	Z,XGFIC
		LD	(IX+HOPOCETL-HOL),A
		LD	BC,0C
		LDIR
		LD	(IY+XAKT),B
		LD	(IY+XPEXT),1
		LD	(IY+XPZAZ),B
		LD	(IY+XPUS),B
		LD	(IY+XPUS+1),B
		JR	XGF9
XGFIC:		LD	A,(XFL3)
		DEC	A
		JP	Z,XGF1
		LD	A,1
		LD	(XFL3),A
		CALL	VELASUB
		CP	'I'
		JP	Z,XGF1
XGFXC:		XOR	A
		LD	(IX+HOPOCETL-HOL),A
XGFX0:		CALL	IXFIRST
XGF10:		CALL	IXNEXT
		JP	Z,XUSPFLS0
		PUSH	HL
		POP	IY
		LD	E,(IY+XPZAZ+1)
		LD	D,0
		LD	L,D
		LD	H,(IY+XPZAZ)
		SRL	H
		RR	L
		ADD	HL,DE
		LD	(IY+XPZAZ),L
		LD	(IY+XPZAZ+1),H
		LD	L,(IX+HOBDPAL-HOL)
		LD	H,(IX+HOBDPAL+1-HOL)
		INC	HL
		INC	HL
		LD	A,(HL)
		SUB	3
		JR	Z,XGF10
		LD	B,A
XGF11:		SLA	(IY+XPUS)
		RL	(IY+XPUS+1)
		DJNZ	XGF11
		JR	XGF10


XGENPTR:	CALL	PUAL
		LD	B,(IX+HOPOCETL-HOL)
		INC	B
		DEC	B
		RET	Z
		CALL	LODPTR
		PUSH	HL
		POP	IY
		CALL	LODSUB
		LD	DE,XLENFIL
XGP1:		LD	(IY+0),L
		LD	(IY+1),H
		INC	IY
		INC	IY
		ADD	HL,DE
		DJNZ	XGP1
		RET

XUSPFLS0:	CALL	CLOSEW
XUSPFLS:	CALL	XGENPTR
XUSPPTR:	CALL	PUAL
		XOR	A
		LD	(IX+HOAKTL-HOL),A
		LD	(IX+HOOFSL-HOL),A
		LD	B,(IX+HOPOCETL-HOL)
		INC	B
		DEC	B
		RET	Z
		DEC	B
		RET	Z
		CALL	LODPTR
		PUSH	HL
		POP	IY
		PUSH	IX
XUP1:		LD	C,B
		PUSH	IY
		POP	IX
XUP2:		INC	IX
		INC	IX
		LD	L,(IX+0)
		LD	H,(IX+1)
		LD	E,(IY+0)
		LD	D,(IY+1)
		EX	(SP),IX
		CALL	XCMP
		EX	(SP),IX
		JR	NC,XUP3
		LD	(IX+0),E
		LD	(IX+1),D
		LD	(IY+0),L
		LD	(IY+1),H
XUP3:		DEC	C
		JR	NZ,XUP2
		INC	IY
		INC	IY
		DJNZ	XUP1
		POP	IX
		RET

XPLCSN:		CALL	PUAL
		CALL	WHEREX
		LD	C,A
		INC	HL
		LD	B,8
XPLCSN1:	LD	A,(HL)
		INC	HL
		AND	07F
		CALL	UPCASE
		CALL	PUTCHAR
		DJNZ	XPLCSN1
		LD	A,' '
		LD	B,4
XPLCSN2:	CALL	PUTCHAR
		LD	A,(HL)
		INC	HL
		AND	07F
		CALL	UPCASE
		DJNZ	XPLCSN2
		LD	A,C
		JP	SETX

XPLCS:		CALL	PUAL
		PUSH	HL
		POP	IY
		CALL	WHEREX
		LD	C,A
		LD	A,2
		CALL	SETX
		CALL	XPLCSN
		LD	A,0E
		CALL	SETX
		LD	A,(HL)
		CALL	PADEK
		CALL	PUTSPC
		LD	L,(IY+XPZAZ)
		LD	H,(IY+XPZAZ+1)
		CALL	PHLDEK
		CALL	PUTSPC
		LD	A,(IY+XPEXT)
		CALL	PADEK
		LD	L,(IY+XPUS)
		LD	H,(IY+XPUS+1)
		CALL	PHLDEK
		CALL	PUTSPC
		CALL	TEXT0
		DEFB	'R','/',0
		BIT	7,(IY+9)
		LD	A,'W'
		JR	Z,XPLCS1
		LD	A,'O'
XPLCS1:		CALL	PUTCHAR
		CALL	PUTSPC
		BIT	7,(IY+0A)
		LD	HL,XMDIR
		JR	Z,XPLCS2
		LD	HL,XMSYS
XPLCS2:		CALL	TEXT
		LD	A,C
		JP	SETX

PLCMHL:		CALL	PUHL
PLCMHL2:	LD	A,(HL)
		INC	HL
		LD	B,1
		OR	A
		RET	Z
		CP	' '
		JR	NC,PLCMHL1
		LD	B,A
		DEC	A
		JR	NZ,PLCMHL3
		LD	A,(HL)
		INC	HL
		CALL	SETX
		JR	PLCMHL2
PLCMHL3:	DEC	A
		LD	A,(HL)
		INC	HL
		JR	NZ,PLCMHL1
		CALL	SETY
		JR	PLCMHL2
PLCMHL1:	CALL	PUTCHAR
		DJNZ	PLCMHL1
		JR	PLCMHL2

XPLCMH:		CALL	PUAL
		CALL	WHEREXY
		PUSH	HL
		CALL	FARPAN
		CALL	FARZVY
		LD	DE,XMHB1
		LD	HL,XMHB2
		CALL	XTSTBRF
		JR	Z,XPLCMH1
		LD	DE,XMHF1
		LD	HL,XMHF2
XPLCMH1:	CALL	TIMDIS
		CALL	PLCMHL
;		CALL	FARPAN
		EX	DE,HL
		CALL	PLCMHL
		CALL	PLCMHL
		CALL	PLCMHL
		CALL	XPLCHDR
		LD	A,(HOCAS)
		OR	A
		CALL	NZ,TIMENA
		POP	HL
		JP	SETXY

XGETSTR:	CALL	PUA
		PUSH	IX
		POP	HL
		LD	DE,HOL
		OR	A
		SBC	HL,DE
		LD	A,L
		OR	H
		RET	Z
		LD	A,1
		RET

XGETAS:		CALL	PUH
		CALL	LODPTR
		EX	DE,HL
		LD	L,A
		LD	H,0
		ADD	HL,HL
		ADD	HL,DE
		LD	E,(HL)
		INC	HL
		LD	D,(HL)
		LD	HL,XAKT
		ADD	HL,DE
		INC	(HL)
		DEC	(HL)
		EX	DE,HL
		RET

XGETAA:		PUSH	AF
		LD	A,(IX+HOAKTL-HOL)
		CALL	XGETAS
		POP	AF
		RET

XTSTPAN:	PUSH	DE
		LD	D,A
		LD	A,(HOPANEL)
		LD	E,A
		CALL	XGETSTR
		CP	E
		LD	A,D
		POP	DE
		RET

XMERVYB:	CALL	PUH
		CALL	LODPTR
		LD	B,(IX+HOPOCETL-HOL)
		PUSH	IX
		LD	IX,0
		LD	C,0
		INC	B
		JR	XMERV2
XMERV1:		LD	A,(HL)
		INC	HL
		DEFB	0FD
		LD	L,A
		LD	A,(HL)
		INC	HL
		DEFB	0FD
		LD	H,A
		LD	A,(IY+XAKT)
		OR	A
		JR	Z,XMERV2
		INC	C
		LD	E,(IY+XPUS)
		LD	D,(IY+XPUS+1)
		ADD	IX,DE
XMERV2:		DJNZ	XMERV1
		PUSH	IX
		POP	HL
		LD	A,C
		POP	IX
		OR	A
		RET

XGETDLZ:	LD	A,(HOLINES)
		SUB	6
		LD	B,A
		LD	C,A
		CALL	XTSTBRF
		LD	A,C
		RET	NZ
		ADD	A,A
		ADD	A,C
		LD	C,A
		RET

XPLCMD:		CALL	PUAL
		CALL	WHEREXY
		PUSH	HL
		LD	A,(HOLINES)
		ADD	A,(IX+HOLHL+1-HOL)
		SUB	3
		CALL	SETY
		CALL	FARPAN

		CALL	FARZVY

		CALL	XTSTBRF
		LD	HL,XMDB
		JR	Z,XPLCMD1
		LD	HL,XMDF
XPLCMD1:	CALL	PLCMHL
		LD	HL,XMD
		CALL	PLCMHL
		LD	A,KODDPD
		CALL	SETCHAR
		POP	HL
		CALL	SETXY
XPLCMDM:	CALL	PUAL
		CALL	WHEREXY
		PUSH	HL
		LD	A,(HOLINES)
		ADD	A,(IX+HOLHL+1-HOL)
		SUB	2
		LD	H,A
		LD	L,2
		CALL	SETXY
		CALL	XMERVYB
		JR	Z,XPLCMD2
		CALL	FARZVY
		CALL	TEXT0
		COND	CESKY
		DEFB	' ',' ',0
		CALL	PHLDEK
		CALL	TEXT0
		DEFB	' kB v ',0
		CALL	PADEK
		CALL	TEXT0
		DEFB	' vybran',0D9,'ch souborech  ',0
		ELSE
		DEFB	' ',' ',0
		CALL	PHLDEK
		CALL	TEXT0
		DEFB	' kB v ',0
		CALL	PADEK
		CALL	TEXT0
		DEFB	' vybran',0D9,'ch s',0D5,'boroch   ',0
		ENDC
XPLCMD3:	POP	HL
		JP	SETXY
XPLCMD2:	CALL	XGETAA
		CALL	XTSTPOC
		CALL	NZ,XPLCS
		JR	NZ,XPLCMD3
		LD	A,' '
		LD	B,026
XPLCMD4:	CALL	PUTCHAR
		DJNZ	XPLCMD4
		JR	XPLCMD3

XPLCMS:		CALL	PUAL
		CALL	WHEREXY
		PUSH	HL
		CALL	FARPAN

		CALL	FARZVY

		CALL	XTSTBRF
		LD	HL,XMSB
		JR	Z,XPLCMS1
		LD	HL,XMSF
XPLCMS1:	CALL	PLCMHL
		POP	HL
		JP	SETXY

XPLCMSV:	CALL	PUAL
		CALL	WHEREXY
		PUSH	HL
		CALL	FARPAN

		CALL	FARZVY

		LD	A,4
		CALL	SETY
		LD	A,(HOLINES)
		SUB	6
		LD	B,A
		CALL	XTSTBRF
		LD	HL,XMSB2
		JR	Z,XPLCMSV1
		LD	HL,XMSF2
XPLCMSV1:	PUSH	HL
		CALL	PLCMHL
		POP	HL
		DJNZ	XPLCMSV1
		POP	HL
		JP	SETXY

XPLCM:		CALL	PUAL
		CALL	XWIN
		CALL	XPLCMH
		CALL	XPLCMSV
		JP	XPLCMD

ODPAKS:		CALL	PUAL
		CALL	FARPAN
		JR	PLCAKS2
INVAKS:		CALL	PUAL
		CALL	GETIX
		LD	A,(IX+HOAKTL-HOL)
		CALL	XINVSBR
		CALL	XPLCMDM
PLCAKS:		CALL	PUAL
		CALL	FARPAN
		CALL	FARAKT
PLCAKS2:	CALL	GETIX
		LD	A,(IX+HOAKTL-HOL)
XPLCSBR:	CALL	PUAL	
		LD	E,A
		CALL	XTSTPOC
		RET	Z
		CALL	XGETDLZ
		LD	A,E
		SUB	(IX+HOOFSL-HOL)
		RET	C
		CP	C
		RET	NC
		LD	D,A
		CALL	WHEREXY
		PUSH	HL
		LD	A,E
		CALL	XGETAS
		JR	Z,XPLCSR3
		CALL	FARZVY
XPLCSR3:	CALL	XTSTBRF
		LD	A,D
		JR	Z,XPLCSRB
		ADD	A,4
		CALL	SETY
		LD	A,2
		CALL	SETX
		CALL	XPLCS
XPLCSR4:	CALL	XPLCMS
		POP	HL
		JP	SETXY
XPLCSRB:	SUB	B
		LD	C,2
		JR	C,XPLCSR5
		SUB	B
		LD	C,01C
		JR	NC,XPLCSR6
		LD	C,0F
XPLCSR5:	ADD	A,B
XPLCSR6:	ADD	A,4
		CALL	SETY
		LD	A,C
		CALL	SETX
		CALL	XPLCSN
		JR	XPLCSR4

XPLC:		CALL	XPLCM
XPLCSBY:	CALL	PUAL
		CALL	XGETDLZ
		LD	A,(IX+HOAKTL-HOL)
		LD	B,(IX+HOOFSL-HOL)
		CP	B
		JR	NC,XPLCSY2
		LD	B,A
		LD	(IX+HOOFSL-HOL),A
XPLCSY2:	LD	E,A
		SUB	B
		CP	C
		JR	C,XPLCSY3
		LD	A,E
		SUB	C
		INC	A
		LD	B,A
		LD	(IX+HOOFSL-HOL),A
XPLCSY3:	LD	C,B		
		LD	A,(IX+HOPOCETL-HOL)
		SUB	C
		RET	C
		RET	Z
		LD	B,A
		LD	A,C
XPLCSY1:	CALL	FARPAN
		CALL	XPLCSBR
		INC	A
		DJNZ	XPLCSY1
		RET

ODPAKP:		CALL	PUAL
		CALL	FARPAN

		CALL	FARZVY

		JR	PLCAKP2
PLCAKP:		CALL	PUAL
;		CALL	FARPAN
;		CALL	FARAKT

		CALL	FARMNU

PLCAKP2:	CALL	GETIX
XPLCHDR:	CALL	PUAL
		CALL	WHEREXY
		PUSH	HL
		LD	HL,0113
		CALL	SETXY
		CALL	PUTSPC
		LD	A,(IX+HODISKL-HOL)
		CALL	PRD
		LD	A,(IX+HOUSERL-HOL)
		CP	010
		CALL	C,PRU
		LD	A,':'
		CALL	PUTCHAR
		CALL	PUTSPC
		POP	HL
		JP	SETXY

XTSTSBR:	PUSH	HL
		CALL	XGETAS
		POP	HL
		RET

XINVSBR:	CALL	PUAL
		CALL	XTSTSBR
		JR	NZ,XUNSSBR
XSELSBR:	CALL	PUAL
		LD	E,0FF
XSELSBR1:	CALL	XGETAS
		CALL	XTSTPOC
		RET	Z
		PUSH	HL
		POP	IY
		LD	(IY+XAKT),E
		RET
XUNSSBR:	CALL	PUAL
		LD	E,0
		JR	XSELSBR1

XSCRH:		CALL	PUAL
		LD	B,0
		CALL	XTSTBRF
		JR	NZ,XSCRS
		INC	B
		CALL	XSCRS
		CALL	XSCRR
		INC	B
		CALL	XSCRS
		CALL	XSCRR
		INC	B
		JR	XSCRS
XSCRD:		CALL	PUAL
		LD	B,0
		SET	7,C
		CALL	XTSTBRF
		JR	NZ,XSCRS
		LD	B,3
		CALL	XSCRS
		DEC	B
		CALL	XSCRR
		CALL	XSCRS
		DEC	B
		CALL	XSCRR
XSCRS:		CALL	PUAL
		LD	A,0C
		LD	HL,0301
		DJNZ	XSCRS4
XSCRS2:		LD	D,H
		LD	E,L
		PUSH	AF
		LD	A,C
		AND	07F
		LD	B,A
		ADD	A,D
		LD	D,A
		POP	AF
		BIT	7,C
		JR	NZ,XSCRS3
		EX	DE,HL
XSCRS3:		LD	C,A
		LD	A,(HOLINES)
		SUB	6
		SUB	B
		LD	B,A
XSCRS1:		LD	A,(IX+HOLHL-HOL)
		DEC	A
		PUSH	AF
		ADD	A,L
		LD	L,A
		POP	AF
		ADD	A,E
		LD	E,A
		LD	A,(IX+HOLHL+1-HOL)
		DEC	A
		PUSH	AF
		ADD	A,H
		LD	H,A
		POP	AF
		ADD	A,D
		LD	D,A
		JP	CPYVRAM
XSCRS4:		LD	L,0E
		DEC	B
		JR	Z,XSCRS2
		LD	L,01B
		DEC	B
		JR	Z,XSCRS2
		LD	L,1
		LD	A,026
		JR	XSCRS2
XSCRR:		CALL	PUAL
		LD	A,(HOLINES)
		SUB	3
		LD	H,A
		LD	L,0E
		LD	DE,031B
		DJNZ	XSCRR1
		LD	E,L
		LD	L,1
XSCRR1:		LD	A,C
		AND	07F
		LD	B,A
		LD	A,H
		SUB	B
		LD	H,A
		BIT	7,C
		JR	NZ,XSCRR2
		EX	DE,HL
XSCRR2:		LD	C,0C
		JR	XSCRS1

XSCRHS:		CALL	PUAL
		CALL	XSCRH
		LD	D,C
		CALL	XGETDLZ
		LD	C,D
		LD	E,(IX+HOOFSL-HOL)
		ADD	A,E
		LD	B,A
		LD	A,E
		ADD	A,C
XSCRHS1:	LD	(IX+HOOFSL-HOL),A
		LD	A,B
		LD	B,C
		JP	XPLCSY1

XSCRDS:		CALL	PUAL
		CALL	XSCRD
		LD	A,(IX+HOOFSL-HOL)
		SUB	C
		LD	B,A
		JR	XSCRHS1

PLCL:		PUSH	IX
		LD	IX,HOL
PLCL1:		CALL	XPLC
PLCL2:		POP	IX
		RET
PLCP:		PUSH	IX
		LD	IX,HOR
		JR	PLCL1
GENL:		PUSH	IX
		LD	IX,HOL
GENL1:		CALL	XGENFLS
		JR	PLCL2
GENP:		PUSH	IX
		LD	IX,HOR
		JR	GENL1
USPL:		PUSH	IX
		LD	IX,HOL
USPL1:		CALL	XUSPFLS
		JR	PLCL2
USPP:		PUSH	IX
		LD	IX,HOR
		JR	USPL1

PLCINV:		CALL	INVAKS
PLCDO:		CALL	PUAL
		CALL	GETIX
		CALL	XTSTPOC
		RET	Z
		CALL	XTSTAPO
		RET	Z
		CALL	ODPAKS
		CALL	XGETDLZ
		LD	A,(IX+HOOFSL-HOL)
		ADD	A,C
		DEC	A
		CP	(IX+HOAKTL-HOL)
		JR	NZ,PLCDO1
		LD	C,1
		CALL	XSCRH
		INC	(IX+HOOFSL-HOL)
PLCDO1:		INC	(IX+HOAKTL-HOL)
PLCDO2:		CALL	PLCAKS
		CALL	XPLCMDM
PLCDO3:		JP	KBDNUL
PLCHO:		CALL	PUAL
		CALL	GETIX
		CALL	XTSTPOC
		RET	Z
		CALL	XTSTAPR
		RET	Z
		CALL	ODPAKS
		CP	(IX+HOOFSL-HOL)
		JR	NZ,PLCHO1
		LD	C,1
		CALL	XSCRD
		DEC	(IX+HOOFSL-HOL)
PLCHO1:		DEC	(IX+HOAKTL-HOL)
		JR	PLCDO2

PLCVL:		CALL	PUAL
		CALL	GETIX
;		CALL	XTSTBRF
;		RET	NZ
		CALL	XTSTPOC
		RET	Z
		CALL	XGETDLZ
		CALL	XTSTAPR
		RET	Z
		CALL	ODPAKS
		PUSH	AF
		SUB	B
		LD	D,A
		POP	AF
		LD	E,(IX+HOOFSL-HOL)
		SUB	E
		CP	B
		JR	C,PLCVL1
PLCVL4:		LD	(IX+HOAKTL-HOL),D
PLCVL3:		JP	PLCDO2
PLCVL1:		LD	A,E
		OR	A
		JR	NZ,PLCVL5
		LD	D,A
		JR	PLCVL4
PLCVL5:		CP	B
		JR	NC,PLCVL2
		LD	B,A
		LD	D,0
PLCVL2:		LD	C,B
		CALL	XSCRDS
		JR	PLCVL4

PLCVP:		CALL	PUAL
		CALL	GETIX
;		CALL	XTSTBRF
;		RET	NZ
		LD	A,(IX+HOOFSL-HOL)
		LD	E,A
		LD	A,(IX+HOAKTL-HOL)
		LD	D,A
		CALL	XTSTPOC
		RET	Z
		SUB	E
		LD	H,A
		CALL	XTSTAPO
		RET	Z
		LD	L,A
		CALL	ODPAKS
		CALL	XGETDLZ
		LD	A,C
		SUB	B
		LD	C,A
		LD	A,D
		SUB	E
		CP	C
		JR	NC,PLCVP1
		LD	A,D
		ADD	A,B
		LD	D,A
		JR	C,PLCVP2
		CP	L
		JR	C,PLCVL4
PLCVP2:		LD	D,L
		JR	PLCVL4
PLCVP1:		LD	A,B
		ADD	A,C
		LD	C,A
		LD	A,H
		SUB	C
		JR	C,PLCVP2		
		JR	Z,PLCVP2
		CP	B
		JR	NC,PLCVP3
		LD	D,L
		LD	C,A
PLCVP4:		CALL	XSCRHS
		JR	PLCVL4
PLCVP3:		LD	A,D
		ADD	A,B
		LD	D,A
		LD	C,B
		JR	PLCVP4

PLCTAB:		CALL	ODPAKS
		CALL	ODPAKP
		LD	A,(HOPANEL)
		XOR	1
		LD	(HOPANEL),A
		CALL	PLCAKP
		JP	PLCAKS

PLCCUP:		CALL	XTSTPOC
		RET	Z
		XOR	A
		LD	B,A
PLCCUP1:	CALL	ODPAKS
		LD	(IX+HOAKTL-HOL),B
		CP	(IX+HOOFSL-HOL)
		LD	(IX+HOOFSL-HOL),A
		CALL	NZ,XPLC
		CALL	PLCAKP
		JP	PLCAKS

PLCCDO:		CALL	XGETDLZ
		CALL	XTSTPOC
		RET	Z
		LD	B,A
		DEC	B
		SUB	C
		JR	NC,PLCCDO1
		XOR	A
PLCCDO1:	JR	PLCCUP1

XNBL:		PUSH	BC
		PUSH	DE
		PUSH	HL
		LD	E,0
		LD	BC,(XFL2)
		LD	B,010
		INC	C
		DEC	C
		JR	Z,XGF4
		LD	B,08
XGF4:		LD	A,(HL)
		INC	C
		DEC	C
		JR	Z,XGF5
		INC	HL
XGF5:		OR	(HL)
		INC	HL
		JR	Z,XGF6
		INC	E
		DJNZ	XGF4
XGF6:		LD	A,E
		POP	HL
		POP	DE
		POP	BC
		RET

XGETINF:	CALL	PUA
		CALL	XFIRST
		LD	DE,0
		LD	IY,0
		LD	BC,010
XGETINF1:	CALL	XNEXT
		JR	NC,XGETINF6
		CALL	RDERR
		CCF
		RET	C
		JR	NZ,XGETINF1
		JR	XGETINF7
XGETINF6:	JR	Z,XGETINF2
XGETINF7:	LD	A,(HL)
		CP	020
		JR	NC,XGETINF1
		INC	IY
		ADD	HL,BC
		CALL	XNBL
		ADD	A,E
		LD	E,A
		ADC	A,D
		SUB	E
		LD	D,A
		JR	XGETINF1
XGETINF2:	LD	(INFPO),IY
		LD	(INFBO),DE
		LD	(INFKO),DE
		LD	HL,(INFBC)
		OR	A
		SBC	HL,DE
		LD	(INFBV),HL
		LD	(INFKV),HL
		PUSH	IY
		POP	DE
		LD	HL,(INFPC)
		OR	A
		SBC	HL,DE
		LD	(INFPV),HL
		LD	L,(IX+HOBDPAL-HOL)
		LD	H,(IX+HOBDPAL+1-HOL)
		INC	HL
		INC	HL
		LD	A,(HL)
		SUB	3
		JR	Z,XGETINF3
		LD	IY,INFKV
		LD	C,3
XGETINF5:	LD	B,A
XGETINF4:	SLA	(IY+0)
		RL	(IY+1)
		DJNZ	XGETINF4
		INC	IY
		INC	IY
		DEC	C
		JR	NZ,XGETINF5
XGETINF3:	XOR	A
		RET

;;;;;;;;;;;;;

LABELP:		EX	(SP),HL
		PUSH	DE
		LD	E,(HL)
		INC	HL
		LD	D,(HL)
		INC	HL
		EX	DE,HL
		CALL	LABEL
		EX	DE,HL
		POP	DE
		EX	(SP),HL
		RET

PINFR:		CALL	SETDOWN
		LD	A,XINF2
		CALL	SETX
		LD	L,(IY+0)
		LD	H,(IY+1)
		INC	IY
		INC	IY
		CALL	PHLDEK
		LD	A,XINF3
		CALL	SETX
		EX	DE,HL
		JP	TEXT

NRINFO:		LD	HL,XWINFO1
		LD	DE,XWINFO2
		CALL	SETWIN
		CALL	FARMNU
		CALL	CLRSCR
		CALL	ORAMUJ
		CALL	LABELP
		DEFW	MTITUL
		DEC	L
		INC	E
		CALL	SETWIN
		LD	A,YINF
		CALL	SETY
		LD	A,KODML
		CALL	PUTCHAR
		CALL	SETEOL
		LD	A,KODMP
		CALL	PUTCHAR
		INC	L
		DEC	E
		CALL	SETWIN
		LD	A,(IX+HODISKL-HOL)
		ADD	A,'A'
		LD	(MREKLD),A		
		LD	HL,MREKL
		CALL	PLCMHL
		CALL	XGETINF
		CALL	FDOFF
		JP	C,NRINFO2
		LD	A,YINF-1
		CALL	SETY
		LD	IY,INFBEG
		LD	B,3
NRINFO1:	CALL	SETDOWN
		LD	DE,MVOLN
		CALL	PINFR
		LD	DE,MOBSA
		CALL	PINFR
		LD	DE,MCELK
		CALL	PINFR
		DJNZ	NRINFO1
		CALL	KBDNUL
		CALL	KBDREAD
NRINFO2:	JP	NRMENU5
