S3C84E5/C84E9/P84E9

INSTRUCTION SET

 

 

SWAP — Swap Nibbles

SWAP dst

Operation: dst (0 – 3) dst (4 – 7)

The contents of the lower four bits and the upper four bits of the destination operand are swapped.

7

4 3

0

Flags:

C:

Undefined.

 

Z: Set if the result is "0"; cleared otherwise.

 

S: Set if the result bit 7 is set; cleared otherwise.

 

V:

Undefined.

 

D:

Unaffected.

 

H:

Unaffected.

Format:

 

Bytes Cycles Opcode

Addr Mode

(Hex)

dst

opc

dst

 

 

Examples: Given: Register 00H

SWAP 00H

SWAP @02H

2

4

F0

R

 

4

F1

IR

=3EH, register 02H = 03H, and register 03H = 0A4H:

Register 00H = 0E3H

Register 02H = 03H, register 03H = 4AH

In the first example, if the general register 00H contains the value 3EH (00111110B), the statement "SWAP 00H" swaps the lower and the upper four bits (nibbles) in the 00H register, leaving the value 0E3H (11100011B).

6-83

Page 210
Image 210
Samsung S3C84E5 user manual Swap Swap Nibbles, Swap dst, Opc Dst Examples Given Register 00H, Swap 00H Swap @02H