[postlink]https://iamdaowner.blogspot.com/2012/06/create-simple-password-program-in.html[/postlink]
Here's a simple password program written in Assembly language to verify users. Using A86 assembler to compile and run the program. If you want to create your very first assembly, read this post: http://codewall.blogspot.com/2011/06/create-your-first-assembly-program-step.html
Display: version 1
Source Code: version 1
Display: version 2 - using asterisk (*)
Source Code: version 2 - using asterisk (*)
Display: version 1
Source Code: version 1
001 | start: jmp main |
002 |
003 | den db 0ah, 0dh, "Access Denied. $" |
004 | grant db 0ah, 0dh, "Access Granted. $" |
005 | ent db "Enter Password: $" |
006 | |
007 | ctr db 0h |
008 | |
009 | main proc |
010 |
011 | mov ctr,1 |
012 | |
013 | mov ah,09h |
014 | lea dx,ent |
015 | int 21h |
016 | |
017 | cmp ctr,1 |
018 | je loop1G |
019 | press: |
020 | cmp ctr,2 |
021 | je loop2G |
022 | |
023 | cmp ctr,3 |
024 | je loop3G |
025 | |
026 | press2: |
027 | cmp ctr,2 |
028 | je mislead1 |
029 | |
030 | cmp ctr,3 |
031 | je loopD |
032 | |
033 | loop1G: |
034 | mov ctr,2 |
035 | |
036 | mov ah,01 |
037 | int 21h |
038 | |
039 | cmp al, "V" |
040 | je press |
041 | |
042 | cmp al, "V" |
043 | jne press2 |
044 |
045 | loop2G: |
046 | mov ctr,3 |
047 | |
048 | mov ah,01 |
049 | int 21h |
050 | |
051 | cmp al, "M" |
052 | je press |
053 | |
054 | cmp al, "M" |
055 | jne press2 |
056 | |
057 | mislead1: |
058 | mov ctr,3 |
059 | |
060 | mov ah,01 |
061 | int 21h |
062 | |
063 | cmp al, "M" |
064 | je press2 |
065 | |
066 | cmp al, "M" |
067 | jne press2 |
068 | |
069 | loop3G: |
070 | mov ctr,4 |
071 | |
072 | mov ah,01 |
073 | int 21h |
074 | |
075 | cmp al, "G" |
076 | je dispG |
077 |
078 | loopD: |
079 | mov ctr,4 |
080 | |
081 | mov ah,01 |
082 | int 21h |
083 | |
084 | cmp al, "G" |
085 | je dispD |
086 | |
087 | cmp al, "G" |
088 | jne dispD |
089 | |
090 | dispD: |
091 | mov ah,09h |
092 | lea dx,den |
093 | int 21h |
094 | int 20h |
095 |
096 | dispG: |
097 | mov ah,09h |
098 | lea dx,grant |
099 | int 21h |
100 | int 20h |
101 |
102 | main endp |
103 | end start |
Display: version 2 - using asterisk (*)
Source Code: version 2 - using asterisk (*)
01 | start: jmp main |
02 |
03 | str1 db "password: $" |
04 | |
05 | main proc |
06 |
07 | mov ah,09 |
08 | lea dx,str1 |
09 | int 21h |
10 | |
11 | press: |
12 | mov ah,07 |
13 | int 21h |
14 | |
15 | mov bl,al |
16 | |
17 | mov ah,02 |
18 | mov dl, "*" |
19 | int 21h |
20 | |
21 | cmp bl,0dh |
22 | jne press |
23 | |
24 | int 20h |
25 |
26 | main endp |
27 | end start |
0 comments:
Post a Comment