编程显示以“!”结尾的字符串。

题目

编程显示以“!”结尾的字符串。
如:“Welcome to MASM!”。

程序

DATA  SEGMENT            
   MYSTR  DB  'Welcome to MASM!'
DATA  ENDS
CODE  SEGMENT                 
   ASSUME CS:CODE,DS:DATA
START: 
        MOV  AX,DATA        
        MOV  DS,AX
        LEA  SI,MYSTR
next:
    mov dl,[si]
    cmp dl,'!'
    jz finish
    mov ah,2
    int 21h
    inc si
      jmp next

finish:
    mov dl,'!'
    mov ah,2
    int 21h
    mov ah,4ch
    int 21h
code ends
     end start
0

Leave a Reply

Your email address will not be published.