03.01.2015 Views

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

80C186 INSTRUCTION SET ADDITIONS AND EXTENSIONS<br />

15 0<br />

Old BP<br />

BPM<br />

BP<br />

SP<br />

BPM<br />

BPM<br />

BPA*<br />

Display A<br />

Dynamic<br />

Storage A<br />

*BPA = BP Value for Procedure A<br />

A1003-0A<br />

Figure A-4. Stack Frame for Procedure A at Level 2<br />

After Procedure A calls Procedure B, ENTER creates the display for Procedure B. The first word<br />

of the display points to the previous value of BP (BPA). The second word points to the value of<br />

BP for MAIN (BPM). The third word points to the BP for Procedure A (BPA). The last word<br />

points to the current BP (BPB). Procedure B can access variables in Procedure A or Main via the<br />

appropriate BP in the display (see Figure A-5).<br />

After Procedure B calls Procedure C, ENTER creates the display for Procedure C. The first word<br />

of the display points to the previous value of BP (BPB). The second word points to the value of<br />

BP for MAIN (BPM). The third word points to the value of BP for Procedure A (BPA). The<br />

fourth word points to the current BP (BPC). Because Procedure B and Procedure C have the same<br />

lexical nesting level, Procedure C cannot access variables in Procedure B. The only pointer to<br />

Procedure B in the display of Procedure C exists to allow the LEAVE instruction to collapse the<br />

Procedure C stack frame (see Figure A-6).<br />

A-5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!