Archived

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

tylerbingham

assembly in Visual c/c++

Recommended Posts

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.I need it to use assembly instructions(very fast!!!).

Share this post


Link to post
Share on other sites
Why move ''a'' into EDX if you are going to add EDI to ''a''?
Also, I''d use general purpose registers to add with, like EAX, EBX and ECX.
I''d also push and pop ECX before and after I alter any values in the ECX register and I''d move the result of the add operation into a value that can be returned.

Like this:


__asm {
MOV EAX, a
MOV EBX, b
ADD EAX, EBX
MOV r, EAX
}


I think that is right. Return ''r'' as the result.

Share this post


Link to post
Share on other sites