omh@brunix.UUCP (Owen M. Hartnett) (02/02/84)
Does anyone know of a bug in microsoft basic that makes the IBM pc hang up while executing rapid clock accesse? I'm writing a time delay program and when i loop while reading the clock, the clock stops. I have printed the clock value to the screen. This results in long seconds and eventual death to the program. 1. Does anyone know why? 2. Is there a way around it. Any response would be much appreciated. Thanks, Owen Hartnett Brown University
jph@whuxle.UUCP (02/19/84)
#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