Rajko Mutic
Rajko Mutic

Reputation: 21

Difference between enter 0,0 and push ebp?

I'm new to assembly and working through examples to get a better understanding. I came across 2 programs one which uses enter 0,0 and other using push ebp; mov ebp, esp. I understand pusha pushes all general purpose registers onto the stack. I'm confused if these two terms can be user interchangeably or not?

enter 0,0
pusha

equal to

push ebp
mov ebp, esp

in assembly?

Upvotes: -1

Views: 1613

Answers (1)

Sep Roland
Sep Roland

Reputation: 39366

The single instruction enter 0, 0 is equivalent to the pair of instructions push ebp mov ebp, esp. The enter requires 4 bytes to encode, the combo requires only 3 bytes.

Your 2 code snippets aren't equivalent because of the pusha.
Either remove it from the first, or add it to the second.

Upvotes: 3

Related Questions