80C186 INSTRUCTION SET ADDITIONS AND EXTENSIONS

BP

SP

15

0

Old BP

BPM

BPM

BPM

BPA

BPA

BPM

BPA

BPB

BPB

BPM

BPA

BPC

Display C

Dynamic Storage C

A1005-0A

Figure A-6. Stack Frame for Procedure C at Level 3 Called from B

LEAVE

LEAVE reverses the action of the most recent ENTER instruction. It collapses the last stack frame created. First, LEAVE copies the current BP to the Stack Pointer, releasing the stack space allocated to the current procedure. Second, LEAVE pops the old value of BP from the stack, to return to the calling procedure's stack frame. A RET instruction will remove arguments stacked by the calling procedure for use by the called procedure.

A-7

Page 314
Image 314
Intel 80C188XL, 80C186XL user manual Leave