Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack 100h
- print macro msg
- mov ah, 9h ; Call print
- lea dx, msg ; Store pss to print register
- int 21h ; Run
- endm
- pchar macro msg
- mov ah, 2h ; Call char print
- lea al, msg ; Store pss to print register
- int 21h ; Run
- endm
- .data
- pss db 10,13,'Enter Password: $'
- cor db 10, 13, 'Correct!$'
- star db '*$'
- line db 10,13,'$'
- password db 'test'
- nnum db 0
- .code
- start:
- ; LOAD
- mov ax, @data
- mov ds, ax
- mov cx, 4 ; Size of password
- mov di, offset password
- print pss
- ; Compare each input with EAX
- compare:
- mov dl, [di] ; Get number in password
- mov ah, 8h ; Read char
- int 21h ; Run
- cmp al, dl ; Compare input with correct value
- print star
- je check
- jmp start
- check:
- cmp cx, 1 ; Check if last input
- je done ; Jump to done if last input
- dec cx ; Dec input counter
- add di, 1 ; Next value
- jmp compare ; Compare new input
- exit:
- mov ah, 4ch; Load DOS
- int 21h ; Run
- done:
- print cor
- jmp exit ; Exit the program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement