⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csdn技术中心 在visual c++中使用内联汇编.htm

📁 vc和汇编的混合编程
💻 HTM
📖 第 1 页 / 共 4 页
字号:
            &nbsp; &nbsp;MOV &nbsp; &nbsp; ECX, 256 <BR><BR>&nbsp; 
            &nbsp;_NextTable: <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LEA 
            &nbsp; &nbsp; EAX, [ECX-1] <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp;PUSH &nbsp; &nbsp;ECX <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp;MOV &nbsp; &nbsp; ECX, 8 <BR><BR>&nbsp; &nbsp;_NextBit: 
            <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SHR &nbsp; &nbsp; EAX, 
            1 <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;JNC &nbsp; &nbsp; 
            _NotCarry <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;XOR &nbsp; 
            &nbsp; EAX, 0xEDB88320 <BR>&nbsp; &nbsp;_NotCarry: <BR>&nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp;DEC &nbsp; &nbsp; ECX <BR>&nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp;JNZ &nbsp; &nbsp; _NextBit <BR><BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;POP &nbsp; &nbsp; ECX <BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV &nbsp; &nbsp; [dwCRC32Table + 
            ECX*4 - 4], EAX <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DEC 
            &nbsp; &nbsp; ECX <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;JNZ 
            &nbsp; &nbsp; _NextTable <BR>&nbsp; &nbsp; &nbsp; &nbsp;} 
            <BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;__asm &nbsp; //下面是求CRC32校验码 
            <BR>&nbsp; &nbsp; &nbsp; &nbsp;{ <BR>&nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp;MOV &nbsp; &nbsp; EAX, -1 <BR>&nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp;MOV &nbsp; &nbsp; EBX, pbData <BR>&nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp;OR &nbsp; &nbsp; &nbsp;EBX, EBX 
            <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;JZ &nbsp; &nbsp; 
            &nbsp;_Done <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV &nbsp; 
            &nbsp; ECX, nSize <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OR 
            &nbsp; &nbsp; &nbsp;ECX, ECX <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp;JZ &nbsp; &nbsp; &nbsp;_Done <BR><BR>&nbsp; &nbsp;_NextByte: 
            <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV &nbsp; &nbsp; DL, 
            [EBX] <BR><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;XOR &nbsp; 
            &nbsp; DL, AL <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOVZX 
            &nbsp; EDX, DL <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SHR 
            &nbsp; &nbsp; EAX, 8 <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp;XOR &nbsp; &nbsp; EAX, [dwCRC32Table + EDX*4] <BR><BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;INC &nbsp; &nbsp; EBX <BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LOOP &nbsp; &nbsp;_NextByte 
            <BR>&nbsp; &nbsp;_Done: <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp;NOT &nbsp; &nbsp; EAX <BR>&nbsp; &nbsp; &nbsp; &nbsp;} 
            <BR>&nbsp; &nbsp;}</FONT> <BR><FONT color=#32cd32>&nbsp; 
            &nbsp;////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> 
            <BR><BR><BR><BR><FONT color=#ff8c00>九、后话</FONT> <BR><BR>&nbsp; 
            &nbsp;本来打算写个综合各种内联汇编用法的例子,由于本人拖拖拉拉的习惯,虽经dREAMtHEATER多次催促,到最后还是不免草草了事。如果有什么谬误或不明之处,欢迎批评指正并一起探讨(QQ: 
            123018)。 <BR><BR><BR><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <A 
            href="mailto:<font%20color=#9400D3>Yonsm@163.com</font>"><FONT 
            color=#9400d3>Yonsm@163.com</FONT></A> <BR>&nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<FONT 
            color=#9400d3>2002.9.3</FONT> <BR><BR><FONT 
            color=#b0c4de>============================================================== 
            <BR>&gt;&gt; 参考资料: <BR>&nbsp;1.Sunwen,《VC内联ASM汇编学习笔记》 
            <BR>&nbsp;2.老罗,《矛与盾的较量(2)——CRC原理篇》 <BR>&nbsp;3.Microsoft,《MSDN 
            Library - January 2001》 <BR><BR>~· &nbsp;全文完 ·~</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{&nbsp;mov&nbsp;eax,a&nbsp;add&nbsp;eax,b&nbsp;mov&nbsp;c,eax}<BR>其中a,b,c&nbsp;为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&amp;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 &copy; 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 + -