Omron CP1E-N@@D@-@ Computer Hardware User Manual


 
2-145
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Data Shift Instructions
2
NASR/NSRL
Flags
Function
NASR
NASR(581) shifts D (the shift word) by the specified number of binary bits (specified in C) to the right
(from the rightmost bit to the leftmost bit). Either zeros or the value of the rightmost bit will be placed
into the specified number of bits of the shift word starting from the rightmost bit.
NSRL
NSRL(583) shifts D and D+1 (the shift words) by the specified number of binary bits (specified in C) to
the right (from the leftmost bit to the rightmost bit). Either zeros or the value of the rightmost bit will be
placed into the specified number of bits of the shift word starting from the rightmost bit.
Precautions
For any bits which are shifted outside the specified word, the contents of the last bit is shifted to the
Carry Flag (CY), and all other data is discarded.
When the number of bits to shift (specified in C) is “0,” the data will not be shifted. The appropriate
flags will turn ON and OFF, however, according to data in the specified word.
Name Label Operation
Error Flag P_ER ON when the control word C (the number of bits to shift) is not within range.
OFF in all other cases.
Equals Flag P_EQ ON when the shift result is 0.
OFF in all other cases.
Carry Flag P_CY ON when 1 is shifted into the Carry Flag (CY).
OFF in all other cases.
Negative Flag P_N ON when the leftmost bit is 1 as a result of the shift.
OFF in all other cases.
D
a
a
D
CY
Los
t
N bits
Contents of “a” or
“0” shifted in
C0
8
111215
0347
D+1 D
CY
a
a
Shift n-bits
Lost
Contents of “a” or
“0” shifted in