Display each word of a string in different lines

.model small
.stack
.data
str db "Happy Valentine's Day to you all$"
.code
main proc
    mov ax,@data
    mov ds,ax
    mov si,offset str
    again:mov dl,[si]
    cmp dl,36
    jz last
    cmp dl,32
    jz nextline
    mov ah,2
    int 21h
    inc si
    jmp again
    nextline:inc si
    mov dl,13
    mov ah,2
    int 21h
    mov dl,10
    mov ah,2
    int 21h
    jmp again
    last:mov ah,4ch
    int 21h
    main endp

No comments:

Post a Comment