SWAPF

Swap nibbles in f

The upper and lower nibbles of register ‘f’ are exchanged. If ‘d’ is ‘0’, the result is placed in the W register. If ‘d’ is ‘1’, the result is placed in register ‘f’.

[the_ad id="3059"]

Syntax:

[ label ] SWAPF f,d

Operation:

(f<3:0>) → (destination<7:4>),
(f<7:4>) → (destination<3:0>)

Operands:

  • f is from 0 to 127
  • d is either 0 or 1

Status Affected: C

Example:

SWAPF REG,0

Before instruction:

REG = 0x02
W = 0x01

After instruction:

REG = 0x02
W = 0x20

[the_ad id="3059"]

Example:

SWAPF REG,1

Before instruction:

REG = 0x02
W = 0x04

After instruction:

REG = 0x02
W = 0x20