The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: LAS3R on August 10, 2006, 09:47:32 PM

Title: change LOCAL stack pointer!
Post by: LAS3R on August 10, 2006, 09:47:32 PM
I noticed that masm use ebp instead of esp when offset to LOCAL is used but in my prog i use ebp also so is there anyway i can change ebp to esp instead?

for ex:


LOCAL Hash1:DWORD

mov dword ptr [Hash1], eax <-- this will for ex turn into "mov dword ptr [ebp-4], eax" , but i want "mov dword ptr [esp-4], eax" instead, is it possible to change masm behavior?

since i use ebp register it will crash when it reach that line, which kind of annoying, and yes i need all registers ;)
Title: Re: change LOCAL stack pointer!
Post by: GregL on August 10, 2006, 11:07:13 PM
LAS3R,

Eliminate the stack frame with OPTION PROLOGUE:NONE and OPTION EPILOGUE:NONE and write it your way. Here is an example, it is StrLen from the MASM32 Library. Also read the post below it by Tedd.

http://www.masm32.com/board/index.php?topic=4629.msg34442#msg34442

Title: Re: change LOCAL stack pointer!
Post by: LAS3R on August 11, 2006, 08:26:13 AM
thank you very much!
Title: Re: change LOCAL stack pointer!
Post by: Petroizki on August 15, 2006, 05:21:21 AM
When you eliminate the stack frame, you have to make all the local pointers manually (you can't use the keyword Hash1 anymore).

I created my "pmacros" to free-up the ebp register used by MASM's stack frame. You might want to check it out, it might be little confusing and stupid to use these macros at first, but trust me, it's much simpler than manually making the esp pointing.

http://www.masm32.com/board/index.php?topic=1063.0