I think I am confused by the rules of this. Is it allowed to move something between a register and a memory block without specifying the pointer width? Shouldn't it be defaulted to copy the number of bytes matching the register if nothing is specified? Such as
mov eax, [ebp-08h]
Is it illegal or it simply moves the 4-byte starting at ebp-08h? And is it allowed to copy something that is shorter than the register?:
mov eax, BYTE PTR [ebp-08h]
which sends one byte at ebp-08h to the lowest byte of eax? Or it has to be a register that strictly matches the data (in this case: al)?
And when using LEA, since it only computes and copies the address value, not the content at that address, what is the point of specifying "DWORD/WORD/..."? Shouldn't addresses have a fixed width on one system (always 32/64) ?
If the the address in LEA can also be specified with a width: Then
mov eax, QWORD PTR [rbp-08h]
lea eax, QWORD PTR [rbp-08h]
The specifier of the 2nd operands are interpreted differently. In mov, QWORD PTR means the content at the address is 8 byte, while in lea, it means the ptr itself is 64bit. But isn't this redundant because rbp itself is always 64bit? Is this true about this inconsistency?
And what if in LEA the address is longer than specified: lea eax, DWORD PTR [rbp-08h] and what exactly does this do? Does it truncate the higher 4 byte of the value rbp-08??