; timerml.asm

; L. Stewart, June 21, 1982  11:36 AM

C←CODE	SEGMENT

$INCLUDE(Lark.d)

C←DATA	SEGMENT

C←DATA ENDS

ASSUME CS:C←CODE, DS:C←DATA
; set timer, address of timer in BX, interval in CX
; call is	settmr(interval, &timer)
; interval is in 1000ths of a second
←settmr	PROC	NEAR
	MOV	SI,clklo
	ADD	CX,[SI]
	MOV	WORD PTR [BX],CX
	RET
←settmr	ENDP

; has timer expired? Address of timer in BX
; returns BX=1 if so, BX=0 if not
; call is	if (tmrexp(&timer)) { ... }
←tmrexp	PROC	NEAR
	MOV	AX,WORD PTR [BX]
	XOR	BX,BX
	MOV	SI,clklo
	CMP	AX,[SI]	; expired will leave sign bit set
	JS	teret
	RET
teret:
	INC	BX
	RET
←tmrexp	ENDP

PUBLIC	←settmr
PUBLIC	←tmrexp

C←CODE ENDS
	END