2-253
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Table Data Processing
Instructions
2
SWAP
Table Data Processing Instructions
SWAP
Applicable Program Areas
Operands
N: Number of words
N specifies the number of words in the range and must be 0001 to FFFF hexadecimal (or &1 to
&65,535).
R1: First word in range
Note R1 and R1+(N-1) must be in the same data area.
Operand Specifications
Flags
Instruction Mnemonic Variations
Function
code
Function
SWAP BYTES SWAP @SWAP 637
Switches the leftmost and rightmost bytes in all of
the words in the range.
Symbol
SWAP
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
N Number of words UINT 1
R1 First word in range UINT Variable
Area
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits
CIO WR HR AR T C DM @DM *DM
N
OK OK OK OK OK OK OK OK OK
OK ---
--- ---
R1 ---
Name Label Operation
Error Flag P_ER • ON if the N is 0.
• OFF in all other cases.
N: Number of words
R1: First word in range
SWAP(637)
N
R1
R1
R1+(N–1)
15
08 7
to
to
to
Leftmost byte Rightmost byte