简单汇编----输入密码判断正否

 

DATAS SEGMENT

	 OUT_WEL   DB 0DH,0AH,'please input the password:$'     	 

     OUT_WRONG DB 0DH,0AH,'your input is wrong!$'

     OUT_RIGHT DB 0DH,0AH,'OK!$'

     INPUT DB 100

           DB ?

           DB 9 DUP(?) 

DATAS ENDS



EXTRA SEGMENT

	 PASSWORD DB 'WELCOME!'  

EXTRA ENDS



CODES SEGMENT

    ASSUME CS:CODES,DS:DATAS,ES:EXTRA

START:

    MOV AX,DATAS

    MOV DS,AX

    MOV AX,EXTRA

    MOV ES,AX

    

AGAIN:

	MOV CL,08H

    MOV DX,OFFSET OUT_WEL

    MOV AH,09H

    INT 21H

    ;

    MOV DX,OFFSET INPUT

    MOV AH,0AH

    INT 21H

    ;

    MOV SI,OFFSET INPUT+2

    MOV DI,OFFSET PASSWORD

    CLD

    REPZ CMPSB

    JNZ WRONG

RIGHT:

	;;;OUTPUT 'RIGHT

    MOV DX,OFFSET OUT_RIGHT

    MOV AH,09H

    INT 21H

ENND:

    MOV AH,4CH

    INT 21H

    

WRONG: 

    ;;;OUTPUT 'WRONG'

    MOV DX,OFFSET OUT_WRONG

    MOV AH,09H

    INT 21H

    JMP AGAIN

    

CODES ENDS

    END START

 

你可能感兴趣的:(汇编)