October 2018
Beginner to intermediate
436 pages
9h 36m
English
MOV is used to read the value at a given address, while LEA (Load Effective Address) is used to get the address instead:
mov eax, dword ptr [00000060] ; stores 63626160h to eaxmov eax, dword ptr [00000060] ; stores 00000060h to eax
So, how is the LEA instruction helpful if you can calculate the address by yourself? Let's take the following C code as an example:
struct Test { int x; int y;} test[10];int value;int *p;// some code here that fills up the test[] arrayfor (int i=0; i<10, i++) { value = test[i].y; p = &test[i].y;}
The C code starts with defining test[10], an array of struct Test, which contains two integers, x and y. The for-loop statement takes the value of y and the pointer address of y in a struct test element. ...
Read now
Unlock full access