EX (SP),IY

Operation

IYh <-> (SP+1), IYl <-> (SP)

Mnemonic

EX

Operands

(SP),IY

b7b6b5b4b3b2b1b0
1 1 1 1 1 1 0 1$FD
1 1 1 0 0 0 1 1$E3

Description

The low-order byte contained in Index Register IY is exchanged with the contents of the memory address specified by the contents of register pair SP (Stack Pointer), and the high-order byte of IY is exchanged with the next highest memory address (SP+1).

Condition Bits Affected

None

Example

If Index Register IY contains $3988, the SP register pair Contains $0100, memory location $0100 contains byte $90, and memory location $0101 contains byte $48, then the instruction

	EX	(SP),IY

results in the IY register pair containing number $4890, memory location $0100 containing $88, memory location $0101 containing $39, and the Stack Pointer containing $0100.