
Instruction Set
4-136
LEAVE
LEAVE
Examples
This example procedure uses ENTER to: push the current frame pointer (BP) onto the
stack, set up BP to point to its stack frame, reserve 4 bytes on the stack for its local variables,
and indicate that it is not called by another procedure. The procedure uses LEAVE to
remove the local variables from the stack and restore BP.
; procedure that is not called by another
Main
PROC
FAR
ENTER
4,0
; reserve 4 bytes for variables
; procedure is not called by another
; perform operations
...
; save AX
PUSH
AX
; perform operations
...
LEAVE
; remove variables from stack
RET
2
; remove saved AX from stack
Main
ENDP
Summary of Contents for Am186 Series
Page 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Page 10: ...Table of Contents x...
Page 18: ...Programming 1 8...
Page 40: ...Instruction Set Listing 3 14...