Closed GuichiZhao closed 11 months ago
This could be clearer. For a label, you can do mov eax, LABEL where LABEL is effectively a constant. However, you can't do mov eax, ebp+8 since ebp+8 is not a constant; however, you can do lea eax, [ebp+8] to achieve the desired result. Otherwise one could do: mov eax, ebp add ebp,8 But this is not as simple as the single lea instruction.
However, issues are not a place to ask questions like this. An e-mail would be more appropriate.
Firstly I understand the difference between
lev
andmov
in terms of the result they can achieve, put in simplyHowever
So what
mov eax,ebp+8
is illegal whilelea eax,[ebp+8]
is OK? My book saysBut it make no sense to me! What is mean by CONSTANT? The obvious understanding it that the CONSTANT should be calculate by assembler/linker before the program run, BUT, think about
mov eax,[ebp+8]
is a LEGAL instruction, The assembler/linker has no way of knowing the value of[ebp+8]
(*(ebp+8) as C lingo) before the program run!https://stackoverflow.com/questions/77416613/why-leaload-effective-address-is-necessary