	TITLÅ	'TASTATURTREIBEÒ PC1715'

; VERSION 1.0
; 07.03.89

	MACLIB	Z80

	EXTRN	?CONO

	PUBLIC	TASINI,TAB,TASABF,TABMER
	PUBLIC	TASMER

TASTE	EQU	0CH		; TASTATURZEICHEN
TASTST	EQU	0EH		; ABFRAGE DER STATUSLEITUNGEN
crtbws	equ	34h


TASTP	EQU	0FF80H
TASTPE	EQU	0FFBAH

; SPRUNGVERTEILER TASTATURAUFRUF

TASINI:	JR	TASIN		; INITIALISIERUNG DER TASTATUR
TASABF:	JR	TASCOD		; ABFRAGE, OB ZEICHEN DA

; INITIALISIERUNG DER TASTATUR

TASIN:				; TASTATUR INIT.

	MVI	A,7EH
	OUT	CRTBWS

	LXI	H,TASTAB
	MVI	B,7
	MVI	C,TASTST
	OUTIR
TASIN1:
	MVI	A,10H
	OUT	TASTST
	IN	TASTST
	BIT	0,A
	RZ
	IN	TASTE		; WARTEN BIS ALLE ZEICHEN WEG
	JR	TASIN1

;______________________________________________________________
; ABFRAGEN TASTATUR AUF BETAETIGUNG
;______________________________________________________________

TASCOD:	MVI	A,10H
	OUT	TASTST
	IN	TASTST
	BIT	0,A
	RZ			; KEIN ZEICHEN

;______________________________________________________________
; ZEICHENKODE HOLEN
;______________________________________________________________

	IN	TASTE
	CPI	0E0H		; STEUERCODE ?
	JRC	NCTRFU
	LXI	H,CTRFUB
	MOV	M,A		; STEUERCODE MERKEN
	ANI	4		; ZEICHENSATZ SI / SO
	MVI	A,0EH
	JRZ	ZSATT
	MVI	A,0FH
ZSATT:
	MOV	C,A
	JMP	?CONO
;	RET

NCTRFU:	CPI	0B0H
	JRC	NOZIF
	CPI	0BAH
	JRNC	NOZIF
	SUI	0B0H-'0'
NOZIF:	CPI	7FH
	JRC	NSTEUR

;______________________________________________________________

	MVI	B,'S'-'@'	; ^S
	CPI	0ACH		; NUMERISCHES KOMMA
	JRZ	TASTFO
	MVI	B,0DH		; RETURN
	CPI	9EH		; ET
	JRZ	TASTFO
	MVI	B,'K'-'@'	; ^K
	CPI	0BDH		; NUM. -
	JRZ	TASTFO
	MVI	B,80H
	CPI	9DH		; ^QS^X
	JRZ	TASTFO
	MVI	B,0A8H
	CPI	0BBH
	JRZ	TASTFO
	CPI	0D0H
	JRC	NOD0
	ADI	10H		; D0..DF --> E0..EF
NOD0:	LXI	H,CTRFUB
	BIT	0,M
	JRZ	TASE
	ADI	10H		; ADDITION, WENN CTRL BETAETIGT
TASE:	JR	NOCTRL

TASTFO:	MOV	A,B
	JR	TASE

;______________________________________________________________

NSTEUR:	LXI	H,CTRFUB
	BIT	0,M
	JRZ	NOCTRL
	ANI	1FH
NOCTRL:
	PUSH	PSW
	ANI	0DFH
	CPI	41H
	JRC	NOCAPS
	CPI	5BH
	JRNC	NOCAPS
	MOV	A,M
	ANI	0AH
	CPI	0AH
	JRNZ	NOCAPS
	POP	PSW
	XRI	20H
	PUSH	PSW
NOCAPS:
	LXI	H,TASTP
	LXI	B,TASTPE-TASTP
	MOV	B,C
TAPUBE:	MOV	A,M
	ORA	A
	JRZ	TAPUPO		; --> FREIE POSITION GEFUNDEN
	INX	H		; NAECHSTE POSITION PRUEFEN
	DJNZ	TAPUBE
TAPUPO:
	POP	PSW
	MOV	M,A
	STA	TASMER
	RET


;______________________________________________________________
; PUFFER
;______________________________________________________________

CTRFUB:	DB	0

TABMER:	DW	0

TASMER:	DB	0

TAB:
	DB	8DH,09H,0	; TABULATOR
	DB	9DH,09H,0
	DB	82H,16H,0	; INS
	DB	92H,16H,0
	DB	8FH,11H,7FH,0	; ^QDEL	DELLINE LEFT
	DB	87H,1,0		; ^A	CURSOR WORD LEFT
	DB	97H,11H,41H,0	; ^QA	FIND / RPLACE
	DB	8BH,5,0		; ^E	CURSOR UP
	DB	9BH,11H,45H,0	; ^QE	CURSOR TOP OF SCREEN
	DB	89H,6,0		; ^F	CURSOR WORD RIGHT
	DB	99H,11H,46H,0	; ^QF	FIND
	DB	88H,08H,0	; BS	CURSOR BACKSPACE
	DB	98H,11H,53H,0	; ^QS	CURSOR LEFT SIDE
	DB	8CH,12H,0	; ^R	CURSOR SCREEN DOWN
	DB	9CH,11H,52H,0	; ^QR	CURSOR TOP FILE
	DB	86H,4,0		; ^D	CURSOR CHAR. RIGHT
	DB	96H,11H,44H,0	; ^QD	CURSOR RIGHT SIDE
	DB	80H,11H,53H,18H,0
				; ^QS^X	CURSOR BEGIN NEXT LINE
	DB	8AH,18H,0	; ^X	CURSOR DOWN
	DB	9AH,11H,58H,0	; ^QX	CURSOR BOTTOM SCREEN
	DB	8EH,3,0		; ^C	CURSOR SCREEN UP
	DB	9EH,11H,43H,0	; ^QC	CURSOR BOTTOM FILE

	db	0a8h,'DIR',0dh,0
;	DB	0A8H,'00',0	; 00

	DB	0E1H,7,0	; ^G	DELCH
	DB	0F1H,11H,59H,0	; ^QY	DEL LINE RIGHT
	DB	0E2H,14H,0	; ^T	DEL WORD
	DB	0F2H,1,14H,0	; ^A^T	DEL WORD LEFT
	DB	0E3H,19H,0	; ^Y	DELLINE
	DB	0F3H,19H,0
	DB	0E4H,0FH,0	; ^O
	DB	0F4H,0FH,0
	DB	0CEH,10H,0	; ^P
	DB	0DEH,10H,0
	DB	0E0H,11H,0	; ^Q
	DB	0F0H,11H,0
	DB	0CFH,15H,0	; ^U
	DB	0DFH,15H,0
	DB	083H,0CH,0	; ^L
	DB	93H,11H,56H,0	; ^QV

	DB	0A0H,10H,56H,0	; ^PY
	DB	0B0H,10H,54H,0	; ^PT
	DB	0C1H,10H,53H,0	; ^PS
	DB	0D1H,10H,58H,0	; ^PX
	DB	0A1H,0BH,43H,0	; ^KC
	DB	0B1H,0BH,56H,0	; ^KV
	DB	0C0H,0BH,4EH,0	; ^KN
	DB	0D0H,0BH,59H,0	; ^KY
	DB	0A2H,0BH,42H,0	; ^KB
	DB	0B2H,11H,42H,0	; ^QB
	DB	0C2H,0BH,4BH,0	; ^KK
	DB	0D2H,11H,4BH,0	; ^QK
	DB	0A3H,2,0	; ^B
	DB	0B3H,11H,50H,0	; ^QP
	DB	0CDH,0FH,47H,0	; ^OG
	DB	0DDH,0FH,58H,0	; ^OX
	DB	0,0

TABE:

; Initialisierungstabelle der Tastatur

TASTAB:	DB	0,19H,0,3,0C1H,4,4

	END

