password program were cmp not working

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

  1. panthera

    panthera New Member

    Joined:
    Mar 13, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    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
    start:
    
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice