回 帖 发 新 帖 刷新版面

主题:[原创]汇编语言实现比较两个字符串的问题,大家看看

谢谢帮忙!兄弟把这个改正确,贡献出来
data segment
     string1 db 81
     db ?
     db 81 dup(?)
     string2 db 81
     db ?
     db 81 dup(?)
     mesg1 db 'please input two strings:',0ah,0dh
           db '$'
     mesg2 db 'they are the same.',0ah,0dh
           db '$'
     mesg3 db 'they are the different',0ah,0dh
           db '$'
data ends
code segment
     assume cs:code,ds:code,es:code
start:mov ax,data
      mov ds,ax
      mov es,ax
disp1:mov dx,offset mesg1
      mov ah,09h
      int 21h
lf:mov dl,0dh
   mov ah,02h
   int 21h
input1:mov dx,offset string1
       mov ah,0ah
       int 21h
       mov dl,0ah
       mov ah,02h
       int 21h
input2:mov dx,offset string2
       mov ah,0ah
       int 21h
       mov dl,0ah
       mov ah,02h
       int 21h
       mov bl,string1
       mov dl,string2
       cmp bl,dl
       jne disp3
       mov cl,string1
       mov ch,0h
sjy:lea si,string1
    lea di,string2
    cld
    repe cmpsb
    jnz disp3
    mov dx,offset mesg2
    mov ah,09h
    int 21h
    jmp pend
disp3:mov dx,offset mesg3
      mov ah,09h
      int 21h
pend:mov ah,4ch
     int 21h
code ends
     end start

回复列表 (共7个回复)

沙发

自己定一个

板凳

大家还是看看撒!

3 楼

斑竹看看撒!

4 楼

怎么没有大虾来帮帮忙?

5 楼

不会也冒个泡泡撒

6 楼


input1:mov dx,offset string1
       mov ax,0ah
       int 21h
这里面的ax应该改为ah才对,不然就等于执行中断指令了

7 楼

谢谢!

我来回复

您尚未登录,请登录后再回复。点此登录或注册