flat assembler
Message board for the users of flat assembler.

Index > Windows > GetTickCount() sub not working

Author
Thread Post new topic Reply to topic
Avenger



Joined: 22 May 2013
Posts: 2
Avenger 22 May 2013, 14:29
Code:
include 'win32ax.inc'
.code
start:
      invoke GetTickCount
      mov ebx, eax
      xor eax, eax
      invoke GetTickCount
      sub eax, ebx
      invoke wsprintf, _buffer, _format, eax
      add esp, 12
      invoke MessageBox, 0, _buffer, "Test", 0
      ret
.end start          ;
.data
     _buffer rb 20
     _format db '%u'    

Why eax return 0?
Post 22 May 2013, 14:29
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1670
Location: Toronto, Canada
AsmGuru62 22 May 2013, 14:44
it is too fast!
Post 22 May 2013, 14:44
View user's profile Send private message Send e-mail Reply with quote
randomdude



Joined: 01 Jun 2012
Posts: 83
randomdude 22 May 2013, 14:44
maybe because the time elapsed between calling the first and second GetTickCount is less than 10 milliseconds?

Quote:
The resolution of the GetTickCount function is limited to the resolution of the system timer, which is typically in the range of 10 milliseconds to 16 milliseconds.


Code:
include 'win32ax.inc' 
.code 
start: 
      invoke GetTickCount 
      mov ebx, eax 
      invoke Sleep,1 
      invoke GetTickCount 
      sub eax, ebx 
      invoke wsprintf, _buffer, _format, eax 
      add esp, 12 
      invoke MessageBox, 0, _buffer, "Test", 0 
      ret 
.end start          ; 
.data 
     _buffer rb 20 
     _format db '%u'    


returns 16 milliseconds Very Happy
Post 22 May 2013, 14:44
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 22 May 2013, 15:04
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 20:23; edited 1 time in total
Post 22 May 2013, 15:04
View user's profile Send private message Reply with quote
Avenger



Joined: 22 May 2013
Posts: 2
Avenger 22 May 2013, 15:04
It's working! Thanks Smile
Post 22 May 2013, 15:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.