assembly in visual c/c++ in OPENGL
I am looking for a tutorial for assembly in visual c/c++ that uses assembly. I know VERY SIMPLE assembly instructions ...but I want to learn more. I can''t find any tutorials using assembly in visual c++ anywhere. I think this will not work...I want to add asmb to assm and then output the results(I can do the output stuff).
if(g_keys->keyDown[''S'']) //use ''s'' to do this asm function
{
_asm //this is or is not inline??
{
mov edx,a //make edx ==a ???
mov edi,b //make edi ==b ???
add edi,a //add b+=a ?????
}
}
Basically I want the (a) added to the (b) and then to output the results. I know this is VERY SIMPLE...but I am new to assembly.
By the way I am buiding a Shadow Engine using the assembler and OpenGL.I needit to use assembly instructions(very fast!!!).
search for romka''s opengl site i believe there are opengl asm there
i wouldnt get to worked up about speed improvement if i was you have fun anyways
http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
i wouldnt get to worked up about speed improvement if i was you have fun anyways
http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
assume ur "a" and "b" are int
if(g_keys->keyDown['S']) //use 's' to do this asm function
{
_asm //this is or is not inline?? YES
{
push eax // save current eax
mov eax,b
add eax,a
mov b,eax
pop eax // restore eax
}
}
asm doesnt mean faster,
the compiler is better than u most of the time,
even u dont trust it (i dont trust it, but i know it is better than me),
for example, u have to push/pop eax in above code,
and compiler doesnt know eax is the value of b,
if it does, and the next line of C code is
c=b+a+whatever;
compiler will not read b from memory again
[edited by - iwaskia on October 17, 2002 6:40:13 AM]
if(g_keys->keyDown['S']) //use 's' to do this asm function
{
_asm //this is or is not inline?? YES
{
push eax // save current eax
mov eax,b
add eax,a
mov b,eax
pop eax // restore eax
}
}
asm doesnt mean faster,
the compiler is better than u most of the time,
even u dont trust it (i dont trust it, but i know it is better than me),
for example, u have to push/pop eax in above code,
and compiler doesnt know eax is the value of b,
if it does, and the next line of C code is
c=b+a+whatever;
compiler will not read b from memory again
[edited by - iwaskia on October 17, 2002 6:40:13 AM]
quote:Original post by iwaskia
for example, u have to push/pop eax in above code,
Actually, on VS6 + 7 you dont have to preserve the registers with each __asm block, so that code is redundant.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement