from my previous doubt - Difference between “mov eax, [num]” and “mov eax, num”
I came to know " mov eax, num " will store address of num in eax and " mov eax, [num] " will store value of num in eax
Now HERE !
mov edx, strLen ; Arg three: the length of the string
mov ecx, str ; Arg two: the address of the string
mov ebx, 1 ; Arg one: file descriptor, in this case stdout
mov eax, 4 ; Syscall number, in this case the write(2)
int 0x80 ; Interrupt 0x80
section .data
str: db 'Hello, world!',0xA
strLen: equ $-str
Ideally edx register should have length, so
- as " mov ecx, str " - stores address of str in ecx
- haven't " mov edx, strlen " should also store address of strlen and not the value in edx.
- to store value of strlen in edx, why are we not using " mov edx, [strlen] "
the following code is referenced from this link - http://asm.sourceforge.net/intro/hello.html
Its killing me !
Thanks in Advance...