עבור לתוכן

עזרה דחופה בפרויקט אסמבלר !!!

Featured Replies

פורסם

טוב אז ככה.. כל הפרויקט פה למטה.

אני לא מבין למה שכשאני כותב את הסיסמה לאימות זה בפעם הראשונה כותב Password OK ואחרי זה כל סיסמה שאני יכתוב הוא יעשה Password OK ואז Login Failed.....

משהו בבדיקה של הסיסמה לאימות לא טוב. מי שעוזר אני ןקאו'קראםקרטאיט

לודע אבל אני יעריך את זה באמת באמת באמת

הנה זה:

[font=Courier]

[left]

.MODEL small
.stack 100h
.data

Header db '',10,13
db ' **********************************************************',10,13
db ' * ****************************************************** *',10,13
db ' * * * *',10,13
db ' * * DDDDDDDD PPPPPPPPPP C CCCCCCCCCCCC * *',10,13
db ' * * D D p P C C * *',10,13
db ' * * D DDD D P PPPPPP P C CCCCCCCCCCC * *',10,13
db ' * * D D D D P P P P C C * *',10,13
db ' * * D D D D P PPPPPP P C C * *',10,13
db ' * * D D D D P P C C * *',10,13
db ' * * D D D D P PPPPPPP C C * *',10,13
db ' * * D DDD D P P C CCCCCCCCCCC * *',10,13
db ' * * D D P P C C * *',10,13
db ' * * DDDDDDDD PPPP C CCCCCCCCCCCC * *',10,13
db ' * * * *',10,13
db ' * ****************************************************** *',10,13
db ' **********************************************************',10,13
db '',10,13,'$'

About db ' This application was programmed and coded by Berman Group Corp., Ltd.',10,13,'$'

Brief db 'Hello! Thank you for choosing DPC (DANIEL Password Converter)!',10,13
db 'This application will register your password and let you access your data after several simple steps of the password confirmation system.',10,13
db '',10,13,'$'

Enter_P db '',10,13
db 'Would you like to enter the program? (Y/N)',10,13,'$'

Menu db '',10,13
db ' *********************************************',10,13
db ' * * Menu * *',10,13
db ' * ***************************************** *',10,13
db ' * * * *',10,13
db ' * * You may want to: * *',10,13
db ' * * 1. Register * *',10,13
db ' * * 2. Login * *',10,13
db ' * * 3. Exit program * *',10,13
db ' * * * *',10,13
db ' * ***************************************** *',10,13
db ' *********************************************',10,13
db '',10,13,'$'

Line_Space db '',10,13,'$'

Input_MSG db 'Please Enter your password: ',10,13,'$'

TooLong_MSG db 'Password too long! Max allowed length: 9 characters. Please re-enter your password.',10,13
db '',10,13,'$'

Space_MSG db 'Password cannot contain spaces. Please re-enter the character again.',10,13
db '',10,13,'$'

Option_Encrypt db 'Do you want to encrypt the password? (Y/N)',10,13,'$'

End_Input db '',10,13
db 'Password OK!',10,13,'$'

Choise_Error_MSG db ' ',10,13
db 'Please enter a correct option ID.',10,13,'$'

Login_Failed_MSG db ' ',10,13
db 'Login failed! Please re-enter the password.',10,13,'$'

Login_Msg db ' ',10,13
db 'Please Login: ',10,13,'$'

Login_Accepted_Msg db 'Welcome to your safe!',10,13,'$'

Password_is_Msg db 'Your Password is: ',10,13,'$'

Output_Again db 'Would you like to run the program again? (Y/N)',10,13,'$'

Pass_String db 11 dup(?) ; Contains the password

Size_Var db 0 ; Contains the password length

Login_Check db 1 ; Boolean variable checking if the login is OK

Encrypt_Check db 0 ; Boolean variable checking if the user wants to encrypt his password

.code

mov ax,@data
mov ds,ax

xor ax,ax
xor si,si
call Clear_Screen ; Clear screen
call Logo ; Print opening screen
call About1 ; Print About message
call Brief1 ; Print Brief message
call Enter_Prog ; Asks the user whether to enter the program or not

Reset_Prog: call Input_choise ; Receive and determine what the user wants to do
call Clear_Screen ; Clear screen
call Output_Password ; Outputs the password that will be used by the system
call Login ; A procedure used to receive the password from the user and check its compability with the original password
call Ask_Again ; Asks the user if he wants to run the program again



;-----------------------------------------
Reset: call Clear_String ; Clear screen
jmp Reset_prog ; Restart
ret
;-----------------------------------------
Clear_Screen: mov ax,03h
int 10h ; Activates the 10/03 interruption
ret
;-----------------------------------------
LnSpace: lea dx,Line_Space
mov ah,09h
int 21h
;-----------------------------------------
Clear_String: xor al,al ; Reset the content of AL
xor bx,bx ; Reset the content of BX
;-----------------------------------------
Again_Delete: mov Pass_String[bx],al ; Reset 1 character of the password
inc bx ; Increase the value of BX by 1
cmp bx, 20 ; Compares the content of BX with 20
jbe Again_Delete ; Jump if it is below or equal
ret
;-----------------------------------------

Logo: lea dx,Header ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
About1: lea dx,About ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
Brief1: lea dx,Brief ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
Enter_Prog: lea dx, Enter_P
mov ah,09h
int 21h
mov ah, 07h
int 21h
cmp al,121
je menu2
jmp Enter_Prog
menu2: call Clear_Screen
call Options ; Print Menu
ret
;-----------------------------------------
Options: call Clear_Screen
lea dx,Menu ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
O_Input_MSG: lea dx,Input_MSG ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
O_End_In: lea dx,End_Input ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
Output_Space_Error: dec cl ; Decrease the contents of CL by 1
mov ah,02h
mov dl,0dh
int 21h ; Activate the 21/02 interrupt
lea dx,Space_MSG ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
cmp cl,0 ; Compare the contents of CL with 0
je End_Space_Error ; If CL equals 0 then jump to
Again_Astrix: call Output_Astrix ; Call the procedure
dec cl ; Decrease the contents of CL by 1
cmp cl,0 ; Compare CL with 0
jne Again_Astrix ; If not equal jump to
mov cl,Size_Var ; Move the content of size_Var to CL
End_Space_Error: ret

;-----------------------------------------
Output_TooLong_Error: mov ah,02h
mov dl,0dh
int 21h ; Activate the 21/02 interrupt
lea dx,TooLong_MSG ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
Output_Astrix: mov ah,02h
mov dl,'*'
int 21h ; Activate the 21/02 interrupt
ret
;-----------------------------------------
Output_Login_Failed: lea dx,Login_Failed_MSG ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
Output_Login_Accepted: lea dx,Login_accepted_MSG ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
Output_Login_Msg: lea dx,Login_Msg ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
Output_Password: lea dx,Password_Is_MSg ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
xor si,si ; Reset the content of SI
xor ax,ax ; Reset the content of AX
xor dx,dx ; Reset the content of DX
xor cx,cx ; Reset the content of CX
mov cl,Size_Var ; Move the content of Size_Var to CL
;-----------------------------------------
Output_Pass_Again: mov ah,02h
mov dl,Pass_String[si]
inc si
int 21h ; Activate the 21/09 interrupt
loop Output_Pass_Again ; Jump to while CL!=0
call LnSpace
ret
;-----------------------------------------
Input_Char: mov ah,07h
int 21h ; Activate the 21/07 interrupt
cmp al,2Bh ; Compare AL with 2bH (NUM +);
je Quit ; If it equals jump to
jmp Input_Char_End ; Jump to
quit: call Terminate ; Use the procedure
jmp Input_Char_End ; Jump to
Input_Char_End: ret
;-----------------------------------------
Input_Choise: ReInput: call Input_Char
cmp al,'1'
je Option1
cmp al,'2'
call Terminate
call Input_Choise_Error
jmp Again_Input
Option1: call Encrypt_Y_N
call Register
ret
;-----------------------------------------
Register: xor ax,ax
xor si,si
xor cl,cl
xor bx,bx
call O_Input_MSG
;------------------------------
Again_Input: call Input_Char
push ax
call Output_Astrix
pop ax
mov Size_Var,cl
inc cl
cmp al,0dh
je Enter_Event
cmp al,20h
je Space_Event
cmp cl,11
je TooLong_Event
cmp Encrypt_Check,0
je No_Crypt
inc al
;------------------------------
No_Crypt: mov Pass_String[si],al
inc si
mov Size_Var,cl
jmp Again_Input
;------------------------------
Space_Event: call Output_Space_Error
jmp Again_Input
;------------------------------
Toolong_Event: call Output_TooLong_Error
call Clear_String
xor cl,cl
jmp Again_Input
;------------------------------
Enter_Event: call O_End_In
ret
;-----------------------------------------
Input_Choise_Error: lea dx,Choise_Error_MSG ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
ret
;-----------------------------------------
Login: call Output_Login_Msg
Again_Login_bad: xor ax,ax
xor si,si
xor cx,cx
;------------------------------
Again_Login: call Input_Char
push ax
call Output_Astrix
pop ax
inc cl
cmp al,0dh
je Login_Enter_Event
cmp al,20h
je Login_Space_Event
cmp cl,21
je Login_TooLong_Event
cmp Pass_String[si],al
jne Login_bad
inc si
jmp Again_Login
;------------------------------
Login_bad: mov Login_Check,0
jmp Again_Login
;------------------------------
Login_Space_Event: call Output_Space_Error
jmp Again_Login
;------------------------------
login_Toolong_Event: call Output_TooLong_Error
call Clear_String
xor cl,cl
jmp Again_Login
;------------------------------
login_Enter_Event: dec cl
cmp size_Var,cl
je Password_Wrong
call O_End_In
cmp Login_Check,1
je Logon
;------------------------------
Password_wrong: call Output_Login_failed
mov Login_Check,1
jmp Again_Login_Bad
;------------------------------
logon: call Output_login_accepted
End_Login: ret
;------------------------------
Encrypt_Y_N: lea dx,Option_Encrypt ; Place the starting string index in BX
mov ah,09
int 21h ; Activate the 21/09 interrupt
;------------------------------
Again_Encrypt1: call Input_Char
cmp al,'y'
je Encrypt_Yes
cmp al,'n'
jne Again_Encrypt
mov Encrypt_Check,0
jmp End_Option_Encrypt
;------------------------------
Encrypt_Yes: call LnSpace
mov Encrypt_Check,1
End_Option_Encrypt: ret
;------------------------------
Again_Encrypt: lea dx,Input_Choise_Error ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
jmp Again_Encrypt1
;-----------------------------------------
Ask_Again: lea dx,Output_Again ; Place the starting string index in BX
mov ah,09h
int 21h ; Activate the 21/09 interrupt
call Input_Char
cmp al,'y'
je Restart
call Terminate
Restart: call Reset
;-----------------------------------------

Terminate: mov ah,4ch
int 21h ; End program
end[/left]

[/font]

פורסם

אני מבין שאתה לא לומד. ננעל על כותרת לא תקנית.

זו האזהרה השלישית שלך.

פורסם

הורחק לחודשיים על צבירת 3 אזהרות, פתיחת טרד נוסף ושפה לא נאותה בה"פ למודר.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים