;怎么用8086汇编编写密码锁程序
;http://zhidao.baidu.com/question/146799944.html
;----宏Char,输出一字符串
char macro X
mov dx,offset X
mov ah,9
int 21h
endm
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
START:
push cs
pop ds
mov si,offset password
char mes1
mov cx,3
next:
mov ah,7
int 21h
push ax
mov al,'*'
mov ah,0eh
int 10h
pop ax
or al,20h ;字符都化为小写
cmp al,[si]
jnz error
inc si
loop next
char mes3 ;口令正确
jmp exit
error:
char mes2 ;口令错误
exit:
mov ah,0
int 16h
mov ah,4ch
int 21h
mes1 db 13,10,9,'Input the Password: ',13,10,9,'$'
mes2 db 13,10,9,'Error Password!$';口令错误
mes3 db 13,10,9,'Welcome in!$';口令正确
password db 'yxt' ;预存密码
CODE ENDS
END START