flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Main > get local variable pointer without " lea"? | 
| Author | 
 | 
| revolution 03 Apr 2018, 22:44 celtic88 wrote: How can get local variable pointer Without " lea" , thank you | |||
|  03 Apr 2018, 22:44 | 
 | 
| CandyMan 03 Apr 2018, 22:48 did you mean:
 Code: proc Func local pDirectx:DWORD mov eax,pDirectx-ebp mov eax,[ebp+eax] ret endp | |||
|  03 Apr 2018, 22:48 | 
 | 
| ProMiNick 03 Apr 2018, 22:49 in current example
 mov eax, pDirectx equivalent to mov eax,esp or... ... or (only because macro proc used) equivalent to mov eax,ebp if locals will be more than 1 dword so analog for lea will be 2 instructions instead of one lea, one of them is mov described previously & second is add or sub instruction with value equal to address range from esp (or ebp) to pointer to thour variable | |||
|  03 Apr 2018, 22:49 | 
 | 
| revolution 03 Apr 2018, 22:53 LEA is just an ADD in disguise.     Code: add eax,ebp,offset ;same as lea eax,[ebp+offset] | |||
|  03 Apr 2018, 22:53 | 
 | 
| celtic88 04 Apr 2018, 07:40 Currently I use this method!!
 Code: macro LocalPoint localV,localP {LEA eax, [localV] mov [localP], eax} proc Func local pDirectx:DWORD,p_pDirectx:DWORD LocalPoint pDirectx,p_pDirectx ;//lea eax, [pDirectx] mov eax, pDirectx ;// Get pDirectx Pointer ?? ret endp | |||
|  04 Apr 2018, 07:40 | 
 | 
| revolution 04 Apr 2018, 08:02 celtic88 wrote: Currently I use this method!! | |||
|  04 Apr 2018, 08:02 | 
 | 
| celtic88 04 Apr 2018, 19:01 to do this
 Code: proc main local testt:DWORD LEA eax, [testt] stdcall Set,eax ;; i liked this syntax stdcall Set,test MOV eax, [testt] ret endp proc Set varbypoint MOV eax,[varbypoint] MOV dword [eax], 404 ret endp | |||
|  04 Apr 2018, 19:01 | 
 | 
| revolution 04 Apr 2018, 22:29 You can use addr     Code: stdcall Func,addr testt     | |||
|  04 Apr 2018, 22:29 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.