转自:http://www.cppblog.com/jxtgddlt/archive/2011/11/02/159497.html#Post
MASM in VisualStudio 2010
First step:
Create an empty project in Visual C++:
Second, right-click project in solutionexplorer, Build customizations, tick "masm",
Then tap the right of mouse, select Add
Now, select C++ File(.cpp), enter the sourcefile name with .asm as extend file name.
Tap right of mouse, choose Properties:
Expand the entry under ConfigurationProperties. Then expand the entry named Microsoft Macro Assembler.
Notice that the Include Paths option hasbeen set to the x:\file directory\include directory.
In this example, include directory isc:\Irvine.
Next, select the Listing File entry, also in theMicrosoft Macro Assembler group. Notice that the Assembled Code Listing Fileentry (shown below) has been assigned a macro name (starting with $) thatidentifies the name of the source input file, with a file extension of .lst.So, if your program were named main.asm, the listing file would be namedmain.lst:
Find the Linker entry under ConfigurationProperties. Select theInput entry, and notice that two filenameshave been added to theAdditional Dependencies entry. The user32.libfile is a standard MS-Windows file. Theirvine32.lib file is the linklibrary file supplied with this book. There must be at least one spaceseparating the file names:
Next, select Linker underConfiguration Properties, and then selectGeneral. The AdditionalLibrary Directories option equalsc:\Irvine, so the linker can findthe Irvine32.lib library file(you also can copy irvine32.lib to .../VC/LIB direcotry, so this would needn't to be done):
Select Linker under the ConfigurationProperties and selectDebugging. Notice that the Generate DebugInfo option is set toYes:
Select System under the Linkerentry. Notice that the SubSystem option has been set toConsole:
We use the Console settingbecause it is easy for assembly language programs to write output to a textconsole (Command) window. This is the window you see when running cmd.exe fromthe Start > Run menu in Windows.
Click the OK button to close theProject Property Pages window.
==============================一个例子===============================
转自:http://www.cnblogs.com/cyberarmy/archive/2012/05/18/2508305.html
C内嵌汇编实现大写字母转成小写字母
/******************** Compiled by VS2010 *************/ /******************** Code by 猎鹰 2012.05.18 ************/ #include <stdlib.h> #include <stdio.h> int fun(int x) { int z; _asm { mov eax,x or eax,0x20 mov z,eax } return z; } int main() { char x; printf("Please input a capital letter : "); scanf_s("%c",&x); if(((int)x>=65)&&((int)x<=90)) { printf("\nIts lowercase letter is: %c\n\n",fun(x)); } else printf("\n%c is not a capital letter.\n\n",x); system("pause"); return 0; } /**************************************************************/
输入大写字母 A ,调试状态图(注意看断点当前位置和变量与寄存器的状态):
: