8XC251SA, SB, SP, SQ USER’S MANUAL
A-130
Binary Mode Source Mode
Bytes: 21
States (2 bytes): 11 10
States (4 bytes): 16 15
Hex Code in: Binary Mode = [A5][Encoding]
Source Mode = [Encoding]
Operation: TRAP
SP ← SP – 2
(SP) ← PC
PC ← (0FF007BH)
XCH A,<byte>
Function: Exchange accumulator with byte variable
Description: Loads the accumulator with the contents of the specified variable, at the same time writing
the original accumulator contents to the specified variable. The source/destination operand
can use register, direct, or register-indirect addressing.
Flags:
Example: R0 contains the address 20H, the accumulator contains 3FH (00111111B) and on-chip RAM
location 20H contains 75H (01110101B). After executing the instruction
XCH A,@R0
RAM location 20H contains 3FH (00111111B) and the accumulator contains 75H
(01110101B).
Variations
XCH A,dir8
Binary Mode Source Mode
Bytes: 22
States: 3† 3†
†If this instruction addresses a port (P
x
,
x
= 0–3), add 2 states.
Hex Code in: Binary Mode = [Encoding]
Source Mode = [Encoding]
Operation: XCH
(A) → ← (dir8)
[Encoding] 1 0 1 1 1 0 0 1
CY AC OV N Z
—————
[Encoding] 1 1 0 0 0 1 0 1 direct addr