A.5.135 LEA: Load Effective Address
LEA reg16,mem ; o16 8D /r [8086]
LEA reg32,mem ; o32 8D /r [386]
LEA, despite its syntax, does not access memory. It calculates the
effective address specified by its second operand as if it were going to
load or store data from it, but instead it stores the calculated address
into the register specified by its first operand. This can be used to
perform quite complex calculations (e.g. LEA EAX,[EBX+ECX*4+100]) in one
instruction.
LEA, despite being a purely arithmetic instruction which accesses no
memory, still requires square brackets around its second operand, as if
it were a memory reference.
The size of the calculation is the current _address_ size, and the size
that the result is stored as is the current _operand_ size. If the
address and operand size are not the same, then if the addressing mode
was 32-bits, the low 16-bits are stored, and if the address was 16-bits,
it is zero-extended to 32-bits before storing.
The ModR/M byte (see section A.2.6) can encode a register as source
operand, but this is an invalid instruction.