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
208
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
CPUX
4.6.2.48 SWPB
SWPB
Swap bytes
Syntax
SWPB dst
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