For the login part is good, everything works well on that part. But for registering a new account part, it keeps showing the invalid message although I full all the requirements which are username cant be repeated and the length of username should be more than 5 letters.
Here is my code
Here is the problem that I facing now:
Although it's a bit long, I hope u guys can take time for looking at it. This is my assignment.
call isValidUserName cmp aX, 1 JNE oor4 mov si, offset regUser call checkLength cmp cx, 5 JBE oor5 <=== All is well: Need to jump to `askPsw` here oor4: jmp invalidacc oor5: jmp invalidUserLength askPsw:
The code is missing a crucial jmp
. For now the code falls through in oor4 eventhough the new username is long enough.
Next code solves the problem and avoids adding yet another jump to the program (mainly by inverting the condition):
call isValidUserName ; -> AX=[0=NOK, 1=OK]
cmp ax, 1
JNE oor4
mov si, offset regUser
call checkLength ; -> CX
cmp cx, 5
JA askPsw
oor5:
jmp invalidUserLength
oor4:
jmp invalidacc
askPsw: