I've been getting into reverse engineering lately and wanted to learn more about ASM. As such I looked up some tutorials, but have found confusing information regarding the dx register.
I've written a small "Hello World" example here:
section .text
global _start
_start:
mov edx, mes_len ; Store where the bytes end for the data in the data register
mov ecx, message ; Store the reference to the message that we're going to write in the counter register
mov ebx, 1 ; Tell tha base register that we want to push to the stdout
mov eax, 4 ; Move 4 into the Accumulator which is the equivalent of calling sys write on linux
int 0x80 ; int means interrupt, 0x80 means interrupt the kernel to make our system calls
mov eax, 1 ; Move 1 into accumulator, which is sys exit on linux
mov ebx, 0 ; exit code 0
int 0x80
section .data
message: db "Hello, World", 10, 0 ; 10 is the newline character and 0 is the null character
mes_len: equ $ - message ; "$" means current position, then we subtract that from the length of our message
and the line
mov edx, mes_len ; Store where the bytes end for the data in the data register
doesn't make sense to me. According to this source, edx is used alongisde the Accumulator for complex calculations like division or multiplication, but also for I/O. It then states that the data register holds the address of the message, but doesn't the accumulator also hold the address of message?
Any help would be appreciated.