ROL
Instruction
ROL
(rotate left) instruction shifts each bit to the left. Also, the highest bit is copied both into the Carry
flag and into the lowest bit. Bit rotation differs from bit shifting in that the former does not lose any bits. A bit that is rotated off one end of a number appears again at the other end.
ROL — Rotate Left |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ROL
can be used to exchange the upper (bits 4–7) and lower (bits 0–3) halves of a byte.
Rotate Left 4 Bits | Rotate Right 4 Bits | Rotate Carry Left 4 Bits |
.data value BYTE 84h .code rol value, 04 movzx eax, value call WriteHex |
.data value BYTE 84h .code ror value, 04 movzx eax, value call WriteInt |
.data value BYTE 84h .code stc rcl value, 04 movzx eax, value call WriteHex |
Output | Output | Output |