| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi, I am a newbie learning assembly language. Somewhere I found that while initialization of global/text segment in program some authors do it like as shown below : enter 0,0 ; setup routine pusha and while exiting popa mov eax, 0 leave I am not able to understand why we enter 0,0 to stack . Any help in clarifying this doubt would be much appreciated. Best Regards Sharwan |
|
#2
| |||
| |||
| Sharwan <spamtrap@crayne.org> wrote: > > I am a newbie learning assembly language. Somewhere I found that >while initialization of global/text segment in program some authors >do it like as shown below : What do you mean by "initialization of global/text segment"? The >enter 0,0 ; setup routine >pusha > >and while exiting >popa >mov eax, 0 >leave > >I am not able to understand why we enter 0,0 to stack . >Any help in clarifying this doubt would be much appreciated. If this is the entry to and exit from a function, then I'd believe this. "enter 0,0" is the same as: push ebp mov ebp, esp What this does is let "ebp" point to a known, fixed location, regardless of how much manipulation we do with the stack, so we can find any parameters that were passed, or any local variables we might have allocated. However, if this is for a function, then pusha/popa is very expensive overkill. -- Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.