I am relatively new to assembly language. I have found so many tutorials that explain how to create a HelloWorld application using ML64 and MASM32, but none of them explain the program in detail. For example, have a look at the example below, which I found online and does compile (64 bit):
main proc
sub rsp, 68h ; space for 4 arguments + 16byte aligned stack
xor r9d, r9d ; 4. argument: r9d = uType = 0
lea r8, [caption] ; 3. argument: r8 = caption
lea rdx, [text] ; 2. argument: edx = window text
xor rcx, rcx ; 1. argument: rcx = hWnd = NULL
call MessageBoxA
xor ecx, ecx ; ecx = exit code
call ExitProcess
main endp
end
I can follow this through. I understand that there are general purpose registers and segment registers but how do you decide which one's to use. For example, why does 'r8' contain the caption instead of r9? Is there an assembly reference for the WinAPI? I realise this is a basic question. I have chosen the MASM32 tag as this is a general question with a 64 bit example.