.COMMENT @

********************************************
*                                          *
*      ***** CPM-BIOS v4.1 SCAV *****      *
*      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      *
*   Verze  : 1.0        Uroven : MONITOR   *
*                                          *
* (C) by fy. SCAV for project Scavenger v8 *
*                                          *
*   Datum  : 10.10.1998     * 01.10.1998   *
*                                          *
*   Autor  : SCAV                          *
*            Pavel Brazda   * 22.05.1972   *
*            Husova 9                      *
*            Brno - mesto                  *
*            602 00                        *
*                                          *
********************************************

Upraveny CP/M bios pro Scavenger v8.

POZNAMKY:
F753:	zobrazeni klicu
F827:	zobrazeni time

DATA:
FBD6:	bufer pozice stara
FBD7:	bufer pozice nova

?:
FBD2:	zmena klicu
FBD3:	doba key
FBD4:	key
FBE0:	radek
FBE1:	sloupec

@
	.Z80				;cpu
	PAGE	60			;strankovani
	ASEG				;absolutni usek
	ORG	100H			;start adress COM

	.PHASE	0EA00H			;adresa bios

;	***** BIOS *****
;	~~~~~~~~~~~~~~~~

PEA00:	DB	0C3H			;jp	0fdfeh
PEA01:	DW	XFDFE			;boot	vstup do biosu
LEA03:	JP	XEA4C			;wboot	znovuzavedeni ccp a bdos
	JP	SEAAE			;const	zjisti stav console
	JP	SEAB7			;conin	cte znak z console
	JP	SEAD5			;conout	vypis znak na consoli
	JP	LF1C8			;list	vypise znak na tiskarne
	JP	LF1E3			;punch	vyderuje znak na derne pasce
	JP	LF1ED			;reader	precte znak ze snimace derne p.
	JP	LF1F5			;home	nastavi hlavu na st. 0 u vyb.d.
	JP	LF1FA			;seldsk	vybere diskovou jednotku
	JP	LF2D6			;settrk	nastavi cislo stopy
	JP	LF2DB			;setsek	nastavi cislo sektoru
	JP	SF2E0			;setdma	nastavi dma adresu
	JP	SF2E5			;read	cte nastaveny sektor
	JP	LF32B			;write	zapise nastaveny sektor
	JP	SF1DD			;listst vrati status tiskarny
	JP	LF3C0			;sectrn	prevede log. c. sec. na fyzicke

PEA33:	DB	0H			;barva pozadi obr.   - doba do off fd
PEA34:	DB	0FH			;barva tisku na obr. - parametr write
PEA35:	DB	1H			;delka pipnuti klavesnice
PEA36:	DB	3H			;cislo poslesledniho disku v systemu
PEA37:	DB	3H,2H,0BH,1BH		;parametry disku a
PEA3B:	DB	0C8H,0H			;doba rozbehu disku v mS
PEA3D:	DB	3H			;doba ustaleni hlavy na stope v mS
PEA3E:	DB	6H			;doba kroku diskove hlavy v mS
PEA3F:	DB	40H			;velikost ram v jednotkach 16kB
PEA40:	DB	0H,0H			;realny cas
PEA42:	DB	0H			;realny cas
PEA43:	DB	18H			;rs-232   priznak prer. 0 zak. 1 povol.
PEA44:	DB	10H,10H,4H,4CH		;rs-232   system parametr area
	DB	5H,0EAH,3H,0E1H		;rs-232   system parametr area

;	***** WBOOT *****
;	~~~~~~~~~~~~~~~~~

XEA4C:	LD	SP,100H
	DI
	IN	A,(0E0H)
	CALL	SF753			;zobrazeni klicu
LEA55:	IN	A,(0E1H)
	EI
	XOR	A
	LD	(VFBE7),A
	LD	BC,0D400H
	LD	DE,1C02H
LEA62:	CALL	SF2E0			;setdma
	LD	HL,80H
	ADD	HL,BC
	LD	(WFBE8),DE		;stopa
	PUSH	DE
	PUSH	HL
	CALL	SF2E5			;read cte nastaveny sektor
	JR	NZ,LEA9D
	POP	BC
	POP	DE
	INC	D
	LD	A,024H
	XOR	D
	JR	NZ,LEA62
	LD	D,A
	INC	E
	BIT	2,E
	JR	Z,LEA62
	LD	BC,80H
	CALL	SF2E0			;setdma
	LD	A,(4H)
	LD	C,8
	LD	D,B
	LD	E,B
	LD	HL,PEA44		;rs-232 system parametr area
	LDIR
	LD	C,A
	LD	A,(0D400H)
	XOR	0C3H
	JP	Z,0D403H
LEA9D:	LD	DE,CF7C0
	CALL	XF8E5
	CALL	SF9C1
	JR	NC,XEA4C		;wboot
	XOR	A
	LD	(VFBF4),A
	JR	XEA4C			;wboot

;	***** CONST zjisti stav console *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SEAAE:	LD	HL,(WFBD6)		;key znak v console
	LD	A,H
	XOR	L
	RET	Z
	LD	A,0FFH
	RET

;	***** CONIN cte znak z console *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SEAB7:	EI
LEAB8:	CALL	SEAAE			;const zjisti stav console
	JR	NZ,LEAC0
	HALT
	JR	LEAB8

LEAC0:	DI
	IN	A,(0E0H)
	LD	HL,VFBD7
	LD	D,0BFH
	LD	E,(HL)
	LD	A,(DE)
	INC	(HL)
	LD	B,A
	IN	A,(0E1H)
	EI
	LD	A,B
	CP	0DH
	RET	NZ
	INC	(HL)
	RET

;	***** CONOUT vypis znak na consoli *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SEAD5:	LD	(WFC14),SP
	LD	SP,XFC2E
	LD	HL,VFBDA
	SET	0,(HL)
	SET	2,(HL)
	IN	A,(0E0H)
	LD	A,C
	LD	HL,(WFBDB)
	JP	(HL)

LEAEA:	LD	HL,(WFBDB)
	LD	(WFBDD),HL
	CALL	SF63B
	LD	HL,XECF2
	PUSH	HL
	LD	HL,(WFBE1)
	LD	DE,(WFBDF)
	CP	7			;beep
	JR	Z,SEB24
	CP	8			;navrat o pozizi do leva
	JR	Z,LEB36
	CP	0AH			;prechod na novy radek
	JR	Z,LEB4B
	CP	0DH			;navrat na zacatek radku
	JR	Z,LEB57
	CP	17H			;prefix 7 bit
	JR	Z,LEB5F
	CP	1AH			;cls
	JR	Z,LEB70
	CP	1BH			;esc
	RET	NZ
	LD	HL,CEB91
	LD	(WFBDB),HL
LEB1F:	LD	A,0FBH
	JP	LECF4

SEB24:	XOR	A			;beep
	OUT	(0D4H),A
	LD	A,4
	OUT	(0D4H),A
	LD	A,1
	OUT	(0D3H),A
	RRCA
	CALL	SFAE2			;wait 80
	OUT	(0D3H),A
	RET

LEB36:	DEC	HL			;navrat o pozici doleva	
	INC	E
	LD	A,050H
	CP	E
	JR	NC,LEB48
	LD	BC,0FDD0H		;???
	ADD	HL,BC
	LD	E,1
	INC	D
	LD	A,18H
	CP	D
	RET	C
LEB48:	JP	LECEB

LEB4B:	LD	BC,280H			;prechod na novy radek
	ADD	HL,BC
	DEC	D
	JR	NZ,LEB48
	LD	H,18H
	JP	SF699

LEB57:	LD	A,D			;navrat na zacatek radku
	CALL	SF745
	LD	E,050H
	JR	LEB48

LEB5F:	LD	HL,CEB66		;prefix 7 bit
	LD	(WFBDB),HL
	RET

CEB66:	SET	7,C
	LD	A,C
	LD	HL,(WFBDD)
	LD	(WFBDB),HL
	JP	(HL)

LEB70:	XOR	A			;cls
	LD	HL,0BC50H
LEB74:	DEC	L
	LD	(HL),A
	DEC	L
	LD	(HL),A
	DEC	L
	LD	(HL),A
	DEC	L
	LD	(HL),A
	JP	NZ,LEB74
	DEC	H
	JP	M,LEB74
	INC	H
	LD	DE,1850H
	JR	LEB48

LEB89:	LD	HL,CEBF8		;cursor
	LD	(WFBDB),HL
LEB8F:	JR	LEB1F

CEB91:	LD	HL,XEBCD		;esc
	PUSH	HL
	CP	'('			;znaky z rom
	JR	Z,LEBD6
	CP	')'			;znaky biosu
	JR	Z,LEBDB
	CP	'*'			;cls * home
	JR	Z,LEB70
	CP	'0'			;invers video
	JR	Z,LEBE0
	CP	'1'			;normal video
	JR	Z,LEBE4
	CP	'='			;cursor
	JR	Z,LEB89
	LD	HL,(WFBDF)
	CP	'E'			;insert line
	JP	Z,LF659
	CP	'R'			;delete line
	JP	Z,SF699
	CP	'T'			;erase to eoln
	JR	Z,LEC2B
	LD	HL,CECF3
	CP	1FH			;cursor off
	JR	Z,LEBCB
	CP	1EH			;cursor on
	RET	NZ
	RES	0,(HL)
	RET

LEBCB:	SET	0,(HL)			;cursor off
XEBCD:	LD	HL,(WFBDD)
LEBD0:	LD	(WFBDB),HL
	JP	XECF2

LEBD6:	LD	HL,CEC48		;esc (
	JR	LEBD0

LEBDB:	LD	HL,XEC73		;esc )
	JR	LEBD0

LEBE0:	LD	A,02FH			;invers video
	JR	LEBE5

L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L,HL
	LD	BC,CECCA
	ADD	HL,BC
LEC8F:	EX	DE,HL
	LD	BC,50H
	JR	LECAF

LEC95:	LD	H,0
	LD	L,A
	ADD	HL,HL
	ADD	HL,HL
	ADD	HL,HL
	LD	DE,CECC8
	ADD	HL,DE
LEC9F:	EX	DE,HL
	LD	HL,(WFBE1)
	LD	BC,50H
	LD	A,(DE)
CECA7:	NOP
	INC	E
	LD	(HL),A
	ADD	HL,BC
	LD	A,(DE)
	NOP
	INC	E
	LD	(HL),A
LECAF:	ADD	HL,BC
	LD	A,(DE)
	NOP
	INC	E
	LD	(HL),A
	ADD	HL,BC
	LD	A,(DE)
	NOP
	INC	E
	LD	(HL),A
	ADD	HL,BC
	LD	A,(DE)
	NOP
	INC	E
	LD	(HL),A
	ADD	HL,BC
	LD	A,(DE)
	NOP
	INC	E
	LD	(HL),A
	ADD	HL,BC
	LD	A,(DE)
	NOP
	INC	E
	LD	(HL),A
CECC8:	ADD	HL,BC
	LD	A,(DE)
CECCA:	NOP
	LD	(HL),A
	LD	HL,(WFBE1)
	LD	DE,(WFBDF)
	INC	HL
	DEC	E
	JR	NZ,LECEB
	LD	BC,230H
	ADD	HL,BC
	LD	E,050H
	DEC	D
	JR	NZ,LECEB
	LD	H,18H
	CALL	SF699
	LD	HL,0B980H
CECE8:	LD	DE,150H
LECEB:	LD	(WFBE1),HL
	LD	(WFBDF),DE
XECF2:	DB	03EH			;ld a,0f8h
CECF3:	DB	0F8H
LECF4:	LD	HL,VFBDA
	AND	(HL)
	LD	(HL),A
	IN	A,(0E1H)
	LD	SP,(WFC14)
	RET

	LD	HL,CECF3
	RES	0,(HL)
	JP	SF753			;zobrazeni klicu

;	BIOS CG ZNAKY
;	~~~~~~~~~~~~~

	DB	000H,061H,062H,063H,064H,065H,066H,067H
	DB	068H,069H,06BH,06AH,02FH,02AH,02EH,02DH
	DB	020H,021H,022H,023H,024H,025H,026H,027H
	DB	028H,029H,04FH,02CH,051H,02BH,057H,049H
	DB	055H,001H,002H,003H,004H,005H,006H,007H
	DB	008H,009H,00AH,00BH,00CH,00DH,00EH,00FH
	DB	010H,011H,012H,013H,014H,015H,016H,017H
	DB	018H,019H,01AH,052H,059H,054H,0BEH,0BFH
	DB	0A4H,081H,082H,083H,084H,085H,086H,087H
	DB	088H,089H,08AH,08BH,08CH,08DH,08EH,08FH
	DB	090H,091H,092H,093H,094H,095H,096H,097H
	DB	098H,099H,09AH,0BCH,080H,040H,0A5H,0C0H
	DB	0F0H,078H,079H,0BDH,01CH,01DH,05DH,05CH
	DB	01FH,05EH,05FH,01EH,070H,071H,03CH,03DH
	DB	073H,072H,032H,033H,077H,076H,06DH,047H
	DB	036H,037H,03EH,03FH,07AH,07BH,03AH,03BH
	DB	06CH,05BH,043H,0EFH,042H,056H,04DH,04EH
	DB	0D3H,0D2H,0D4H,0D1H,0D6H,0D5H,0D7H,0D8H
	DB	0D0H,0A6H,0DCH,0E5H,041H,044H,046H,053H
	DB	05AH,050H,045H,058H,0E3H,01BH,060H,0DBH
	DB	020H,041H,045H,043H,044H,045H,052H,020H
	DB	055H,049H,055H,04CH,04CH,04FH,04EH,04FH
	DB	04FH,041H,052H,053H,054H,055H,020H,045H
	DB	041H,059H,05AH,020H,020H,020H,020H,020H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	030H,030H,030H,030H,030H,000H,030H,000H
	DB	06CH,06CH,06CH,000H,000H,000H,000H,000H
	DB	06CH,06CH,0FEH,06CH,0FEH,06CH,06CH,000H
	DB	030H,0F8H,02CH,078H,0D0H,07CH,030H,000H
	DB	000H,0C6H,066H,030H,018H,0CCH,0C6H,000H
	DB	01CH,036H,036H,01CH,0D6H,066H,0DCH,000H
	DB	060H,030H,018H,000H,000H,000H,000H,000H
	DB	060H,030H,018H,018H,018H,030H,060H,000H
	DB	00CH,018H,030H,030H,030H,018H,00CH,000H
	DB	030H,0B4H,078H,0FCH,078H,0B4H,030H,000H
	DB	000H,030H,030H,0FCH,030H,030H,000H,000H
	DB	000H,000H,000H,000H,000H,030H,030H,018H
	DB	000H,000H,000H,0FEH,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,038H,038H,000H
	DB	000H,0C0H,060H,030H,018H,00CH,006H,000H
	DB	07CH,0C6H,0E6H,0D6H,0CEH,0C6H,07CH,000H
	DB	030H,038H,03CH,030H,030H,030H,0FCH,000H
	DB	07CH,0C6H,0C0H,070H,01CH,006H,0FEH,000H
	DB	07CH,0C6H,0C0H,07CH,0C0H,0C6H,07CH,000H
	DB	060H,070H,058H,06CH,0FEH,060H,060H,000H
	DB	0FEH,006H,03EH,060H,0C0H,066H,03CH,000H
	DB	078H,00CH,006H,07EH,0C6H,0C6H,07CH,000H
	DB	0FEH,0C6H,060H,030H,018H,018H,018H,000H
	DB	07CH,0C6H,0C6H,07CH,0C6H,0C6H,07CH,000H
	DB	07CH,0C6H,0C6H,0FCH,0C0H,060H,03CH,000H
	DB	000H,000H,030H,000H,000H,030H,000H,000H
	DB	000H,000H,030H,000H,000H,030H,030H,018H
	DB	070H,018H,00CH,006H,00CH,018H,070H,000H
	DB	000H,000H,0FEH,000H,0FEH,000H,000H,000H
	DB	00EH,018H,030H,060H,030H,018H,00EH,000H
	DB	07CH,0C6H,0C0H,070H,018H,000H,018H,000H
	DB	078H,0CCH,0E6H,0D6H,066H,00CH,078H,000H
	DB	038H,06CH,0C6H,0FEH,0C6H,0C6H,0C6H,000H
	DB	07EH,0CCH,0CCH,07CH,0CCH,0CCH,07EH,000H
	DB	078H,0CCH,006H,006H,006H,0CCH,078H,000H
	DB	03EH,06CH,0CCH,0CCH,0CCH,06CH,03EH,000H
	DB	0FEH,006H,006H,03EH,006H,006H,0FEH,000H
	DB	0FEH,006H,006H,03EH,006H,006H,006H,000H
	DB	078H,0CCH,006H,0E6H,0C6H,0CCH,078H,000H
	DB	0C6H,0C6H,0C6H,0FEH,0C6H,0C6H,0C6H,000H
	DB	078H,030H,030H,030H,030H,030H,078H,000H
	DB	0F0H,060H,060H,060H,060H,066H,03CH,000H
	DB	0C6H,066H,036H,01EH,036H,066H,0C6H,000H
	DB	006H,006H,006H,006H,006H,006H,0FEH,000H
	DB	0C6H,0EEH,0FEH,0D6H,0C6H,0C6H,0C6H,000H
	DB	0C6H,0CEH,0DEH,0F6H,0E6H,0C6H,0C6H,000H
	DB	038H,06CH,0C6H,0C6H,0C6H,06CH,038H,000H
	DB	07EH,0C6H,0C6H,07EH,006H,006H,006H,000H
	DB	038H,06CH,0C6H,0C6H,0B6H,06CH,0D8H,000H
	DB	07EH,0C6H,0C6H,07EH,036H,066H,0C6H,000H
	DB	07CH,0C6H,006H,07CH,0C0H,0C6H,07CH,000H
	DB	0FCH,030H,030H,030H,030H,030H,030H,000H
	DB	0C6H,0C6H,0C6H,0C6H,0C6H,0C6H,07CH,000H
	DB	0C6H,0C6H,0C6H,06CH,06CH,038H,038H,000H
	DB	0C6H,0C6H,0C6H,0D6H,0FEH,0EEH,0C6H,000H
	DB	0C6H,0C6H,06CH,038H,06CH,0C6H,0C6H,000H
	DB	0CCH,0CCH,0CCH,078H,030H,030H,030H,000H
	DB	0FEH,0C0H,060H,038H,00CH,006H,0FEH,000H
	DB	07CH,00CH,00CH,00CH,00CH,00CH,07CH,000H
	DB	000H,006H,00CH,018H,030H,060H,0C0H,000H
	DB	07CH,060H,060H,060H,060H,060H,07CH,000H
	DB	030H,078H,0CCH,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,0FEH,000H
	DB	00CH,018H,030H,000H,000H,000H,000H,000H
	DB	000H,000H,03CH,060H,07CH,066H,0DCH,000H
	DB	006H,006H,076H,0CEH,0C6H,0CEH,076H,000H
	DB	000H,000H,07CH,0C6H,006H,0C6H,07CH,000H
	DB	0C0H,0C0H,0DCH,0E6H,0C6H,0E6H,0DCH,000H
	DB	000H,000H,07CH,0C6H,0FEH,006H,07CH,000H
	DB	070H,0D8H,018H,07EH,018H,018H,018H,000H
	DB	000H,000H,0DCH,0E6H,0E6H,0DCH,0C0H,07CH
	DB	006H,006H,076H,0CEH,0C6H,0C6H,0C6H,000H
	DB	030H,000H,038H,030H,030H,030H,078H,000H
	DB	060H,000H,070H,060H,060H,060H,066H,03CH
	DB	006H,006H,066H,036H,01EH,03EH,066H,000H
	DB	038H,030H,030H,030H,030H,030H,078H,000H
	DB	000H,000H,06EH,0D6H,0D6H,0D6H,0C6H,000H
	DB	000H,000H,076H,0CEH,0C6H,0C6H,0C6H,000H
	DB	000H,000H,07CH,0C6H,0C6H,0C6H,07CH,000H
CF048:	DB	000H,000H,076H,0CEH,0CEH,076H,006H,006H
	DB	000H,000H,0DCH,0E6H,0E6H,0DCH,0C0H,0C0H
	DB	000H,000H,076H,0CEH,006H,006H,006H,000H
	DB	000H,000H,0FCH,006H,07CH,0C0H,07EH,000H
	DB	018H,018H,07EH,018H,018H,0D8H,070H,000H
	DB	000H,000H,0C6H,0C6H,0C6H,0E6H,0DCH,000H
	DB	000H,000H,0C6H,0C6H,0C6H,06CH,038H,000H
	DB	000H,000H,0C6H,0D6H,0D6H,0FEH,06CH,000H
	DB	000H,000H,0C6H,06CH,038H,06CH,0C6H,000H
	DB	000H,000H,0C6H,0C6H,0E6H,0DCH,0C0H,07CH
	DB	000H,000H,0FEH,060H,038H,00CH,0FEH,000H
	DB	030H,018H,018H,00CH,018H,018H,030H,000H
	DB	018H,018H,018H,018H,018H,018H,018H,000H
	DB	018H,030H,030H,060H,030H,030H,018H,000H
	DB	000H,000H,000H,0DCH,076H,000H,000H,000H
	DB	038H,038H,07CH,038H,010H,000H,07CH,000H
CF0C8:	DB	000H,000H,060H,030H,066H,000H,06CH,018H
	DB	0ECH,0D8H,06CH,018H,060H,030H,000H,000H
	DB	066H,000H,060H,030H,038H,038H,0D8H,070H
	DB	0F8H,0D0H,066H,000H,06CH,018H,060H,030H
	DB	07CH,000H,066H,000H,06CH,018H,06CH,018H
	DB	0D8H,078H,060H,030H,000H,000H,060H,030H
	DB	018H,030H,060H,030H,06CH,018H,000H,000H
	DB	06CH,018H,000H,000H,07EH,060H,000H,000H
	DB	060H,030H,060H,07CH,066H,0FEH,06CH,07CH
	DB	06CH,07EH,06CH,0FEH,060H,07EH,000H,000H
	DB	06CH,0C6H,060H,078H,038H,0BAH,066H,036H
	DB	0DEH,036H,066H,07CH,06CH,0F6H,060H,07CH
	DB	07CH,038H,066H,07CH,06CH,07EH,06CH,07CH
	DB	06CH,0FCH,030H,0DEH,000H,000H,060H,0FEH
	DB	00CH,07CH,060H,0FCH,06CH,0FEH,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,020H,010H,024H,000H,028H,010H
	DB	068H,050H,028H,010H,020H,010H,000H,000H
	DB	024H,000H,020H,010H,018H,018H,098H,050H
	DB	0B8H,050H,024H,000H,028H,010H,020H,010H
	DB	03CH,000H,024H,000H,028H,010H,028H,010H
	DB	058H,028H,020H,010H,000H,000H,020H,010H
	DB	008H,010H,020H,010H,028H,010H,000H,000H
	DB	028H,010H,000H,000H,07EH,040H,000H,000H
	DB	020H,010H,020H,03CH,024H,07EH,028H,03CH
	DB	028H,03EH,028H,07EH,020H,03EH,000H,000H
	DB	024H,042H,020H,038H,018H,05AH,012H,00AH
	DB	02AH,012H,024H,03CH,028H,052H,020H,03CH
	DB	03CH,018H,024H,03CH,028H,03EH,028H,03CH
	DB	028H,07CH,010H,04AH,000H,000H,020H,07EH
	DB	004H,03CH,020H,054H,028H,07EH,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H

;	***** LIST vypise znak na tiskarne *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LF1C8:	CALL	SF1DD			;listst vrati status tiskarny
	JR	Z,LF1C8
	LD	A,C
	OUT	(0FFH),A
	LD	A,80H
	OUT	(0FEH),A
LF1D4:	IN	A,(0FEH)
	RRA
	JR	NC,LF1D4
	XOR	A
	OUT	(0FEH),A
	RET

;	***** LISTST vrati status tiskarny *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SF1DD:	IN	A,(0FEH)
	RRA
	CCF
	SBC	A,A
	RET

;	***** PUNCH vyderuje znak na derne pasce *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LF1E3:	IN	A,(0B1H)
	BIT	2,A
	JR	Z,LF1E3
	LD	A,C
	OUT	(0B0H),A
LF1EC:	RET

;	***** READER precte znak ze snimace derne p. *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LF1ED:	IN	A,(0B1H)
	RRA
	JR	NC,LF1ED
	IN	A,(0B0H)
	RET

;	***** HOME nastavi hlavu na st. 0 u vyb.d. *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LF1F5:	XOR	A
	LD	(WFBE8),A		;stopa
	RET

;	***** SELDSK vybere diskovou jednotku *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LF1FA:	LD	A,4
	XOR	C
	JR	Z,LF219
	LD	A,(PEA36)		;cislo poslesledniho disku v systemu
	CP	1
	ADC	A,0
	CP	C
	JR	C,LF21F
LF209:	LD	A,C
	LD	(VFBE7),A
LF20D:	ADD	A,A
	ADD	A,A
	ADD	A,A
	ADD	A,A
	LD	BC,CF23B
	LD	H,0
	LD	L,A
	ADD	HL,BC
	RET

LF219:	LD	A,(PEA3F)		;velikost ram v jednotkach 16kB
	AND	A
	JR	NZ,LF209
LF21F:	LD	(WFC14),SP
	LD	SP,XFC2E
	LD	DE,CF7F8
	CALL	XF8E5
	LD	SP,(WFC14)
	JR	Z,LF233
	AND	A
LF233:	SBC	HL,HL
	RET	NC
LF236:	LD	A,(VFBE7)
	JR	LF20D

;	DPH
;	~~~

CF23B:	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DW	XFC2E					;adresar
	DW	XF28B					;dpb
	DB	0AEH,0FCH,02EH,0FDH
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DW	XFC2E					;adresar
	DW	PF29A					;dpb
	DB	0CEH,0FCH,05AH,0FDH
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DW	XFC2E					;adresar
	DW	PF2A9					;dpb
	DB	0EEH,0FCH,086H,0FDH
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DW	XFC2E					;adresar
	DW	PF2B8					;dpb
	DB	00EH,0FDH,0B2H,0FDH
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DW	XFC2E					;adresar
	DW	XF2C7					;dpb
	DB	02EH,0FDH,0DEH,0FDH

;	DPB
;	~~~

XF28B:	DB	048H,000H,005H,01FH,001H,05EH,001H,0FFH
	DB	000H,0C0H,000H,020H,000H,004H,000H

PF29A:	DB	048H,000H,005H,01FH,001H,05EH,001H,0FFH
	DB	000H,0C0H,000H,020H,000H,004H,000H

PF2A9:	DB	048H,000H,005H,01FH,001H,05EH,001H,0FFH
	DB	000H,0C0H,000H,020H,000H,004H,000H

PF2B8:	DB	048H,000H,005H,01FH,001H,05EH,001H,0FFH
	DB	000H,0C0H,000H,020H,000H,004H,000H

XF2C7:	DB	000H,001H,004H,00FH,000H
WF2CC:	DB	000H,000H,07FH
	DB	000H,0C0H,000H,000H,000H,000H,000H

;	***** SETTRK nastavi cislo stopy *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LF2D6:	LD	A,C
	LD	(WFBE8),A		;stopa
	RET

;	***** SETSEK nastavi cislo sektoru *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LF2DB:	LD	A,C
	LD	(VFBE9),A		;sektor
	RET

;	***** SETDMA nastavi dma adresu *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SF2E0:	LD	(WFBEA),BC		;dma
	RET

;	***** READ cte nastaveny sektor *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SF2E5:	LD	(WFC14),SP
	LD	SP,XFC2E
	LD	A,(VFBE7)
	XOR	4
	JR	Z,LF31C
	XOR	A
	LD	(VFBF0),A
	LD	A,(VFBE9)		;sektor
	AND	3
	JR	Z,LF304
	CALL	SF945
	SCF
	JR	Z,LF30D
LF304:	CALL	SF9C1
	CALL	C,SF95A
	CALL	C,SF9B7
LF30D:	PUSH	AF
	CALL	SF966
	CALL	SFB8C
	POP	AF
LF315:	SBC	A,A
	INC	A
CF317:	LD	SP,(WFC14)
	RET

LF31C:	CALL	XF995
CF31F:	JR	Z,LF315
LF321:	IN	A,(C)
	LD	(HL),A
	INC	HL
	DEC	D
	JR	NZ,LF321
LF328:	SCF
	JR	LF315

;	***** WRITE zapise nastaveny sektor *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LF32B:	LD	(WFC14),SP
	LD	SP,XFC2E
	LD	A,(VFBE7)
	XOR	4
	JR	Z,LF3B0
	LD	A,C
	LD	(PEA34),A		;barva tisku na obr. - parametr write
	DEC	A
	JR	Z,LF379
	DEC	A
	JR	NZ,LF34A
	LD	A,10H
	LD	(VFBF0),A
	JR	LF37D

LF34A:	LD	HL,VFBF2
	LD	A,(HL)
	INC	HL
	LD	B,(HL)
	INC	HL
	LD	C,(HL)
	LD	HL,VFBE7
	XOR	(HL)
	INC	HL
	JR	NZ,LF379
	LD	A,(XF28B)
	INC	C
	XOR	C
	JR	NZ,LF362
	LD	C,A
	INC	B
LF362:	LD	A,B
	XOR	(HL)
	INC	HL
	JR	NZ,LF379
	LD	A,C
	XOR	(HL)
	JR	NZ,LF379
	LD	HL,VFBF0
	XOR	(HL)
	JR	Z,LF379
	DEC	(HL)
	LD	A,2
	LD	(PEA34),A		;barva tisku na obr. - parametr write
	JR	LF37D

LF379:	XOR	A
	LD	(VFBF0),A
LF37D:	CALL	SF945
	JR	Z,LF396
	CALL	SF9C1
	JR	NC,LF315
	CALL	SF95A
	LD	A,(PEA34)		;barva tisku na obr. - parametr write
	XOR	2
	SCF
	CALL	NZ,SF9B7
	JP	NC,LF315
LF396:	CALL	NC,SF95A
	LD	HL,VFBF5
	LD	(HL),1
	CALL	SF966
	EX	DE,HL
	CALL	SFB8C
	LD	A,(PEA34)		;barva tisku na obr. - parametr write
	DEC	A
	SCF
	CALL	Z,SF9C1
	JP	LF315

LF3B0:	CALL	XF995
CF3B3:	JP	Z,LF315
LF3B6:	LD	A,(HL)
	INC	HL
	OUT	(C),A
	DEC	D
	JR	NZ,LF3B6
	JP	LF328

;	***** SECTRN prevede log. c. sec. na fyzicke *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LF3C0:	LD	H,B			;fiktivni prevod
	LD	L,C
	RET
	NOP				

;	***** INTERUPT ADRESS *****
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~

PF3C4:	DW	PF3C6
PF3C6:	LD	(WFBF6),SP
	LD	SP,WFC14
	PUSH	AF
	PUSH	BC
	PUSH	DE
	PUSH	HL
	IN	A,(0E0H)
	CALL	SF418
	IN	A,(0E1H)
	XOR	A
	LD	HL,PEA33		;barva pozadi obr.   - doba do off fd
	CP	(HL)
	JR	Z,LF3E4
	DEC	(HL)
	JR	NZ,LF3E4
	OUT	(0DCH),A
LF3E4:	LD	A,0F8H
	OUT	(0D0H),A
	IN	A,(0D1H)
	AND	0C1H
	LD	HL,VFBDA
	JR	Z,LF402
	BIT	2,(HL)
	JR	Z,LF3F7
	IN	A,(0E0H)
LF3F7:	POP	HL
	POP	DE
	POP	BC
	POP	AF
	LD	SP,(WFBF6)
	EI
	RETI

LF402:	LD	SP,100H	
	RES	2,(HL)
LF407:	IN	A,(0D1H)
	INC	A
	JR	NZ,LF407
	SBC	HL,HL
	PUSH	HL
	LD	HL,XF8E5
	PUSH	HL
	LD	DE,CF7CA
	RETI

SF418:	LD	A,(VFBDA)
	RRA
	JR	C,LF427
	RRCA
	LD	B,A
	IN	A,(0D2H)
	RLA
	XOR	B
	CALL	P,SF641
LF427:	LD	A,80H
	OUT	(0D7H),A
	LD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A
LF586:	BIT	1,(HL)
	SCF
	RET	Z
	RES	1,(HL)
	LD	A,0A0H
	XOR	D
	LD	D,A
	PUSH	DE
	CALL	SF753			;zobrazeni klicu
	POP	DE
	SCF
	RET

LF597:	SET	7,E
	SCF
CF59A:	RET

;	KEY KOD delka 0A0h 160d
;	~~~~~~~

	DB	000H,000H,000H,084H,083H,082H,081H,080H
	DB	000H,000H,000H,000H,000H,000H,000H,01BH
	DB	02FH,03FH,013H,004H,018H,005H,07FH,008H
	DB	02EH,02CH,039H

LF5B6:	DB	030H,020H,02DH,05EH,05CH,038H,037H,036H
	DB	035H,034H,033H,032H,031H,068H,067H,066H
	DB	065H,064H,063H,062H,061H,070H,06FH,06EH
	DB	06DH,06CH,06BH,06AH,069H,078H,077H,076H
	DB	075H,074H,073H,072H,071H,000H,000H,000H
	DB	05DH,05BH,040H,07AH,079H,00DH,03AH,03BH
	DB	009H,08AH,08FH,08BH

CF5EA:	DB	08CH,000H,000H,000H,089H,088H,087H,086H
	DB	085H,000H,000H,000H,000H,000H,000H,000H
	DB	003H,017H,01AH,001H,006H,003H,012H,007H
	DB	014H,03EH,03CH,029H,05FH,020H,03DH,07EH
	DB	07CH,028H,027H,026H,025H,024H,023H,022H
	DB	021H,048H,047H,046H,045H,044H,043H,042H
	DB	041H,050H,04FH,04EH,04DH,04CH,04BH,04AH
	DB	049H,058H,057H,056H,055H,054H,053H,052H
	DB	051H,000H,000H,000H,07DH,07BH,060H,05AH
	DB	059H,00AH,02AH,02BH,009H,08AH,08EH,08BH
	DB	08DH

SF63B:	LD	HL,VFBDA
	BIT	1,(HL)
	RET	Z
SF641:	PUSH	AF
	LD	A,2
	LD	HL,VFBDA
	XOR	(HL)
	LD	(HL),A
	LD	B,8
	LD	DE,50H
	LD	HL,(WFBE1)
LF651:	LD	A,(HL)
	CPL
	LD	(HL),A
	ADD	HL,DE
	DJNZ	LF651
	POP	AF
	RET

LF659:	LD	A,H			;insert line
	CP	18H
	JP	Z,LF6D0
	CP	1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

CF7F8:	DB	'Disk select error: Abort/Ignor',0E5H

CF817:	DB	'NORMCAPSGRAPGRAP'

;	ZOBRAZENI TIME
;	~~~~~~~~~~~~~~

SF827:	EX	DE,HL
	LD	(WFBD8),HL
	LD	HL,0BC91H
	LD	(WFBE3),HL
	LD	HL,(PEA40)			;realny cas
	ADD	HL,DE
	LD	(PEA40),HL			;realny cas
	LD	A,(PEA42)			;realny cas
	ADC	A,0
	LD	(PEA42),A			;realny cas
	JR	Z,LF853
	LD	DE,5180H
	SBC	HL,DE
	ADD	HL,DE
	JR	C,LF853
	SBC	HL,DE
	LD	(PEA40),HL			;realny cas
	XOR	A
	LD	(PEA42),A			;realny cas
LF853:	RRA
	LD	B,2
	LD	DE,8CA0H
	RR	H
	RR	L
	PUSH	AF
	CALL	SF893
	LD	B,4
	LD	DE,7080H
	POP	AF
	ADC	HL,HL
	CALL	SF893
	LD	A,03AH
	CALL	SF8A8
	LD	B,3
	LD	DE,960H
	CALL	SF893
	LD	B,4
	LD	DE,1E0H
	CALL	SF893
	LD	A,03AH
	CALL	SF8A8
	LD	B,3
	LD	DE,28H
	CALL	SF893
	LD	A,030H
	ADD	A,L
	JR	SF8A8

SF893:	XOR	A
	DEC	A
LF895:	SBC	HL,DE
	JR	NC,LF89A
	ADD	HL,DE
LF89A:	RLA
	SRL	D
	RR	E
	DJNZ	LF895
	CPL
	ADD	A,030H
	JR	SF8A8

SF8A6:	LD	A,020H
SF8A8:	PUSH	IX
	DB	0DDH			;ixh - 0h
	LD	H,0
	JR	LF8B6

SF8AF:	LD	A,020H
SF8B1:	PUSH	IX
	DB	0DDH			;ixh - 0ffh
	LD	H,0FFH
LF8B6:	PUSH	BC
	PUSH	DE
	PUSH	HL
	ADD	A,A
	LD	H,0
	LD	L,A
	ADD	HL,HL
	ADD	HL,HL
	LD	BC,CECC8
	ADD	HL,BC
	EX	DE,HL
	LD	BC,50H
	LD	HL,(WFBE3)
	INC	HL
	LD	(WFBE3),HL
	DEC	HL
	DB	0DDH			;ixl - 7h
	LD	L,7
LF8D2:	LD	A,(DE)
	INC	E
	DB	0DDH			;xor ixh
	XOR	H
	LD	(HL),A
	ADD	HL,BC
	DB	0DDH			;dec ixl
	DEC	L
	JR	NZ,LF8D2
	POP	HL
	POP	DE
	POP	BC
	POP	IX
	RET

SF8E2:	LD	DE,CF7D4
XF8E5:	CALL	SFBB0
	LD	B,03DH
	LD	HL,0BC50H
	LD	(WFBE3),HL
	CALL	SF8AF
LF8F3:	LD	A,(DE)
	CALL	SF8B1
	LD	A,(DE)
	DEC	B
	INC	DE
	RLA
	JR	NC,LF8F3
LF8FD:	CALL	SF8AF
	DJNZ	LF8FD
	CALL	SF8A6
	CALL	SF8A6
	CALL	SF63B
	LD	HL,(WFBE1)
	PUSH	HL
	LD	HL,0BC8FH
	LD	(WFBE1),HL
	CALL	SFBC5
	CALL	SEB24
	CALL	SF468
	CALL	SEAB7			;conin	cte znak z console
	LD	L,A
	DI
	IN	A,(0E0H)
	LD	A,L
	CALL	SF63B
	POP	HL
	PUSH	AF
	LD	A,0BBH
	CP	H
	JR	NC,LF932
	INC	HL
	INC	HL
LF932:	LD	(WFBE1),HL
	CALL	SF753			;zobrazeni klicu
	CALL	SFBC5
	LD	A,05FH
	POP	BC
	AND	B
	CP	041H
	RET	Z
	ADD	A,0B7H
	RET

SF945:	LD	DE,VFBE7
	LD	HL,VFBF2
	LD	A,(DE)
	INC	DE
	CPI
	RET	NZ
	LD	A,(DE)
	INC	DE
	CPI
	RET	NZ
	LD	A,(DE)
	XOR	(HL)
	AND	0FCH
	RET

SF95A:	LD	BC,3H
	LD	DE,VFBF2
	LD	HL,VFBE7
	LDIR
	RET

SF966:	LD	A,(VFBE9)		;sektor
	LD	BC,80H
	AND	3
	RRA
	LD	D,A
	LD	E,B
	RR	E
	LD	HL,XFDFE		;boot vstup do biosu
	ADD	HL,DE
	LD	DE,(WFBEA)		;dma
	RET

	CALL	SFBB0

SF97F:	LD	A,(VFBF2)
	LD	HL,PEA37		;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
	JR	LFA3A

	DB	000H

WFA38:	DW	SF8E2
LFA3A:	ADD	A,1
	JR	Z,LFA4A
LFA3E:	CALL	SFAEC
	POP	BC
	DJNZ	LF9DE
	DB	0CDH			;call f8e2
WFA45:	DW	SF8E2
	JR	NZ,LF9D9
	PUSH	BC
LFA4A:	POP	BC
	LD	HL,VFBF5
	LD	(HL),0
	RET

SFA51:	PUSH	HL
	DB	021H			;ld	hl,0fa53h
WFA53:	DW	CFA65
	LD	DE,38H
	LD	B,7
LFA5A:	LD	A,(DE)
	LD	C,(HL)
	LD	(HL),A
	LD	A,C
	LD	(DE),A
	INC	HL
	INC	DE
	DJNZ	LFA5A
	POP	HL
	RET

;	FDC CTENI
;	~~~~~~~~~

CFA65:	IN A,(0DBH)
	CPL
	LD (HL),A
	INC HL
	EI
	RET

;	FDC ZAPIS
;	~~~~~~~~~

CFA6C:	OUT (0DBH),A
	INC HL
	LD A,(HL)
	CPL
	EI
	RET

SFA73:	LD	BC,CFBF1
	LD	A,(BC)
	LD	DE,CFBEC
	LD	H,0
	LD	L,A
	ADD	HL,DE
	IN	A,(0D9H)
	LD	(HL),A
	INC	BC
	LD	A,(BC)
	DEC	BC
	LD	(BC),A
	LD	H,0
	LD	L,A
	ADD	HL,DE
	LD	A,(HL)
	OUT	(0D9H),A
	LD	A,(BC)
LFA8D:	OR	84H
	CALL	SFBB0
	OUT	(0DCH),A
	LD	HL,PEA33		;barva pozadi obr.   - doba do off fd
	LD	A,(HL)
	LD	(HL),80H
	CALL	SFBC5
	AND	A
	RET	NZ
	LD	HL,(PEA3B)		;doba rozbehu disku v mS
LFAA2:	DJNZ	LFAA2
	DEC	HL
	LD	A,H
	OR	L
	JR	NZ,LFAA2
	RET

SFAAA:	LD	A,(VFBF4)
	SRL	A
	SRL	A
	INC	A
	CPL
	OUT	(0DAH),A
	CALL	SF97F
	LD	A,(VFBF3)
	JR	C,LFABE
	ADD	A,A
LFABE:	OUT	(0DDH),A		;fdc strana
	SRL	A
	LD	H,A
	IN	A,(0D9H)		;fdc stopa
	CPL
	SUB	H
	CCF
	RET	Z
	LD	L,A
	JR	NC,LFAD4
LFACC:	DB	0CDH			;call 0fb60h
WFACD:	DW	XFB60
	DEC	L
	JR	NZ,LFACC
	JR	LFADA
LFAD4:	DB	0CDH			;call 0fb5ch
WFAD5:	DW	XFB5C
	INC	L
	JR	NZ,LFAD4
LFADA:	IN	A,(0D9H)
	XOR	H
	ADD	A,1
LFADF:	LD	A,(PEA3D)		;ustaleni hlavy na stope
SFAE2:	PUSH	BC
	LD	B,0
LFAE5:	DJNZ	LFAE5			;wait
	DEC	A
	JR	NZ,LFAE5
	POP	BC
	RET

;	20 ms fd motor off
;	~~~~~~~~~~~~~~~~~~

SFAEC:	LD	A,0FFH
	LD	(PEA33),A		;barva pozadi obr.   - doba do off fd
	IN	A,(0D8H)
	RRA
	CALL	NC,SFB6A		;fdc zastaveni bez preruseni
	JR	LFB48

	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H

LFB48:	DB	02EH,050H

LFB4A:	CALL	XFB60
	DEC	L
	JR	Z,LFADF
	IN	A,(0D8H)
	BIT	2,A
	JR	NZ,LFB4A
	LD	A,0FFH
	OUT	(0D9H),A
	JR	LFADF

XFB5C:	LD	A,0A7H
	JR	LFB62

XFB60:	LD	A,87H
LFB62:	OUT	(0D8H),A
	LD	A,(PEA3E)		;doba kroku diskove hlavy v mS
	CALL	SFAE2
SFB6A:	LD	A,2FH			;fdc zastaveni bez preruseni
	OUT	(0D8H),A
	CALL	SFB87
LFB71:	IN	A,(0D8H)
	RRA
	JR	C,SFB87
	DJNZ	LFB71
	JR	SFB6A			;fdc zastaveni bez preruseni

;	TEST FD
;	~~~~~~~

SFB7A:	CALL	SFB87
LFB7D:	IN	A,(0D8H)
	AND	81H
	XOR	80H
	RET	Z
	DJNZ	LFB7D
	RET

;	WAIT
;	~~~~

SFB87:	LD B,18H
LFB89:	DJNZ	LFB89
	RET

;	WAIT
;	~~~~

SFB8C:	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	LDI
	JP	PE,SFB8C
	RET

SFBB0:	PUSH	AF
LFBB1:	LD	A,I
	PUSH	AF
	POP	HL
	LD	A,I
	LD	A,L
	PUSH	AF
	POP	HL
	CP	L
	JR	NZ,LFBB1
	LD	(PEA43),A		;rs-232   priznak prer. 0 zak. 1 povol.
	DI
	IN	A,(0E0H)
	POP	AF
	RET

;	TEST NA EI
;	~~~~~~~~~~

SFBC5:	PUSH	AF
	IN	A,(0E1H)
	LD	A,(PEA43)		;rs-232   priznak prer. 0 zak. 1 povol.
	BIT	2,A
	JR	Z,LFBD0
	EI
LFBD0:	POP	AF
	RET

VFBD2:	DB	000H

WFBD3:	DB	000H,000H

CFBD5:	DB	000H

WFBD6:	DB	000H			;key

VFBD7:	DB	000H

WFBD8:	DB	000H,000H

VFBDA:	DB	000H

WFBDB:	DB	073H,0ECH

WFBDD:	DB	073H,0ECH

WFBDF:	DB	050H,018H		;max radek sloupec

WFBE1:	DB	000H,080H

WFBE3:	DB	000H,000H

WFBE5:	DB	000H

VFBE6:	DB	000H

VFBE7:	DB	000H

WFBE8:	DB	000H			;stopa

VFBE9:	DB	000H			;sektor

WFBEA:	DB	000H,000H		;dma

CFBEC:	DB	0FDH,0FDH,0FDH,0FDH

VFBF0:	DB	000H

CFBF1:	DB	000H

VFBF2:	DB	000H

VFBF3:	DB	0FFH

VFBF4:	DB	0FFH

VFBF5:	DB	000H

WFBF6:	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H

WFC14:	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H

;	BOOT ZASOBNIK vyrovnavaci pamet pro adresar
;	~~~~~~~~~~~~~

XFC2E:	LD	HL,LFC63
	LD	BC,000CH
	LD	DE,CF31F
	LDIR
	LD	BC,0DH
	LD	DE,CF3B3
	LDIR
	LD	BC,22H
	LD	DE,XF995
	LDIR
	LD	A,02AH
	LD	(VFFBF),A
	LD	HL,CFCD3
	INC	(HL)
	INC	HL
	INC	(HL)
	LD	HL,4440H
	LD	(WFCD6),HL
	LD	A,20H
	LD	HL,PEA3F		;velikost ram v jednotkach 16kB
	CP	(HL)
	RET	NC
	LD	(HL),A
	RET

LFC63:	LD	B,E
	IN	B,(C)
	LD	B,D
	INI
	INC	E
	DEC	A
	JR	NZ,LFC63
	XOR	A
	RET

	INC	D
LFC70:	LD	B,E
	IN	B,(C)
	LD	B,D
	OUTI
	INC	E
	DEC	A
	JR	NZ,LFC70
	XOR	A
	RET

	LD	HL,(WFBE8)		;stopa
	XOR	A
	SRL	L
	RR	H
	LD	A,L
	LD	L,0
	RR	L
	ADD	A,0ECH
	CP	0F0H
	JR	C,LFC91
	SUB	8
LFC91:	LD	C,A
	LD	A,80H
	EX	DE,HL
	LD	HL,CF317
	EX	(SP),HL
	PUSH	HL
	LD	HL,(WFBEA)		;dma
	RET

SFC9E:	IN	A,(0F8H)		;test ramdisku
	LD	HL,8H
LFCA3:	CALL	SFCD1
	CP	L
	JR	NZ,LFCAF
	INC	HL
	BIT	4,L
	JR	Z,LFCA3
	RET

LFCAF:	LD	HL,CFCD9		;inicializace ramdisku
	INC	(HL)
	LD	HL,0H
	LD	DE,CFFE0
	LD	B,20H
LFCBB:	LD	A,(DE)
	INC	DE
	CALL	SFCD1
	INC	HL
	DJNZ	LFCBB
	LD	A,0E5H
	LD	DE,20H
	LD	B,7FH
LFCCA:	CALL	SFCD1			;cteni sektoru z ramdisku
	ADD	HL,DE
	DJNZ	LFCCA
	RET

;	CTENI ZALOHOVANEHO RAMDISKU
;	~~~~~~~~~~~~~~~~~~~~~~~~~~~

SFCD1:	PUSH	BC
	DB	00EH			;ld c,0ebh
CFCD3:	DB	0EBH
	LD	B,H
	DB	0EDH			;out (c),l
WFCD6:	DB	069H
	DEC	C
	DB	0EDH			;in a,(c)
CFCD9:	DB	078H
	POP	BC
	RET

	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H

;	VYMENA DISKU
;	~~~~~~~~~~~~

CFCEE:	LD	HL,VFBF2
	LD	A,(HL)
	DEC	HL
	CP	(HL)
	JR	Z,LFD02
	LD	(HL),A
	ADD	A,041H
	LD	(VFD1A),A
	LD	DE,CFD0E		;insert disk a: push any key
	CALL	XF8E5
LFD02:	XOR	A
	JP	LFA8D

	DB	00H,00H,00H,00H,00H,00H,00H,00H

CFD0E:	DB	'Insert disk '
VFD1A:	DB	'A: / Push any ke',0F9H
	DB	00H,00H,00H

XFD2E:	DB	03CH,000H,005H,01FH,001H,024H,001H,0FFH
	DB	000H,0C0H,000H,020H,000H,004H,000H

CFD3D:	DB	024H,000H,004H,00FH,000H,05EH,001H,07FH
	DB	000H,0C0H,000H,020H,000H,004H,000H

CFD4C:	DB	024H,000H,004H,00FH,001H,0AAH,000H,07FH
	DB	000H,0C0H,000H,020H,000H,004H,000H

CFD5B:	DB	024H,000H,003H,007H,000H,0A1H,000H,03FH
	DB	000H,0C0H,000H,010H,000H,004H,000H

	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H

CFDB2:	CALL	XFB60
	LD	HL,XFB60
	JR	LFDC0

CFDBA:	CALL	XFB5C
	LD	HL,XFB5C
LFDC0:	LD	(WFDD3),HL
	LD	A,(VFBF2)
	LD	BC,PEA37		;parametry disku a
	ADD	A,C
	LD	C,A
	LD	A,(BC)
	BIT	2,A
	RET	Z
	IN	A,(0D9H)		;cteni stopy

;	FDC STOPA
;	~~~~~~~~~

CFDD1:	PUSH	AF			;uloz af
	DB	0CDH			;call 0fb5c
WFDD3:	DW	XFB5C
	POP	AF			;vyjmi af
	OUT	(0D9H),A		;fdc stopa
	RET

	DB	000H,000H,000H,000H,000H

CFDDE:	DB	000H,001H,005H,01FH,003H,000H,000H,07FH
	DB	000H,080H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H
	DB	000H,000H,000H,000H,000H,000H,000H,000H

	MACLIB	CPMBOOTN

	END

