Why the output is in diffrent order than it is declared?
Shouldnt the output be in this order?
aaaa
bbbb
cccc
Instead it is:
I assume the issue is in assigning “bbb” value to the text variable, but i dont know why is that and how to do this the correct way.
Instructions:
section .data
text db "aaaa", 10
text2 db "cccc", 10
section .text
global _start
_start:
mov rax, text
call _printstring
mov rax, "bbb"
mov [text], rax
mov rax, text
call _printstring
mov rax, text2
call _printstring
mov eax, 60
xor edi, edi
syscall
_printstring:
push rax
mov rbx, 0
_printstringloop:
inc rax
inc rbx
mov cl, [rax]
cmp cl, 0
jne _printstringloop
mov rax, 1
mov rdi, 1
pop rsi
mov rdx, rbx
syscall
ret