主题:请帮我看这程序,我急用啊,拜托帮帮我啊
;我这是密码程序,预先给出密码'zhouzhaoyuan',然后判断输入的密码是否与已知一样,若一样则输出提示符然后退出,若不一样则输出提示符,然后也退出.可我在比较输入的密码与预先给出的是否相等的时候老是比较不出来,到底一个已有的字符串和一个输入的字符串要做比较到底是怎样做比较的,怎样去实现的.就像我下面的程序到底应该怎样去改!
data segment
password1 db 12(?)
password2 db 'zhouzhaoyuan'
msg1 db 0dh,0ah,'please input 1---12:$'
msg2 db 0dh,0ah,'error!The number of the keys is<7!$'
msg3 db 0dh,0ah,'error!The number of the keys is>12!$'
msg4 db 0dh,0ah,'right!$'
msg5 db 0dh,0ah,'error!$'
count dw ?
data ends
prognam segment
main proc far
assume cs:prognam,ds:data
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov es,ax
lea bx,password1
mov bx,0
mov cx,0
mov dx,offset msg1
mov ah,9
int 21h
mov bx,offset password1
next:
mov ah,00h
int 16h
cmp al,0dh
jz compare
mov byte ptr [bx],al
mov dl,'*'
mov ah,02h
int 21h
inc bx
inc cx
jmp next
compare:
mov ax,cx
cmp ax,7
jl print1
cmp ax,12
jg print2
mov count,ax
jmp testpassword
testpassword:
mov ax,count
cmp ax,12
je cmpassword
mov dx,offset msg5
mov ah,9
int 21h
mov bx,0
mov cx,0
jmp next
cmpassword:
mov si,offset password1
mov di,offset password2
repz cmpsb
jz print3
mov dx,offset msg5
mov ah,9
int 21h
ret
print1:
mov dx,offset msg2
mov ah,9
int 21h
mov bx,0
mov cx,0
jmp next
print2:
mov dx, offset msg3
mov ah,9
int 21h
mov bx,0
mov cx,0
jmp next
print3:
mov dx,offset msg4
mov ah,9
int 21h
ret
main endp
prognam ends
end start
data segment
password1 db 12(?)
password2 db 'zhouzhaoyuan'
msg1 db 0dh,0ah,'please input 1---12:$'
msg2 db 0dh,0ah,'error!The number of the keys is<7!$'
msg3 db 0dh,0ah,'error!The number of the keys is>12!$'
msg4 db 0dh,0ah,'right!$'
msg5 db 0dh,0ah,'error!$'
count dw ?
data ends
prognam segment
main proc far
assume cs:prognam,ds:data
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov es,ax
lea bx,password1
mov bx,0
mov cx,0
mov dx,offset msg1
mov ah,9
int 21h
mov bx,offset password1
next:
mov ah,00h
int 16h
cmp al,0dh
jz compare
mov byte ptr [bx],al
mov dl,'*'
mov ah,02h
int 21h
inc bx
inc cx
jmp next
compare:
mov ax,cx
cmp ax,7
jl print1
cmp ax,12
jg print2
mov count,ax
jmp testpassword
testpassword:
mov ax,count
cmp ax,12
je cmpassword
mov dx,offset msg5
mov ah,9
int 21h
mov bx,0
mov cx,0
jmp next
cmpassword:
mov si,offset password1
mov di,offset password2
repz cmpsb
jz print3
mov dx,offset msg5
mov ah,9
int 21h
ret
print1:
mov dx,offset msg2
mov ah,9
int 21h
mov bx,0
mov cx,0
jmp next
print2:
mov dx, offset msg3
mov ah,9
int 21h
mov bx,0
mov cx,0
jmp next
print3:
mov dx,offset msg4
mov ah,9
int 21h
ret
main endp
prognam ends
end start