Home  Site Map  Instruction Index 

ROR  -  Roll Right Instruction


The ROR instruction is used to rotate the bits to the right.

As each bit is rotated it passes in to the Carry flag, where it can be assessed using a conditional jump JC or JNC.

As each bit moves off the highest bit it is inserted in the lowest bit.

This command has 3 part the Instruction, a Register or memory address, and the number of bits to rotate right.


Assembly
Sample
Description 16 bit Machine
  Code
ROR AL, 1;  Rotate AL right by 1 bit   D0 C8
ROR AL, CL;  Rotate AL right by value of CL   D2 C8
ROR AL, 0x03 ;  Rotate AL right by 8 bit immediate   C0 C8 03
ROR AX, 1;  Rotate AX right by 1 bit   D1 C8
ROR AX, CL ;  Rotate AX right by value of CL   D3 C8
ROR AX, 0x03 ;  Rotate AX right by 8 bit immediate   C1 C8 03
ROR [BX], 1;  Rotate memory address right by 1 bit   D0 0F
ROR [BX], CL;  Rotate memory address right by value of CL   D2 0F
ROR [BX], 0x03 ;  Rotate memory address right by 8 bit
;  immediate
  C0 0F 03
ROR [BX+2], 1;  Rotate memory address right by 1 bit   D0 4F 02
ROR [BX+2], CL ;  Rotate memory address right by value of CL   D2 4F 02
ROR [BX+2], 0x03 ;  Rotate memory address right by 8 bit
;  immediate
  C0 4F 02 03