Hello, I'm currently new to this forum since I've heard from a friend that it is a great place to ask about programming
My problem is as stated in the title, a password system in TASM. I'm also new to the TASM and it's ability if that explains a lot more about me.
I was asked to create a password system that will accept a set of 5 characters, I know it is easy, I can do a system of that myself, the problem lies with the condition. The professor asked me to create one using through PUSH and POP commands and that the system will terminate upon 3 tries if the wrong password was inputted. The password is "TIPML", I've done all the basic stuff with regards to using PUSH to store values, what breaks my code is the part where I try to compare it to pass db, it just fails to jump whether I've put the right or wrong value. Below is the current code I have been working on.
Mod edit: added code tags
My problem is as stated in the title, a password system in TASM. I'm also new to the TASM and it's ability if that explains a lot more about me.
I was asked to create a password system that will accept a set of 5 characters, I know it is easy, I can do a system of that myself, the problem lies with the condition. The professor asked me to create one using through PUSH and POP commands and that the system will terminate upon 3 tries if the wrong password was inputted. The password is "TIPML", I've done all the basic stuff with regards to using PUSH to store values, what breaks my code is the part where I try to compare it to pass db, it just fails to jump whether I've put the right or wrong value. Below is the current code I have been working on.
Code:
.model small
.stack
.data
pass db "LMPIT$"
.code
start:
mov cx, 5
a:
mov ah, 07
int 21h
mov bl, al
PUSH bx
mov ah, 02
mov dl, '*'
int 21h
loop a
mov ax,0
mov bx,0
mov dx,0
mov cx, 5
mov dx, offset pass
b:
POP bx
mov al, bl
cmp al, dl
je lop
jne wrong
lop:
loop b
je right
jne wrong
right:
mov ah, 2
mov dl, 'r'
int 21h
jmp exit
wrong:
mov ah, 2
mov dl, 'w'
int 21h
jmp exit
exit:
mov ah, 4ch
int 21h
end start