Wednesday, March 23, 2016

8051 Swap Nibble

Swap nibbles within the Accumulator – SWAP A
SWAP A interchanges the low- and high-order nibbles (four-bit fields) of the Accumulator (bits 3 through 0 and bits 7 through 4). The operation can also be thought of as a 4-bit rotate instruction. No flags are affected.

Encoding: 1 1 0 0 0 1 0 0

The Accumulator holds the value 0C5H (11000101B). The instruction,

SWAP A

leaves the Accumulator holding the value 5CH (01011100B).

ORG 0H
MOV A, #0C5H; A = C5B
SWAP A; A = 5CB
END; end of asm source file



Related topics:
8051 Complement Accumulator and Bit   |   8051 Set Bit   |   8051 Clear Accumulator and Bit   |   8051 Rotate Accumulator   |   8051 Exchange Accumulator   |   8051 Exchange Digit   |   8051 Push and Pop   |   8051 No Operation

List of topics: 8051

No comments:

Post a Comment