1. 按照默认设定创建一个控制台程序TestAsm,在Project/Setting的General的Microsoft Foundation Class使用的是: not using mfc
#include <stdio.h>
char format[] = "%s %s/n";
char hello[] = "Hello";
char world[] = "world";
int main( void )
{
__asm
{
mov eax, offset world
push eax
mov eax, offset hello
push eax
mov eax, offset format
push eax
call printf
pop ebx
pop ebx
pop ebx
}
return 0;
}
上面代码对应在调试时对应的汇编代码为:
10: __asm
11: {
12: mov eax, offset world
00401068 mov eax,offset world (00422a40)
13: push eax
0040106D push eax
14: mov eax, offset hello
0040106E mov eax,offset h