%include "IO_DEFS.asm" section .data message1 db "Enter a message: " message1_length equ $ - message1 message2 db "Your message was: ",22h ; adding a quote to the end message2_length equ $ - message2 end_quote db '"',0ah ;end_quote db `\"\n` section .bss phrase resb 100 section .text global _start _start: ; prompt the user mov rax, SYS_WRITE mov rdi, STDOUT mov rsi, message1 mov rdx, message1_length syscall ;read a greeting mov rax, SYS_READ mov rdi, STDIN lea rsi, [phrase] mov rdx, 100 syscall mov r10, rax ; move the number of characters input r10 to hold it sub r10, 1 ; but there will be a spare endl at the end. ; print the response, label first mov rax, SYS_WRITE mov rdi, STDOUT mov rsi, message2 mov rdx, message2_length syscall ; then the message mov rax, SYS_WRITE mov rdi, STDOUT mov rsi, phrase mov rdx, r10 syscall ; an end quote and endl mov rax, SYS_WRITE mov rdi, STDOUT mov rsi, end_quote mov rdx, 2 syscall ; Exit mov eax, SYS_EXIT mov edx, SUCCESS syscall