Download Print this page

ZiLOG Z80 Handbook page 62

Hide thumbs Also See for Z80:

Advertisement

The three additional exchange instructions operate using the SP
register as a pointer to the stack area. The stack pointer is not af-
fected by execution of the instructions. Either HL, IX, or IY may
be exchanged with current top of stack by instructions EX (SP),HL;
EX (SP),IX; or EX (SP),IY. Examples of the three kinds of ex-
changes are shown in Fig. 5-5.
EX (SP) , HL (SP) • 102511
MEMORY
1025H
(TOP OF STACK)
1026H
I (TOP OF STACK + 1)
EX (SP), IX
MEMORY
(SP) • 2043H
204311
(TOP OF STACK)
2044H
(TOP OF STACK + 1)
EX (S P). IY
IY H IGH ORDER
(SP) • 128AH
IY LOW ORDER
J
MEMORY
128AH
(TOP OF STACK)
128BH
1EE (TOP OF STACK + 1
Fig. 5-5. EX (SP) instructions.
LDI, LDIR, LDD, and LDDR are four block transfer instructions
that use register pairs BC, DE, and HL. All four instructions trans-
fer a block of data from one place in memory to another. The block
may be 1 to 64K bytes. Register pair BC must be preset with the
number of bytes to be transferred, register pair HL must point to
the starting address of the source block, and register pair DE must
point to the starting address of the destination block. Instruction
LDI performs the following actions when executed:
1. A byte is transferred from the source block to the destination
block using registers HL and DE as pointers.
65

Advertisement

loading
Need help?

Need help?

Do you have a question about the Z80 and is the answer not in the manual?

Questions and answers