Is the below instruction in message:
an correct? Specifically, because "Hello, World", is a total of 12
bytes, however, the right operand has "10".
I wanted to know if that is an error. If not, why does it specify 10 as the right operand? I got this code from here: (http://cs.lmu.edu/~ray/notes/x86assembly/)
Also, in mov rdx,13
why does it specify 13 bytes and not the actual size of message
?
global _start
section .text
_start:
; write(1, message, 13)
mov rax, 1 ; system call write is 1
mov rdi, 1 ; 1 is stdout
mov rsi, message ; address of string
mov rdx, 13 ; number of bytes
syscall ; invoke operating system call
; exit(0)
mov eax, 60 ; system call 60 is exit
xor rdi, rdi ; exit code 0
syscall ; invoke exit
message:
db "Hello, World", 10