; codecml.asm
; 8255 assistance

; L. Stewart, July 9, 1982  3:57 PM

C←CODE SEGMENT

$INCLUDE(Lark.d)

C←DATA   SEGMENT

C←DATA   ENDS

ASSUME CS:C←CODE, DS:C←DATA

; Set up codec with time slot word passed in BX
←setcodec	PROC	NEAR
	MOV	AL,0		; clear clock
	OUT	pioc,AL
tsnlow:				; wait for not TSN
	IN	AL,pioc
	TEST	AL,2
	JNZ	tsnlow
tsnhigh:			; wait for TSN
	IN	AL,pioc
	TEST	AL,2
	JZ	tsnhigh
	MOV	CX,8
tsloop:
	MOV	AL,020H
	OR	BL,BL
	JNS	tsl0
	OR	AL,010H
tsl0:
	OUT	pioc,AL
	AND	AL,010H
	OUT	pioc,AL
	SAL	BX,1
	LOOP	tsloop
	RET
←setcodec	ENDP

PUBLIC	←setcodec

C←CODE ENDS
	END