DOS下:
;栈段 stack segment stack db 100 dup(?) stack ends ;数据段 data segment szHello db ‘Hello,world‘,0dh,0ah,‘$‘ data ends ;代码段 code segment assume cs:code,ds:data,ss:stack start: mov ax,data mov ds,ax mov ah,9 mov dx,offset szHello int 21h mov ah,4ch int 21h code ends end start
win32汇编:
.386 .model flat,stdcall option casemap:none ;include文件 include windows.inc include user32.inc includelib user32.lib include kernel32.inc includelib kernel32.lib ;数据段 .data szCaption db ‘MessageBox!‘,0 szText db ‘Hello,World!‘,0 ;代码段 .code start: invoke MessageBox,NULL, offset szText, offset szCaption, MB_OK invoke ExitProcess,NULL end start
时间: 2024-12-26 09:17:06