最简单的方法, 就是在VS2010的C++文件里直接使用__asm{} 直接写汇编代码. 实例代码如下:
#includeusing namespacestd;
intmain()
{
chara[10] = "1234";
__asm{
push eax
push edx
push ecx
lea eax, a
mov cl,byte ptr [eax]
mov dl,byte ptr [eax]
movzx ecx,cl
movzx edx,dl
shr ecx,4
shl edx,4
or ecx,edx
mov byte ptr [eax],cl
inc eax
mov cl,byte ptr [eax]
pop ecx
pop edx
pop eax
}
}
另外是书写彻底的汇编代码, 具体步骤如下, 就不翻译了.
How to Use VS2010 to Write Assembly
===============================
Using Visual Studio to write an assembly program may be tricky. Specific steps are to be followed in order to be able to create your first MASM x8