3. Instructions
586
CS/CJ/NSJ Series Instructions Reference Manual (W474)
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.
z 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
Function block
definitions
Block program areas Step program areas Subroutines Interrupt tasks
SFC action or
transition programs
Usage OK OK OK 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/EM
addresses
Con-
stants
Registers Flags
Pulse
bits
TR
bits
CIO WR HR AR T C DM EM
@DM
@EM
*DM
*EM
DR IR
Indirect
using IR
TK CF
N
OK OK OK OK OK OK OK OK OK OK
OK OK
--- OK --- --- --- ---
R1 --- ---
Name Label Operation
Error Flag ER • ON if the N is 0.
• ON if the Communications Port Enabled Flag for the communications port number specified as the
Com Port number for Background Execution is OFF when background processing is specified.
• OFF in all other cases.
N: Number of words
R1: First word in range
SWAP(637)
N
R1
R1
R1+(N–1)
15 087
to
to to
Leftmost byte Rightmost byte