两个字符串比较是否相同

stack segment para stack 'sta'
    db 100 dup(?)
stack ends
data segment
    string1 db 'hello$'
    string2 db 'hello$'
    string3 db 'MATCH$'
    string4 db 'NO MATCH$'
data ends
code segment
   assume cs:code,ds:data,ss:stack
   start:  push ds
           xor ax,ax
           push ax
           mov ax,data
           mov ds,ax
           mov es,ax
           xor cx,cx
           lea si,string1
           lea di,string2
           mov cx,offset string2
           cld
           repe cmpsb
           jne nota
   yes: lea si,string3
          jmp exit
  nota: lea si,string4
     exit: mov dx,si
           mov ah,9
           int 21h
           mov ah,4ch
           int 21h
           ret
code ends
     end start 

转载于:https://www.cnblogs.com/javaTest/archive/2009/11/07/2589550.html

你可能感兴趣的:(两个字符串比较是否相同)