data segment
    string db "hello,bad boy",0ah,0dh,'$'
data ends
code segment
mainbegin macro 
    mov ax,data
    mov ds,ax
    endm
mainend macro
    mov ah,4ch
    int 21h
    endm
dispmsg macro message
    mov dx,offset message
    mov ah,09h
    int 21h
    endm
start:
assume cs:code,ds:data
    mainbegin 
    dispmsg string
    mainend
code ends
end start

宏的定义和调用,输出字符串

相关文章: