win32汇编 helloworld

来源:互联网 发布:淘宝店免费货源怎么找 编辑:程序博客网 时间:2024/06/06 01:06

;.386是伪指令 告诉编译器使用 386指令集.386;model 内存模式[,语言模式][,其它模式];flat 是win32程序使用的模式,代码和数据段使用同一个4GB段;stdcall 是函数调用约定,参数从右往左压栈.model flat,stdcall;大小写敏感option  casemap:none;包含文件和库include E:\masm32\include\windows.incinclude E:\masm32\include\user32.incincludelib E:\masm32\lib\user32.libinclude E:\masm32\include\kernel32.incincludelib E:\masm32\lib\kernel32.lib;数据段.dataszCaption db 'win32',0szText   db 'Hello',0;代码段.code;代码段的开始 位置是end决定的;offset 取偏移地址start:  invoke MessageBox,NULL,offset szText,offset szCaption,MB_OK  invoke ExitProcess,0end start  


编译

D:\>E:\masm32\bin\ml /c /coff win1.asmMicrosoft (R) Macro Assembler Version 6.14.8444Copyright (C) Microsoft Corp 1981-1997.  All rights reserved. Assembling: win1.asmD:\>E:\masm32\bin\link  win1.objMicrosoft (R) Incremental Linker Version 5.12.8078Copyright (C) Microsoft Corp 1992-1998. All rights reserved.LINK : fatal error LNK1221: a subsystem can't be inferred and must be definedD:\>E:\masm32\bin\link /subsystem:windows  win1.objMicrosoft (R) Incremental Linker Version 5.12.8078Copyright (C) Microsoft Corp 1992-1998. All rights reserved.



原创粉丝点击