📄 csdn技术中心 在visual c++中使用内联汇编.htm
字号:
MOV ECX, 256 <BR><BR>
_NextTable: <BR> LEA
EAX, [ECX-1] <BR>
PUSH ECX <BR>
MOV ECX, 8 <BR><BR> _NextBit:
<BR> SHR EAX,
1 <BR> JNC
_NotCarry <BR> XOR
EAX, 0xEDB88320 <BR> _NotCarry: <BR>
DEC ECX <BR>
JNZ _NextBit <BR><BR>
POP ECX <BR>
MOV [dwCRC32Table +
ECX*4 - 4], EAX <BR> DEC
ECX <BR> JNZ
_NextTable <BR> }
<BR><BR> __asm //下面是求CRC32校验码
<BR> { <BR>
MOV EAX, -1 <BR>
MOV EBX, pbData <BR>
OR EBX, EBX
<BR> JZ
_Done <BR> MOV
ECX, nSize <BR> OR
ECX, ECX <BR>
JZ _Done <BR><BR> _NextByte:
<BR> MOV DL,
[EBX] <BR><BR> XOR
DL, AL <BR> MOVZX
EDX, DL <BR> SHR
EAX, 8 <BR>
XOR EAX, [dwCRC32Table + EDX*4] <BR><BR>
INC EBX <BR>
LOOP _NextByte
<BR> _Done: <BR>
NOT EAX <BR> }
<BR> }</FONT> <BR><FONT color=#32cd32>
////////////////////////////////////////////////////////////////////////////////////////////////////</FONT>
<BR><BR><BR><BR><FONT color=#ff8c00>九、后话</FONT> <BR><BR>
本来打算写个综合各种内联汇编用法的例子,由于本人拖拖拉拉的习惯,虽经dREAMtHEATER多次催促,到最后还是不免草草了事。如果有什么谬误或不明之处,欢迎批评指正并一起探讨(QQ:
123018)。 <BR><BR><BR><BR>
<A
href="mailto:<font%20color=#9400D3>Yonsm@163.com</font>"><FONT
color=#9400d3>Yonsm@163.com</FONT></A> <BR>
<FONT
color=#9400d3>2002.9.3</FONT> <BR><BR><FONT
color=#b0c4de>==============================================================
<BR>>> 参考资料: <BR> 1.Sunwen,《VC内联ASM汇编学习笔记》
<BR> 2.老罗,《矛与盾的较量(2)——CRC原理篇》 <BR> 3.Microsoft,《MSDN
Library - January 2001》 <BR><BR>~· 全文完 ·~</FONT>
</P></SPAN><BR>
<DIV
style="FONT-SIZE: 14px; LINE-HEIGHT: 25px"><STRONG>作者Blog:</STRONG><A
id=ArticleContent1_ArticleContent1_AuthorBlogLink
href="http://blog.csdn.net/doskey/"
target=_blank>http://blog.csdn.net/doskey/</A></DIV>
<DIV
style="FONT-SIZE: 14px; COLOR: #900; LINE-HEIGHT: 25px"><STRONG>相关文章</STRONG></DIV>
<TABLE id=ArticleContent1_ArticleContent1_RelatedArticles
style="BORDER-COLLAPSE: collapse" cellSpacing=0 border=0>
<TBODY>
<TR>
<TD><A
href="http://dev.csdn.net/article/15/article/16/16121.shtm">《太阁立志传4》
所有武将卡的取得</A> </TD></TR>
<TR>
<TD><A
href="http://dev.csdn.net/article/15/article/15/15873.shtm">安全程序设计</A>
</TD></TR>
<TR>
<TD><A
href="http://dev.csdn.net/article/15/article/15/15234.shtm">PE文件添加节显示启动信息...</A>
</TD></TR>
<TR>
<TD><A
href="http://dev.csdn.net/article/15/article/15/15233.shtm">病毒基础系列-API函数地址的获取</A>
</TD></TR>
<TR>
<TD><A
href="http://dev.csdn.net/article/15/article/15/15232.shtm">怎样使用
Visual C++ 编译出只有 1536 字节的窗口程序</A>
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><A name=#Comment></A>
<TABLE cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center
bgColor=#006699 border=0>
<TBODY>
<TR bgColor=#006699>
<TD id=white align=middle width=556 bgColor=#006699><FONT
color=#ffffff>对该文的评论</FONT> </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=2 width="100%" align=center
bgColor=#666666 border=0>
<TBODY>
<TR>
<TD bgColor=#cccccc colSpan=3><SPAN
style="COLOR: #990000"><IMG height=16 hspace=1
src="CSDN技术中心 在Visual C++中使用内联汇编.files/ico_pencil.gif"
width=16> </SPAN><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl0_lblUserName>nickppa</SPAN>
<I>( <SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl0_lblPostTime>2004-05-15</SPAN>)</I>
</TD></TR>
<TR>
<TD width=532 bgColor=#ffffff colSpan=3><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl0_lblContent>在c中嵌入的汇编语言不能调用i/o,与权限有关,试试在c中调用汇编程序中的函数</SPAN>
</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=2 width="100%" align=center
bgColor=#666666 border=0>
<TBODY>
<TR>
<TD bgColor=#cccccc colSpan=3><SPAN
style="COLOR: #990000"><IMG height=16 hspace=1
src="CSDN技术中心 在Visual C++中使用内联汇编.files/ico_pencil.gif"
width=16> </SPAN><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl1_lblUserName>fleshboy</SPAN>
<I>( <SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl1_lblPostTime>2004-04-13</SPAN>)</I>
</TD></TR>
<TR>
<TD width=532 bgColor=#ffffff colSpan=3><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl1_lblContent>:)是从MSDN翻译的,王看完了MSDN的,可是一直没有编译通过。</SPAN>
</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=2 width="100%" align=center
bgColor=#666666 border=0>
<TBODY>
<TR>
<TD bgColor=#cccccc colSpan=3><SPAN
style="COLOR: #990000"><IMG height=16 hspace=1
src="CSDN技术中心 在Visual C++中使用内联汇编.files/ico_pencil.gif"
width=16> </SPAN><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl2_lblUserName>duhaohao</SPAN>
<I>( <SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl2_lblPostTime>2003-04-16</SPAN>)</I>
</TD></TR>
<TR>
<TD width=532 bgColor=#ffffff colSpan=3><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl2_lblContent>至今也不知道怎么C/C++在嵌入式下怎么用DB,DD,DW等伪指令,害得为在代码段定义数据空间,定义一大段的nop指令。还是没有汇编玩起顺手</SPAN>
</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=2 width="100%" align=center
bgColor=#666666 border=0>
<TBODY>
<TR>
<TD bgColor=#cccccc colSpan=3><SPAN
style="COLOR: #990000"><IMG height=16 hspace=1
src="CSDN技术中心 在Visual C++中使用内联汇编.files/ico_pencil.gif"
width=16> </SPAN><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl3_lblUserName>doskey</SPAN>
<I>( <SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl3_lblPostTime>2002-10-09</SPAN>)</I>
</TD></TR>
<TR>
<TD width=532 bgColor=#ffffff colSpan=3><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl3_lblContent>多谢老罗提醒,我把原作者Yonmsm的名字加上</SPAN>
</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=2 width="100%" align=center
bgColor=#666666 border=0>
<TBODY>
<TR>
<TD bgColor=#cccccc colSpan=3><SPAN
style="COLOR: #990000"><IMG height=16 hspace=1
src="CSDN技术中心 在Visual C++中使用内联汇编.files/ico_pencil.gif"
width=16> </SPAN><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl4_lblUserName>nuaawenlin</SPAN>
<I>( <SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl4_lblPostTime>2002-10-08</SPAN>)</I>
</TD></TR>
<TR>
<TD width=532 bgColor=#ffffff colSpan=3><SPAN
id=CommnetList1_CommnetList1_rpCommentList__ctl4_lblContent>文章很好,不过我在vc++6。0中建立一个基本对话框时,使用汇编,代码为_asm{ mov eax,a add eax,b mov c,eax}<BR>其中a,b,c 为short型,但编译时系统报错,为什么,是不是我没包含什么文件,我已包含stalib.h,dos.h,conio.h<BR>请给我指点好吗</SPAN>
</TD></TR></TBODY></TABLE>
<DIV align=right><A id=CommnetList1_CommnetList1_Morelink
href="http://comment.csdn.net/Comment.aspx?c=2&s=15231">【评论】</A>
<A id=CommnetList1_CommnetList1_Hyperlink1
href="javascript:window.close();">【关闭】</A>
</DIV><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FORM><!-- 版权 -->
<HR align=center width=770 noShade SIZE=1>
<TABLE cellSpacing=0 cellPadding=0 width=500 align=center border=0>
<TBODY>
<TR>
<TD vAlign=bottom align=middle height=10><A
href="http://www.csdn.net/intro/intro.asp?id=2">网站简介</A> - <A
href="http://www.csdn.net/intro/intro.asp?id=5">广告服务</A> - <A
href="http://www.csdn.net/map/map.shtm">网站地图</A> - <A
href="http://www.csdn.net/help/help.asp">帮助信息</A> - <A
href="http://www.csdn.net/intro/intro.asp?id=2">联系方式</A> - <A
href="http://www.csdn.net/english">English</A> </TD>
<TD align=middle rowSpan=3><A
href="http://www.hd315.gov.cn/beian/view.asp?bianhao=010202001032100010"><IMG
height=48 src="CSDN技术中心 在Visual C++中使用内联汇编.files/biaoshi.gif" width=40
border=0></A></TD></TR>
<TR>
<TD vAlign=top align=middle>北京百联美达美数码科技有限公司 版权所有 京ICP证020026号</TD></TR>
<TR align=middle>
<TD vAlign=top><FONT face=Verdana>Copyright © CSDN.NET, Inc. All Rights
Reserved</FONT></TD></TR>
<TR>
<TD height=15></TD></TR></TBODY></TABLE><!-- /版权 -->
<SCRIPT>
document.write("<img src=http://count.csdn.net/count/pageview1.asp?columnid=4&itemid=11 border=0 width=0 height=0>");
</SCRIPT>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -