I am trying to learn how to read assembly code. So far I have understood the basic instructions. Now I am trying to see if I can understand a dissassembly from a linked executable. So this is an executable that I compiled on Windows (i.e. PE/COFF). This is the first part of the executable (starting from the very first line in dissassembly, in Intel syntax)
0000000140001000: 48 83 EC 08 sub rsp,8
0000000140001004: 48 BA FF 97 9D 18 mov rdx,4189D97FFh
04 00 00 00
000000014000100E: 48 8B 05 F3 9E 05 mov rax,qword ptr [000000014005AF08h] <===
00
0000000140001015: 48 23 C2 and rax,rdx
0000000140001018: 48 3B C2 cmp rax,rdx
000000014000101B: 75 09 jne 0000000140001026
000000014000101D: 48 83 C4 08 add rsp,8
0000000140001021: E9 3A 00 00 00 jmp 0000000140001060
0000000140001026: 8B 05 DC 9E 05 00 mov eax,dword ptr [000000014005AF08h]
000000014000102C: 25 FF 97 9D 00 and eax,9D97FFh
0000000140001031: 3D FF 97 9D 00 cmp eax,9D97FFh
I believe the proper program execution starts at the beginning of the program (I'm not sure this is correct). If that is the case, then how does the mov
instruction in 3rd line work? (The line is highlighted above.)
The instruction seems to be moving the value in location 000000014005AF08h
to rax
. But where does the location 000000014005AF08h
come from? Is it set by something else before that program execution begins? And I can't find anything around the line 000000014005AF08h
because it is not shown in the dissassembly. Please help me because I feel as if I have misunderstood something here. The executable is available here.