Figure a4. stack frame for procedure a at level 2 – Intel 80C188XL User Manual

Page 312

Advertising
background image

A-5

80C186 INSTRUCTION SET ADDITIONS AND EXTENSIONS

Figure A-4. Stack Frame for Procedure A at Level 2

After Procedure A calls Procedure B, ENTER creates the display for Procedure B. The first word
of the display points to the previous value of BP (BPA). The second word points to the value of
BP for MAIN (BPM). The third word points to the BP for Procedure A (BPA). The last word
points to the current BP (BPB). Procedure B can access variables in Procedure A or Main via the
appropriate BP in the display (see Figure A-5).

After Procedure B calls Procedure C, ENTER creates the display for Procedure C. The first word
of the display points to the previous value of BP (BPB). The second word points to the value of
BP for MAIN (BPM). The third word points to the value of BP for Procedure A (BPA). The
fourth word points to the current BP (BPC). Because Procedure B and Procedure C have the same
lexical nesting level, Procedure C cannot access variables in Procedure B. The only pointer to
Procedure B in the display of Procedure C exists to allow the LEAVE instruction to collapse the
Procedure C stack frame (see Figure A-6).

Old BP

BP

SP

15

0

BPM

BPM

BPM

BPA*

Display A

Dynamic

Storage A

*BPA = BP Value for Procedure A

A1003-0A

Advertising
This manual is related to the following products: