1101
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Text String Processing Instructions
3
XCHG$
XCHG$
Applicable Program Areas
Operands
Ex1: First Exchange Word 1
Ex2: First Exchange Word 2
Note • The data from Ex1 to Ex1 + the maximum 2,047 words and from Ex2 to Ex2 + the maximum 2,047 words must be in
the same area.
• The data from Ex1 to Ex1 + the maximum 2,047 words and from Ex2 to Ex2 + the maximum 2,047 words cannot
overlap.
z Operand Specifications
Instruction Mnemonic Variations
Function
code
Function
EXCHANGE STRING XCHG$ @XCHG$ 665
Replaces a designated text string with another
designated text string.
Symbol
XCHG$
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
Ex1 First exchange word 1 UINT Variable
Ex2 First exchange word 2 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
D1, D2 OK OK OK OK OK OK OK OK OK OK --- --- --- OK --- --- --- ---
Ex1: First exchange word 1
Ex2: First exchange word 2
XCHG$(665)
Ex1
Ex2
15 0
Ex1
to to
Text string data: 4,095 characters max. + NUL
Ex1 + maximum 2,047 words
15 0
to to
Ex2
Text string data: 4,095 characters max. + NUL
Ex2 + maximum 2,047 words