The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: t48605 on August 27, 2006, 08:41:40 AM

Title: Timer
Post by: t48605 on August 27, 2006, 08:41:40 AM
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 !!!
Title: Re: Timer
Post by: ninjarider on August 27, 2006, 01:00:26 PM
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.
Title: Re: Timer
Post by: sinsi on August 28, 2006, 09:29:11 AM
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).
Title: Re: Timer
Post by: t48605 on August 29, 2006, 03:22:14 AM
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
Title: Re: Timer
Post by: sinsi on August 29, 2006, 04:05:32 AM
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.

Title: Re: Timer
Post by: t48605 on August 30, 2006, 03:22:52 AM
yeah thanks so much
now small question : How do you define "tick" ???
Title: Re: Timer
Post by: sinsi on August 30, 2006, 03:55:14 AM
Well, a clock ticks...so the timer ticks (18.2 times a second). :bg
Title: Re: Timer
Post by: t48605 on August 31, 2006, 01:39:53 AM
 :U