I'm currently learning assembly, but I cannot seem to understand how storing values into registers and manipulating them results in a working program. I was wondering if you guys could provide a very easy to understand explanation on why certain things are being done within the assembly code.Take for example the Hello World program in assembly code:section     .textglobal      _start                              ;must be declared for linker (ld)_start:                                         ;tell linker entry pointWhy does the message length need to be put into the EDX register? And why is the EDX register chosen rather than a DX register or EAX register?mov     edx,len                             ;message lengthmov     ecx,msg                             ;message to writeI also do not understand why we are moving 1 into the EBX register? And for that matter moving 4 into the EAX register?mov     ebx,1                               ;file descriptor (stdout)mov     eax,4                               ;system call number (sys_write)int     0x80                                ;call kernelWhy are we moving 1 into EAX? What is so significant about EAX compared to the other registers? And what happened to the 4 stored in EAX previously?mov     eax,1                               ;system call number (sys_exit)int     0x80                                ;call kernelsection     .datamsg     db  'Hello, world!',0xa                 ;stringlen     equ $ - msg                             ;length of stringHow does data in the individual register interact with each other? How do they know that data is stored within them? TL DR: How is it all merged to present Helloworld onto the screen? 
How does storing values in registers result in a functioning program?
assembly;x86;linux
It would be more helpful to give a full sample program instead of bits and pieces. You could inline your questions using ;-preprended lines.1) Why does the message length need to be put into the EDX register?  And why is the EDX register chosen rather than a DX register or EAX  register?    mov     edx,len                             ;message length    mov     ecx,msg                             ;message to writeWhere (in which register) each parameter lands really is a matter of the architecture (seemingly here x86_64): ABI. The order usually is the same as for the C runtime functions which are the frontend to the syscalls, here write. It's a convention between the kernel and user mode.2) I also do not understand why we are moving 1 into the EBX register?  And for that matter moving 4 into the EAX register?    mov     ebx,1                               ;file descriptor (stdout)    mov     eax,4                               ;system call number (sys_write)    int     0x80                                ;call kernelOne is literally the file number of the standard stream named stdout.Four is the system call number (essentially an index into a table) and int 0x80 is a call gate into the kernel. I.e. execution transitions into the kernel and the respective system call (here sys_write) knows where to take the parameters from.Why are we moving 1 into EAX? What is so significant about EAX  compared to the other registers? And what happened to the 4 stored in  EAX previously?Usually the return value also ends up in EAX or EDX:EAX or similar. So the 4 would have been overwritten. It depends on the return type.One in this case is the system call number of sys_exit, the kernel-side function for the libc exit function.    mov     eax,1                               ;system call number (sys_exit)    int     0x80                                ;call kernelsection     .datamsg     db  'Hello, world!',0xa                 ;stringlen     equ $ - msg                             ;length of string3) How does data in the individual register interact with each other?  How do they know that data is stored within them?They don't. The kernel picks them from these registers and the (user mode) developer simply has to know where to put these pieces of data.In the normal case the user mode developer will, however, make use of a C runtime, like glibc.