用汇编语言在字符串X中查找是否存在字符A,存在显示Yes,否则显示No (编一

用汇编语言在字符串X中查找是否存在字符A,存在显示Yes,否则显示No (编一个完整程序)

code  segment
      assume cs:code
      org 100h
start:jmp begin

x     db 100
xn    db ?
xs    db 100 dup(?)
a     db ?
msg1  db 13,10,'please input a strings: $'
msg2  db 13,10,'please input a char: $'
msg3  db 13,10,13,10,'Yes$'
msg4  db 13,10,13,10,'No$'
lfcr  db 13,10,'$'

begin:push cs
      pop ds
      push cs
      pop es
      
      lea dx,msg1
      mov ah,9
      int 21h
      lea dx,x
      mov ah,10
      int 21h
      lea dx,lfcr
      mov ah,9
      int 21h
      lea dx,msg2
      int 21h
      mov ah,1
      int 21h
      mov byte ptr a,al
      mov cl,byte ptr xn
      mov ch,0
      lea di,xs
      cld
      repne scasb
      jne @1
      lea dx,msg3
      mov ah,9
      int 21h
      jmp @exit
@1:
      lea dx,msg4
      mov ah,9
      int 21h
@exit:
      mov ah,4ch
      int 21h
code  ends
      end start

温馨提示:答案为网友推荐,仅供参考
相似回答