1.保护模式(win7,Linux系统,绝大多数平台)
2.实地址模式,intel 8086/8088 硬件平台,winXP
.386 ;选择的处理器类型
.model flat,stdcall ;存储类型,平展(flat)模型,stdcall为函数调用方式
option casemap:none ;指明标志符大小写敏感
include kernel32.inc
includelib kernel32.lib
includelib msvcrt.lib ;引用C语言的库文件msvcrt.lib
printf PROTO C: ptr sbyte,:vararg
.data ;数据段
fmt BYTE '%s',13,10,0 ;定义格式字符串fmt,值为"%s\n"
s BYTE 'WIN32汇编,你好!',0
.code
start:
invoke printf,ADDR fmt,ADDR s
invoke ExitProcess,0
end start
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib msvcrt.lib
includelib kernel32.lib
system PROTO C:ptr sbyte,:vararg
printf PROTO C:ptr sbyte,:vararg
.data
szTitle BYTE 'windows',0
szText BYTE 'hello,world!',10,13,0
fmt BYTE '%s',0
szPause BYTE 'pause',0
.code
start:
invoke printf,ADDR fmt,ADDR szText
invoke MessageBox,NULL,offset szText,offset szTitle,MB_OK
invoke system,ADDR szPause
end start