global _start
_start:

section .text
%macro disp_msg 2
mov rax,1
mov rdi,1
mov rsi,%1
mov rdx,%2
syscall
%endm
%macro accept_msg 2
mov rax,0
mov rdi,0
mov rsi,%1
mov rdx,%2
syscall
%endm

disp_msg msg1,len1
disp_msg msg2,len2
accept_msg str1,strlen

call display

disp_msg msg3,len3

mov rax,60
mov rdi,0
syscall


display:
mov rsi,disparr+1
mov rcx,02
a2:
mov rdx,0
mov rbx,10h
div rbx
cmp dl,09h
jbe a1
add dl,07h
a1:
add dl,30h
mov [rsi],dl;
dec rsi
dec rcx
jnz a2

disp_msg disparr,02
ret

section .data
msg1 db "Enter string",0Ah
len1 equ $-msg1
msg2 db "String length is:",0Ah
len2 equ $-msg2
msg3 db "",0Ah
len3 equ $-msg3

section .bss
str1 resb 10
strlen resb 10
disparr resb 32

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: