beautypg.com

Zilog EZ80F916 User Manual

Page 44

background image

eZ80

®

CPU

User Manual

UM007715-0415

Mixed-Memory Mode Applications

35

3. Use a suffixed CALL to access each block of code in the memory mode in which it

was assembled or compiled. Suffixed JP instructions may also be used; however, suf-

fixed CALL instructions are recommended, because the CPU keeps track of all the

necessary memory modes when switching between blocks.

4. Any code block that may be called from either Z80 mode or ADL mode must be

called with a suffix to save the calling code’s memory mode on the SPL stack.

5. Any routine that may be called from either mode must return with a suffixed RETI.L

instruction to restore the calling code’s memory mode from the SPL stack.

6. If a calling code operating in one mode must pass stack-based operands/ arguments to

a routine compiled or assembled for a different mode, it must use suffixed instructions

to set up the operands/arguments. For PUSH, .S and .L suffixes control whether SPS

or SPL is used and whether the operands/ arguments are stored as 2- or 3-byte values.

In mixed-ADL applications, some of these rules may represent exceptions to the eZ80

®

CPU’s design goal; that legacy code does not require modification to run on the eZ80

®

CPU. Assuming that legacy routines are not selectively converted to ADL mode and do not
call newly-written routines, the only rule that could lead to such modification is Rule 5. If
each legacy Z80 mode routine ends with a single RET.L at its end, this conversion is easy.
Internal and conditional RETs require more careful review.

Note:

This manual is related to the following products: