小白刚刚开始学汇编 有个地方没搞懂 求助啊!
我们老师布置了一个作业 用masm模拟开机输密码的过程
我的问题出在检查那个部分 就是对比密码是否相同 不相同则回到p1 相同则继续
但是无论输入的密码是对还是错都直接回到了p1没法继续 实在是弄不出来了也不太明白 用cmpsw怎么跳回p1 大神们求救啊
下面是原程序
DATAS SEGMENT
pw1 db '123456$'pw2 db 6 dup(?)
str1 db 0ah,'please input the password',0ah,0ah,'$'
str2 db 'loading...$'
str3 db 0ah,'welcome back!$ '
DATAS ENDS
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
p1: lea bx,pw1
mov ah,09h
lea dx,str1
int 21h
mov cx,6
p0:mov ah,07h
int 21h
mov ah,02h
mov dl,'*'
int 21h
mov [bx],al
inc bx
loop p0 ; input the password
mov dl,0dh
int 21h
mov cx,10
lea bx,str2
mov ah,02h
p3:mov dl,[bx]
inc bx
mov sp,0ffffh
p2:mov bp,00001h
p4:dec bp
jnz p4
dec sp
jne p2
int 21h
loop p3 ;loading
mov cx,6
lea di,pw1
lea si,pw2
mov sp,[di]
mov bp,[si]
p5:cmp sp,bp
jne p1
inc sp
inc bp
dec cx
jnz p5 ;check password
lea dx,str3
mov ah,09h
int 21h ; welcome back!
CODES ENDS
END START