Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delay

Status
Not open for further replies.

beyondsociety

Technical User
May 9, 2002
40
US
How would I create a delay that is 5 to 10 seconds long in assembly. An example would be really helpful.
 
hi,
what operating system are you using?
"People who have nothing to say, say it too loud and have little knowledge. It's the quiet ones you need to worry about!"
 
The operating system I'm using is windows 2000, and the the architecture is for the x86 intel processor.
 
In Win32Asm? Or DOS16Asm?

Try looking up GetTickCount() for the former.

The GetTickCount function retrieves the number of milliseconds that have elapsed since Windows was started.

DWORD GetTickCount(VOID)


Parameters

This function has no parameters.

Return Value

If the function succeeds, the return value is the number of milliseconds that have elapsed since Windows was started.

Remarks

The GetTickCount function is identical to the GetCurrentTime function. Applications should use the GetTickCount function because its name matches more closely what the function does.
The GetTickCount and GetMessageTime functions return different times. GetMessageTime returns the Windows time when the given message was created, not the current Windows time.
The internal timer wraps around to zero if Windows is run continuously for approximately 49.7 days.



For DOS... there is also a TickCount but it's accessed by a location or via a BIOS int call, although the 'by location' method is preferred.

"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Delay for certain amount of time:
mov ah,86h
;CX:DX = #of ¦Ìsecs to delay
int 15h

 
That call also works but not on all BIOS versions... not on my really really *OLD* 286 computer for instance he he he.... Besides if it's seconds, you can just access the BIOS's clock which is 18.22065 (IIRC) clock ticks per second. If it's in milliseconds then that call is preferred, it's probably supported anyway.
"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top