DIOJOYNASM 
 
;JOYSTICK-Routine f}r KC 85/3/4
;Datum:	30.03.1989
;Bearbeiter: pi-soft
 
 
PIAD	EQU	4
PIAC	EQU	6
CTC	EQU	0
;---------------------------------------
	ORG	100H
	DEFW	INT	;Vektor
 
	DEFW	7F7FH
	DEFM	'JOY'
	DEFB	1
	LD	A,0FFH
	OUT	(PIAC),A
	LD	A,1FH	;Maske
	OUT	(PIAC),A
	XOR	A	;Int.Vektor
	OUT	(CTC),A
	LD	A,0B7H
	OUT	(CTC),A
	LD	A,0FFH	;Zeitkonstante
JOUT:	OUT	(CTC),A
	RET
;---------------------------------------
 	DEFW	7F7FH
	DEFM	'JOF'
	DEFB	1
	LD	A,3
	JR	JOUT
 
INT:	PUSH	AF
	PUSH	HL
	EI
	IN	A,(PIAD)
	AND	1FH	;nur Bit 0-4
	CP	1FH
	JR	NZ,INT0
	BIT	2,(IX+8)
	RES	2,(IX+8)
	JR	Z,ZURU
	LD	(IX+13),0
	JR	ZURU
INT0:	LD 	HL,TAB
INT1:	INC	HL
	RR	A
	JR	C,INT1
	LD	A,M
	LD	(IX+13),A
ZURV:	SET	0,(IX+8)
	SET	2,(IX+8)
ZURU:	POP	HL
	POP	AF
	RETI
TAB:	NOP
	DEFB	11
	DEFB	13
	DEFB	10
	DEFB	8
	DEFB	9
	NOP
ےےےےےےےےےےےےےےےےےےےےےےےےےےےےےےے