Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ENTER/LEAVE Instructions
 Detail Key                               Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
  Title:    Make or Destroy Stack Frame           Flags: O D I T S Z A P C
            80186-80486 Only                             ═════════════════
                                                              -none-
  Syntax:   ENTER bytes,level
            LEAVE
 
  See also: .186, PROC, PUSH, POP, RET, PROTO, INVOKE
 
  Description:
 
     ENTER creates a stack frame for a procedure that receives
     parameters passed on the stack. When <level> is 0, ENTER is
     equivalent to push bp, followed by mov bp,sp.
 
     The first operand of the ENTER instruction specifies the number of
     bytes to reserve for local variables. The second operand specifies
     the nesting level for the procedure. The nesting level should be 0
     for languages that do not allow access to local variables of
     higher-level procedures (such as C, Basic, and FORTRAN).
 
     LEAVE terminates the stack frame of a procedure. This instruction
     also reverses the action of a previous ENTER instruction by
     restoring SP and BP to the values they had before the procedure
     stack frame was initialized. LEAVE is equivalent to mov sp,bp,
     followed by pop bp.
                                    -♦-