Having this nasm:
global _start
section .text
_start:
mov rax, 1 ;syscall number
mov rdi, 1 ;fd [data index]
mov rsi, msg3 ;buffer [source index]
mov rdx, len2+10 ;sizeof(*buffer) [data]
syscall
mov rax, 60 ;syscall
mov rdi, rdi ;exit code=0
syscall
section .data
msg db 'hello world', 0
msg2 db 'Goodbye!',0
len1 equ $ - msg
len2 equ $ -msg2
msg3 db 'len1=',len1,10,'len2=',len2,10
I want to embed symbols len1
len2
to the final buffer that goes to the rsi
before write. I want to try the misuse the $
in that, the second len2
should have both strings size, as stated here: How does $ work in NASM, exactly? according to @Peter Cordes. How can I embed multiple objects (whether strings addresses or ascii chars or number or ...) as I can in c
? (printf("format whatever %s %i %c", string, int, char)
). How to do that?