SAM47 INSTRUCTION SET KS57C2308/P2308/C2316/P2316
5-90
XCH Exchange A or EA with Nibble or Byte
XCH dst,src
Operation: Operand Operation Summary Bytes Cycles
A,DA Exchange A and data memory contents 2 2
A,Ra Exchange A and register (Ra) contents 1 1
A,@RRa Exchange A and indirect data memory 1 1
EA,DA Exchange EA and direct data memory contents 2 2
EA,RRb Exchange EA and register pair (RRb) contents 2 2
EA,@HL Exchange EA and indirect data memory contents 2 2
Description: The instruction XCH loads the accumulator with the contents of the indicated destination variable
and writes the original contents of the accumulator to the source.
Operand Binary Code Operation Notation
A,DA 01111001A DA
a7 a6 a5 a4 a3 a2 a1 a0
A,Ra 01101r2 r1 r0 A Ra
A,@RRa 01111i2 i1 i0 A (RRa)
EA,DA 11001111A DA,E DA + 1
a7 a6 a5 a4 a3 a2 a1 a0
EA,RRb 11011100EA RRb
11100r2 r1 0
EA,@HL 11011100A (HL), E (HL + 1)
00000001
Example: Double register HL contains the address 20H. The accumulator contains the value 3FH
(00111111B) and internal RAM location 20H the value 75H (01110101B). The instruction
XCH EA,@HL
leaves RAM location 20H with the value 3FH (00111111B) and the extended accumulator with
the value 75H (01110101B).