Figure 36. example of a 16-bit load operation – Zilog Z08470 User Manual
Page 56

Z80 CPU Instructions
UM008007-0715
44
Z80 CPU
User Manual
instructions begin on page 96.
These 16-bit load operations differ from other 16-bit loads in that the stack pointer is auto-
matically decremented and incremented as each byte is pushed onto or popped from the
stack, respectively. For example, the PUSH AF instruction is a single-byte instruction with
the op code of
F5h
. During execution, this sequence is generated as:
Decrement SP
LD (SP), A
Decrement SP
LD (SP), F
The external stack now appears as shown in Figure 36.
The POP instruction is the exact reverse of a PUSH. All PUSH and POP instructions uti-
lize a 16-bit operand and the high-order byte is always pushed first and popped last.
PUSH BC is PUSH 8 then C
PUSH DE is PUSH D then E
PUSH HL is PUSH H then L
POP HL is POP L then H
The instruction using extended immediate addressing for the source requires two bytes of
data following the op code, as shown in the following example:
LD DE, 0659h
The instruction sequence for this value in memory is shown in Figure 37.
Figure 36. Example of a 16-Bit Load Operation
Note:
(SP)
(SP+1)
F
A
Top of stack
•
•
•
•