SAM47 INSTRUCTION SETKS57C2308/P2308/C2316/P2316

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

0

1

1

 

1

1

 

0

0

1

A DA

 

 

 

 

 

 

 

 

 

 

 

 

 

a7

a6

a5

 

a4

a3

 

a2

a1

a0

 

 

 

 

 

 

 

 

 

 

 

 

 

A,Ra

0

1

1

 

0

1

 

r2

r1

r0

A Ra

 

 

 

 

 

 

 

 

 

 

 

 

A,@RRa

0

1

1

 

1

1

 

i2

i1

i0

A (RRa)

 

 

 

 

 

 

 

 

 

 

 

 

EA,DA

1

1

0

 

0

1

 

1

1

1

A DA,E DA + 1

 

 

 

 

 

 

 

 

 

 

 

 

 

a7

a6

a5

 

a4

a3

 

a2

a1

a0

 

 

 

 

 

 

 

 

 

 

 

 

 

EA,RRb

1

1

0

 

1

1

 

1

0

0

EA RRb

 

 

 

 

 

 

 

 

 

 

 

 

 

1

1

1

 

0

0

 

r2

r1

0

 

 

 

 

 

 

 

 

 

 

 

 

 

EA,@HL

1

1

0

 

1

1

 

1

0

0

A (HL), E (HL + 1)

 

 

 

 

 

 

 

 

 

 

 

 

 

0

0

0

 

0

0

 

0

0

1

 

 

 

 

 

 

 

 

 

 

 

 

 

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).

5-90

Page 164
Image 164
Samsung KS57C2308 manual XCH Exchange a or EA with Nibble or Byte, Xch Ea,@Hl