
15
8
7
0
15
8
7
0
Low Byte
Low Byte
High Byte
High Byte
Before SWPB
After SWPB
0
x
0
...
19
19
16
16
15
8
7
0
15
8
7
0
Low Byte
Low Byte
High Byte
High Byte
Before SWPB
After SWPB
Instruction Set Description
4.6.2.48 SWPB
SWPB
Swap bytes
SWPB dst
Syntax
Operation
dst.15:8
↔
dst.7:0
Description
The high and the low byte of the operand are exchanged. PC.19:16 bits are cleared in
register mode.
Status Bits
Status bits are not affected
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Example
Exchange the bytes of RAM word EDE (lower 64 K)
MOV
#1234h,&EDE
; 1234h -> EDE
SWPB
&EDE
; 3412h -> EDE
Figure 4-42. Swap Bytes in Memory
Figure 4-43. Swap Bytes in a Register
181
SLAU272C – May 2011 – Revised November 2013
CPUX
Copyright © 2011–2013, Texas Instruments Incorporated