206
4
4 Instructions4.5.4 Data Rotation and Shift
◆
Function
The 16 bits of the word with the carry ag in the element [D] are shifted n bit places to the right. n is a
number in the range 0 to 15.
When n ≥ 16, bits are shifted by a number of bit places calculated by n%16 (remainder). For example,
when n = 20, bits are shifted four bit places (20%16 = 4) to the right.
The 1/0 state of the (n – 1)th bit in [D] is written to the carry ag M8022. The n bits starting from the highest
bit in [D] are lled with 0s.
1 1
1
0 1 1
1 0
1 1
bit0
1
1 0
1
1 1 0
bit1bit15 bit14 bit13 bit12 bit11bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2
D
0 0
0
0 0 0
1 0
1 1
bit0
0
1
1 1 0
bit1bit15 bit14 bit13 bit12 bit11bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2
D
0
n=6
Changed to 0
Carry flag
M8022
An error is returned in the following condition. The error ag M8067 is set to ON to identify this error and
the error code is stored in D8067.
Error 6706 is returned when n < 0.
◆
Application
●
Before execution of the instruction
●
After execution of the instruction