%macro scall 4
mov rax,%1
mov rdi,%2
mov rsi,%3
mov rdx,%4
syscall
%endmacro
section .data
password db "Adidas"
passwordLen equ $-password
msg1 db 10d,"Enter the Password : "
msg1Len equ $-msg1
msg2 db 10d,"Password is Correct"
msg2Len equ $-msg2
msg3 db 10d,"Password is Wrong"
msg3Len equ $-msg3
newline db 10
section .bss
string resb 50
length resb 1
section .text
global _start
_start:
scall 1,1,newline,1
scall 1,1,msg1,msg1Len
scall 0,0,string,50
;dec al
mov [length],al
mov rcx,passwordLen
mov rsi,password
mov rdi,string
;------CALLING A PROCEDURE------
call pass
;------EXIT CALL------
exit:
mov rax,60
mov rdi,0
syscall
;------PROCEDURE------
pass:
cmp byte[length],passwordLen
jne wrong
check:
cld ;auto increment to the next location
repe cmpsb ;compare the characters
cmp ecx,0
jne wrong
scall 1,1,msg2,msg2Len
scall 1,1,newline,1
ret
wrong:
scall 1,1,msg3,msg3Len
scall 1,1,newline,1
ret
To embed this project on your website, copy the following code and paste it into your website's HTML: