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 />

Main Program (Lexical Level 1)<br />

Procedure A (Lexical Level 2)<br />

Procedure B (Lexical Level 3)<br />

Procedure C (Lexical Level 3)<br />

Procedure D (Lexical Level 4)<br />

A1001-0A<br />

Figure A-2. Variable Access in Nested Procedures<br />

The first ENTER, executed in the Main Program, allocates dynamic storage space for Main, but<br />

no pointers are copied. The only word in the display points to itself because no previous value<br />

exists to return to after LEAVE is executed (see Figure A-3).<br />

BP<br />

SP<br />

15 0<br />

Old BP<br />

BPM<br />

*BPM = BP Value for MAIN<br />

Display Main<br />

Dynamic<br />

Storage<br />

Main<br />

a1002 0a pc<br />

Figure A-3. Stack Frame for Main at Level 1<br />

A1002-0A<br />

After Main calls Procedure A, ENTER creates a new display for Procedure A. The first word<br />

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

(BPA). BPM contains the base for dynamic storage in Main. All dynamic variables for Main will<br />

be at a fixed offset from this value (see Figure A-4).<br />

A-4

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

Saved successfully!

Ooh no, something went wrong!