Chapter 3 Creating and Editing Screens
SWAP (Swap High-Byte and Low-Byte Data)
Equation
SWAP (Var1, Var2, Var3)
Explanation
Swap high-byte and low-byte of Va r3 number of words s tarting at Var2 an d save it in
memory starting at Var1.
Remark
The calculation result can be stored as unsigned WORD.
Var1 and Var2 can be internal memory only. Var3 can be internal memory or
constant.
Example
Swap the high-byte and low-byte of $11 and store the result in $2 (this is an
operation of unsigned 16-bit data).
If $11 = 1234H, after executing SWAP command, $2 = 3412H.
XCHG (Exchange Data)
Equation
XCHG (Var1, Var2, Var3)
Explanation
Exchange Var3 number of words of data starting at Var2 with the same number of
words starting at Var1.
Remark
The calculation result can be stored as unsigned WORD.
Var1 and Var2 can be internal memory only. Var3 can be internal memory or
constant.
Revision May, 2010 3-337