MOUSE2ASM	;
;***	haftmann#software	***
;***	MOUSE2 f}r 2 V.24-Module***
;***	voll verschieblich	***
;***	10.04.92		***
OS	EQU	0F003H
RC	EQU	0F00FH
	ORG	3000H
ISRD
	DEFB	14H	;SCHACHT1
	DEFB	14H	;SCHACHT2
	DEFB	9	;SIOADR
	DEFB	0	;EMPFANGSBYTENR
	DEFB	7	;TASTENSTATI
	DEFB	0F6H	;USERTASTE
	DEFB	0	;FREIGABE
	DEFB	8	;MICKEY X
	DEFB	10H	;STEP X
	DEFB	8	;MICKEY Y
	DEFB	10H	;STEP Y
ISR
	PUSH	AF
	PUSH	HL
	PUSH	DE
	PUSH	BC
	;
	CALL	RC
	DEFW	0
NEXT	POP	HL
	LD	DE,ISRD-NEXT
	ADD	HL,DE	;Datenzeiger
	LD	B,M
	LD	C,80H
	XOR	A
	OUT	(C),A	;M003 (1) aus
	INC	HL
	LD	B,M
	INC	A
	OUT	(C),A	;M003 (2) ein
	PUSH	HL
	;
	INC	HL
	LD	C,M	;SIOADR
	IN	D,(C)	;Byte holen
	INC	HL
	;
	XOR	A
	OR	M	;Null?
	JR	NZ,DIRECT
	LD	A,D
	AND	0F8H
	CP	80H
	JR	NZ,EXIT
	INC	M
	INC	HL	;^Tastenstati
	LD	A,D	;gelesenes Byte
	CPL
	AND	M
	LD	M,D
	INC	HL	;^Usertaste
	RRA
	JR	NC,NRIGHT
	LD	C,M
	LD	A,M
	JR	EINTR
NRIGHT	RRA
	JR	NC,NMIDDL
	INC	HL
	LD	A,M
	CPL
	JR	NOVER
NMIDDL	RRA
	JR	NC,EXIT
	LD	C,13
	LD	A,M
	JR	EINTR
DIRECT
	INC	A
	CP	5
	JR	C,DIR1
	XOR	A
DIR1	RR	M
	LD	M,A	;neue Nummer
	INC	HL
	INC	HL
	INC	HL
	LD	B,M	;Freigabe
	INC	HL
	LD	C,8	;CUL
	JR	C,DIR2
	INC	HL
	INC	HL
	LD	C,10	;CUD
DIR2	LD	A,M	;Mickey
	INC	HL
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	HL
	DEC	HL	;^SIOPORT
	POP	DE	;D=Slot,E=Port
	CP	2
	JR	C,NSIOK
	LD	A,E
	CP	10H
	JR	NC,USERSIO
	CP	4
	JR	NC,KANNR
	DEC	A
KANNR	AND	1
	ADD	8	;V.24
USERSIO	LD	M,A
NSIOK	LD	A,B
	OR	A
	DEC	HL	;^Schacht2
	JR	Z,SIOSL
	LD	A,D
	OR	A
	JR	Z,SIOTOT
	LD	M,D
SIOSL	LD	D,M	;D=0: SIO t|ten
SIOTOT	DEC	HL	;^Schacht1
	LD	BC,780H
MM03	INC	B
	JR	Z,NM03
	IN	A,(C)
	CP	0EEH
	JR	NZ,MM03
NM03	LD	M,B	;merken
	XOR	A
	OUT	(C),A	;aus
	INC	HL	;^Schacht2
	LD	B,M
	INC	A
	OUT	(C),A	;ein
	INC	HL	;^SIOPort
	LD	A,M
	ADD	4	;CTC
	PUSH	HL
	LD	BC,INITTB-ISRD-2
	ADD	HL,BC
	LD	C,A
	LD	B,2
	OTIR
	SUB	2
	LD	C,A
	SET	0,C	;f.Kanal B
	LD	B,2
	OTIR
	LD	C,A
	LD	B,9
	OTIR
	LD	A,D
	OR	A
	JR	NZ,NTOT
	LD	B,2
	OTIR
NTOT	POP	HL	;^Port
	EI
	DEC	HL
	LD	B,M
	LD	E,B
	LD	C,80H
	LD	D,0B8H
	LD	A,(DE)
	OUT	(C),A
	DEC	HL
	LD	B,M
	LD	E,B
	LD	A,(DE)
	OUT	(C),A
	RET
А@Аt(Аp6АnTop of Text: End of Text: Start of MC: ASM-Offset : хЫ€ц$У€сЙхЫ€жЫУ€сЙНMА~#НDАфЙED(DE)
	OUT	(C),A
	RET
А@Аt(Аp6АnTop of Text: End of Text: Start of MC: ASM-Offset : хЫ€ц$У€сЙхЫ€жЫУ€сЙНMА~#НDАфЙED