H <-> (SP+1), L <-> (SP)
EX
(SP),HL
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | |
---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | $E3 |
The low-order byte contained in register pair HL 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 HL is exchanged with the next highest memory address (SP+1).
None
If the HL register pair contains $7012, the SP register pair contains $8856, the memory location $8856 contains byte $11, and memory location $8857 contains byte $22, then the instruction
EX (SP),HL
results in the HL register pair containing number $2211, memory location $8856 containing byte $12, memory location $8857 containing byte $70 and Stack Pointer containing $8856.