我无法将我的第二个密码与我的第一个密码进行比较。谁能给我解决办法

I am not able to compare my second password with my first password. Who can give me the solution

.model

.stack

.data

    fMenu DB 10,13,"************************************"
          DB 10,13,"*****   Welcome TO Our System  *****"
          DB 10,13,"*****  +---------------------+ *****"
          DB 10,13,"*****  |     1. Register     | *****"
          DB 10,13,"*****  |     2.  Login       | *****"
          DB 10,13,"*****  |     3.  Exit        | *****"
          DB 10,13,"*****  +---------------------+ *****"
          DB 10,13,"************************************"
          DB 10,13,"    Enter Your Selection : $"
    NUM1  DB ?
    LEN EQU ($-RPASS)
    ;MSG
    STR3 db 10,13,"Failed to register$"
    STR4 DB 10,13,"SUCCESS to REgister$"
    ;-----user login and register msg
    STR1  DB 10,13,10,13,"*****LOGIN PAGE*****$"
    STR2  DB 10,13,"*****REGISTER PAGE*****$"
    USER  DB 10,13,"USERNAME : $"
    PASS  DB 10,13,"PASSWORD : $"
    ;user input
    RUSER DB 13 DUP(?)
    RPASS DB 10 DUP(?)
    CPASS DB 10 DUP(?)
    LUSER DB 13 DUP(?)
    LPASS DB 10 DUP(?)
.code

main proc

    mov ax,@data
    mov ds,ax

Start:

    mov ah, 09h
    lea dx, fMenu
    int 21h
    
    mov ah,01h ;let user prompt 1 number
    int 21h
    mov NUM1,al
    
    mov NUM1,'1'
    JE REGISTER
    
REGISTER:

    mov ah,09h
    lea dx,STR2
    int 21h
    
    mov ah,09h
    lea dx,USER
    int 21h
    mov ah,3fh
    mov bx,0
    mov cx,13
    lea dx,RUSER
    int 21h
    CMP al,13
    JMP Dispass

DisPass:

    mov ah,09h
    lea dx,Pass
    int 21h
    mov si,0

setpass:
    
    MOV AH,08H
    INT 21H
    CMP AL,0DH
    JE Comfirm
    MOV [RPASS+SI],AL
    MOV DL,'*'
    MOV AH,02H
    INT 21H
    INC SI
    JMP setpass
Comfirm:
    mov ah,09h
    lea dx,Pass
    int 21h
DisC:
    MOV AH,08H
    INT 21H
    CMP AL,0DH
    JE compare
    MOV [CPASS+SI],AL
    MOV DL,'*'
    MOV AH,02H
    INT 21H
    INC SI
    jmp disc
    
    mov bx,0
    mov cx,0
compare:
    mov al,[CPASS+bx]
    cmp dl,[RPASS+bx]
    cmp al,dl
    jne FAIl
    inc bx
    loop compare
    mov ah,09h
    lea dx,str4
    int 21h
Fail:
    mov ah,09h
    lea dx,str3
    int 21h


exit:
 mov ah,4ch
 int 21h
main endp
end main
    
mov NUM1,'1'
JE REGISTER

mov 应该变成 cmp 指令。

cmp dl,[RPASS+bx]
cmp al,dl

第一个cmp应该变成mov指令

   mov cx,0
compare:

正如 Vitsoft 评论的那样,计数器需要用密码的长度初始化,但您也可以使用值 10,因为这是输入缓冲区的长度。

在您的 DisC 循环开始之前,您需要将 SI 寄存器重置为零。它仍然保留上一个循环的最后一个非零值。确认密码将存储在错误的内存缓冲区中。


LEN EQU ($-RPASS)

虽然在这段代码中没有使用LEN,但是由于RPASS标签的位置,这会变成一个负数!这将是你未来的错误...