1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

password program were cmp not working

Discussion in 'Meet and Greet' started by panthera, Mar 13, 2012.

  1. panthera

    panthera New Member

    Mar 13, 2012
    Likes Received:
    Trophy Points:
    data segment
    msg1  db 0ah,0dh,'Enter the password : $',0ah,0dh
    msg2  db 0ah,0dh,'Re-enter password : $',0ah,0dh
    msg3  db 0ah,0dh,'Logging Successful $',0ah,0dh
    msg4  db 0ah,0dh,'Password wrong $',0ah,0dh
    msg5  db 0ah,0dh,'Password wrongc $',0ah,0dh
    a db 10 (?)
    b db 10 (?)
    countz db ?
    data ends
    assume cs:code,ds:data
    code segment
    mov ax,data
    mov ds,ax
    mov ah,09h
    mov dx,offset msg1
    int 21h
    mov di,offset a
    mov si,offset b
    loop1: mov ah,08h
                int 21h
                cmp al,0dh
                je loop2
                mov [di],al
                inc di
                inc cl
                jmp loop1
    loop2: mov ah,09h
                mov dx,offset msg2
                 int 21h
                 jmp loop3
    loop3: mov ah,08h
                int 21h
                cmp al,0dh
                je check0
                mov [si],al
                inc si
                inc ch
                jmp loop3
    check0: mov di,offset a
                   mov si,offset b
                   ;mov bl,di
                   ;mov al,si
                    mov countz,ch
                   cmp cl,countz
                   je check
                   ;mov cl,ch
                   jmp fail1
    check : mov cl,ch
                  jmp check1
    check1: cmp cl,0dh
                   jge pass
                   mov bl,[di]
                   mov bh,[si]
                   cmp bl,bh
                   jne fail1
                   inc di
                   inc si
                   dec cl
                   jmp check1
    pass: mov ah,09h
               mov dx,offset msg3
               int 21h
               jmp last
    fail: mov ah,09h
               mov dx,offset msg4
               int 21h
               jmp last
    fail1: mov ah,09h
               mov dx,offset msg5
               int 21h
               jmp last
    last: mov ah,4ch
             int 21h
             code ends
             end start
    Last edited by a moderator: Mar 14, 2012

Share This Page