Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site whuxle.UUCP
Path: utzoo!watmath!clyde!floyd!whuxle!jph
From: jph@whuxle.UUCP
Newsgroups: net.micro.pc
Subject: Re: IBM bug.. - (nf)
Message-ID: <248@whuxle.UUCP>
Date: Sat, 18-Feb-84 21:35:47 EST
Article-I.D.: whuxle.248
Posted: Sat Feb 18 21:35:47 1984
Date-Received: Sun, 19-Feb-84 08:03:05 EST
Sender: jph@whuxle.UUCP
Organization: Bell Labs, Whippany
Lines: 37

#R:brunix:-637300:whuxle:22700015:000:775
whuxle!jph    Feb  5 07:41:00 1984


Here is a code segment that I use to implement a sleep
function in PASCAL where the clock is read till a number
of seconds elapse. I have had no problems in using this
function; the clock does not `slow' down and the system
does not `die'
====================================================
;
; procedure sleep(time:integer)
;
;	sleep for 'time' seconds
;
	public	sleep
sleep	proc	far
	push	bp
	mov	bp,sp			; address parameters
	push	ds
	xor	ax,ax			; setup low core memory
	mov	ds,ax
	mov	bx,ds:[46cH]		; low part of timer
	mov	ax,[bp+6]		; sleep 'time'
	mov	cx,182			; multiply by 18.2
	mul	cx			;    (*182/10)
	mov	cx,10
	div	cx			; result left in AX
	.repeat
	    mov    cx,ds:[46cH] 	; current time
	    sub    cx,bx
	.until ax be cx
	pop	ds
	pop	bp
	ret	2
sleep	endp