News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Timer

Started by t48605, August 27, 2006, 08:41:40 AM

Previous topic - Next topic

t48605

I know int 15h + mov ah,86h make bios wait for the amount of time before do the next command and the time is show in CX:DX but I don't know exactly the equivalence of time , what is the value of CX:DX equivalent to 25 seconds , for example ???
thanks !!!

ninjarider

from what i was just reading on it. it is in milliseconds. it is not accurate and you will have to test it on your system to find exact numbers for what your doing.

sinsi

From Ralf Brown's Interrupt List:

QuoteINT 15 - BIOS - WAIT (AT,PS)
   AH = 86h
   CX:DX = interval in microseconds
Return: CF clear if successful (wait interval elapsed)
   CF set on error or AH=83h wait already in progress
       AH = status (see #00496)
Note:   the resolution of the wait period is 977 microseconds on many systems
     because many BIOSes use the 1/1024 second fast interrupt from the AT
     real-time clock chip which is available on INT 70; because newer
     BIOSes may have much more precise timers available, it is not
     possible to use this function accurately for very short delays unless
     the precise behavior of the BIOS is known (or found through testing)

25 seconds is 455 ticks, and the tick count since midnight is at 0040:006C, so polling that address until
it increases by 455 will give you 25 seconds (18.2 ticks per second). You have to watch out for the byte
at 0040:0070 which is a midnight flag (read RBIL for more).
Light travels faster than sound, that's why some people seem bright until you hear them.

t48605

well I find something like that
for example , CX:DX is 000fh:4240h --> 1 second , if multiply CX to 2 then CX:DX is 001eh:4240h --> 2 seconds and so on ...
DX has no effect :) seems that

sinsi

Don't forget that DX is the lowest part of a 32-bit number, so it's only 65535 microseconds (around 0.06 seconds) resolution.

QuoteCX:DX is 000fh:4240h --> 1 second , if multiply CX to 2 then CX:DX is 001eh:4240h --> 2 seconds and so on ...
For 2 seconds, CX:DX should be 001eh:8480h - you need to treat it as a 32-bit number.

Light travels faster than sound, that's why some people seem bright until you hear them.

t48605

yeah thanks so much
now small question : How do you define "tick" ???

sinsi

Well, a clock ticks...so the timer ticks (18.2 times a second). :bg
Light travels faster than sound, that's why some people seem bright until you hear them.

t48605