首页 > 代码库 > 汇编学习(二)

汇编学习(二)

1.需求

假设要能编译和执行asm文件。则必须安装masmSDK

2.步骤

1.下载安装masmsdk http://www.masm32.com/masmdl.htm 我下载的是11版本号

2.建立visual c++空白project

3.新建asm文件 这是网上摘录的

mymain.asm
.386
.model flat, stdcall
option casemap: none

include windows.inc
include kernel32.inc
include user32.inc

includelib kernel32.lib
includelib user32.lib

.data
szCaption   db  "Hello", 0
szText      db  "Hello World!", 0

.code

main PROC
    INVOKE MessageBox, NULL, addr szText, addr szCaption, MB_OK
    INVOKE ExitProcess, 0
main ENDP

END main

4.进行文件和project属性配置

4.1选中project右键Build Dependencies/Build Customizations选中masm
4.2选中asm文件右键属性General/Item Type选择Microsoft Macro Assembler
4.3加入masmsdk的include和lib文件夹
选中project右键属性对话框 配置属性/VC++Directories
Inlcude Directories C:\masm32\include
Library Directories C:\masm32\lib
4.4加入project类型
属性对话框中 Linker/System/Subsystem 选中Windows (/SUBSYSTEM:WINDOWS)
4.5编译执行就可以

3.备注

vs2013 + masmsdk11r+win7 + i3下执行正常
<script type="text/javascript"> $(function () { $(‘pre.prettyprint code‘).each(function () { var lines = $(this).text().split(‘\n‘).length; var $numbering = $(‘
    ‘).addClass(‘pre-numbering‘).hide(); $(this).addClass(‘has-numbering‘).parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($(‘
  • ‘).text(i)); }; $numbering.fadeIn(1700); }); }); </script>

汇编学习(二)