汇编语言01 - 打印 "Hello World!"

Hello World!

源代码

data segment
    msg db "Hello World!$";定义名称为msg的字符串,最后加上$,表示字符串结束
data ends

code segment
    assume cs:code, ds:data
start:
    mov ax, data
    mov ds, ax
    
    lea dx, msg;dx寄存器中存储的是msg这一字符串的首地址
    mov ah, 09h;调用中断,该中断会用到dx寄存器
    int 21h
    
    mov ah, 4ch;调用中断,安全退出
    int 21h
code ends
end start

程序运行截图

小结

该博客仅供参考安全