• Advertisement

Archived

This topic is now archived and is closed to further replies.

Fragging asm !

This topic is 6349 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

#include 
short getTime()
{
    short retval;//short instead of char so the 
    _asm
    {	
        xor  ax,ax//zeros AX out
	int  1Ah/calls the clock interrupt
	mov  BYTE PTR retval,dl//copies DL(the millisecond) 
                               //value to retval
    }
    return retval;
}

void main()
{
    short temp1,temp2;
    for(int i=0;i++;i<=20)//for some reason it jumps to the end of the for...
    {
        temp1 = temp2 = GetTime();//inisialization
        while(temp1==temp2)
        {
            temp2 =  GetTime();
        }//this way when its displayed theres a different number everytime.
        cout << temp2 << ''\n'';
    }
}
 
I came, I saw, I got programmers block. ~V''lion

Share this post


Link to post
Share on other sites
Advertisement
Hi.

Should not the following statement:

for(int i=0;i++;i<=20)//for some reason it jumps to the end of the for...

read like this instead?:

for(int i=0;i<=20;i++)//for some reason it jumps to the end of the for...

Topgoro

Share this post


Link to post
Share on other sites
This is simple C man. Exactly what the last poster said!

for(assignment, expression, assignment (usually increment/decrement) ) is the syntax.

=======================================
A man with no head is still a man.
A head with no man is plain freaky.

Share this post


Link to post
Share on other sites
*claps hand to head*
Fool me !
One day....
I use shorts becasue they take up less memory.
I`m not super interested in the speed right now, else i`d use longs. *shrug*
~V''lion

I came, I saw, I got programmers block.
~V''lion

Share this post


Link to post
Share on other sites

  • Advertisement