Slide 16.5: ROL instruction
Slide 16.7: RCL and RCR instructions
Home

ROR Instruction


The ROR (rotate right) instruction shifts each bit to the right. Also, the lowest bit is copied both into the Carry flag and into the highest bit at the same time.

 ROR — Rotate Right 
Usage: ror dest, count


Flag O D I S Z A P C
Result *             *

Rotates the bits in the destination to the right “count” times with all data pushed out the right side re-entering on the left. The Carry flag will contain the value of the last bit rotated out.

Clocks
Operands 286 386 486 Size Bytes
reg, 1 2 3 3 2
mem, 1 7 7 4 2-4
reg, CL 5+n 3 3 2
mem, CL 8+n 7 4 2-4
reg, immed8 5+n 3 2 3
mem, immed8 8+n 7 4 3-5


 Rotate Carry Left 4 Bits   Restore Value   Rotate Carry Right 
 .data
 value  BYTE  84h
 .code
 clc
 rcl    value, 04
 movzx  eax, value
 call   WriteHex
 .data
 value BYTE 01101011b
 .code
 shl    value, 1
 rcr    value, 1
 movzx  eax, value
 call   WriteBin
 .code
 stc
 mov    ah, 10h
 rcr    ah, 1
 movzx  eax, ah
 call   WriteBin
 Output  Output  Output
  EAX =

 

  AL =

 

  AL =