3000 330c 0000 S ... IIC-HEAR.A
	PN	IIC-TREIBER
;
	ORG	08000H
PIIC:	EQU	056H
PDR:	EQU	050H
;
BEGIN:	CALL	INIT
LOOP:	CALL	IHEAR
	LD	H,090H
	LD	L,D
	LD	M,0FFH
	RST	020H
	DB	4
	CMP	3
	JRNZ	LOOP-#
	RST	038H
;
IHEAR:	IN	PIIC
	AND	12
	JRNZ	IHEAR-#
WSTB:	IN	PIIC
	AND	12
	CMP	8
	JRZ	STBUS-#
	OR	A
	JRZ	WSTB-#
	JR	IHEAR-#
STBUS:	LD	B,8
NBIT:	IN	PIIC
	BIT	2,A
	JRZ	NBIT-#
SCLL:	IN	PIIC
	BIT	2,A
	JRNZ	SCLL-#
	SCF
	BIT	3,A
	JRZ	SDAH-#
	CCF
SDAH:	RL	D
	DJNZ	NBIT-#
	RET
;
INIT:	LD	A,0FFH
	OUT	PIIC
	OUT	PIIC+1
	LD	A,0FCH
	OUT	PIIC+1
	RET
START:	IN	PIIC
	AND	00CH
	JRNZ	NOTI-#
	LD	A,1
	OUT	PIIC
	RET
NOTI:	LD	B,8
NO2:	DJNZ	NO2-#
	JR	START-#
STOP:	IN	PIIC
	OR	3
	OUT	PIIC
	RET
IDENT:	CALL	NAME
	RST	020H
	DB	2
	DB	' present.'
	DB	08DH
	SCF
	RET
NAME:	RST	020H
	DB	2
	DB	'IC'
	DB	0A0H
	LD	A,D
	RST	020H
	DB	6
	RET
	END
;
	END