在vc 中使用内嵌汇编(using inline assembly in vc )

在vc 中使用内嵌汇编(using inline assembly in vc )

ID:12292271

大小:53.50 KB

页数:28页

时间:2018-07-16

在vc   中使用内嵌汇编(using inline assembly in vc  )_第1页
在vc   中使用内嵌汇编(using inline assembly in vc  )_第2页
在vc   中使用内嵌汇编(using inline assembly in vc  )_第3页
在vc   中使用内嵌汇编(using inline assembly in vc  )_第4页
在vc   中使用内嵌汇编(using inline assembly in vc  )_第5页
资源描述:

《在vc 中使用内嵌汇编(using inline assembly in vc )》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、在vc++中使用内嵌汇编(Usinginlineassemblyinvc++)UsinginlineassemblyinVisualC++First,theadvantagesanddisadvantagesofinlineassemblyBecauseoftheuseofVisualininlineassemblyC++doesnotrequireadditionalcompilerandcouplings,andcandealwithsomethingscannotdealwithVisualin

2、C++,andcanbeusedintheC/C++variable,soitisveryconvenient.Inlineassemblyisusedprimarilyasfollows:1.writefunctionsinassemblylanguage;2.codethatrequiresveryhighspeed;3.directaccesstohardwareindevicedrivers;4.initializationandendingcodefor"Naked"Call.(.//"Na

3、ked",tounderstandthemeaning,butdon'tknowhowtotranslate^_^,probablydonotneedtheC/C++compilergeneratedfunction(fancy)initializationandendingcode,pleaserefertothe"MSDNNakedfunctions"instructions)Inlineassemblycodeisnoteasytotransplant.Ifyourprogrami

4、sgoingtorunondifferenttypesofmachines(suchasx86andAlpha),inlineassemblyshouldbeavoided.AtthispointyoucanuseMASMbecauseMASMsupportsmoreconvenientmacroinstructionsanddataindicators.Two,inlineassemblykeywordsInVisualC++,inlinecompilationusesthe__asmkeyword

5、,whichhastwouses:1.simple__asmblock__asm{MOVAL,2MOV,DX,0xD007OUT,AL,DX}2.addthe__asmkeywordbeforeeachassemblyinstruction__asm,MOV,AL,2__asm,MOV,DX,0xD007__asm,OUT,AL,DXBecausethe__asmkeywordisastatementdelimiter,youcanputtheassemblyinstructionsonthesame

6、line:__asm,MOV,AL,2,__asm,MOV,DX,0XD007,__asm,OUT,AL,DXObviously,thefirstapproachisconsistentwiththeC/C++styleandhasmanyotheradvantages,sothefirstapproachisrecommended.UnlikeintheC/C++"__asm"block{},{}"willnotaffecttheC/C++variablescope.Atthesametime,th

7、e__asmblockcanbenestedandnestedwithoutaffectingthescopeofthevariable.Three.Useassemblylanguagein__asmblocks1.inlineassemblerinstructionsetInlinecompilationfullysupportstheIntel486instructionset,allowingtheuseofMMXinstructions.Unsupportedinstructionscanb

8、edefinedusingthe_EMITpseudoinstructiondefinition(_EMITinstructiondescriptionbelow).2.MASMexpressionInlineassemblycanuseexpressionsinMASM.Forexample:MOVEAX,1.3.dataindicatorsandoperatorsAlthough__asmblocksallowdatatypesandobjectst

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。