Home  Site Map  Instruction Index 

RCR  -  Roll Right Instruction


The RCR 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
RCR AL, 1;  Rotate AL right by 1 bit   D0 D8
RCR AL, CL;  Rotate AL right by value of CL   D2 D8
RCR AL, 0x03 ;  Rotate AL right by 8 bit immediate   C0 D8 03
RCR AX, 1;  Rotate AX right by 1 bit   D1 D8
RCR AX, CL ;  Rotate AX right by value of CL   D3 D8
RCR AX, 0x03 ;  Rotate AX right by 8 bit immediate   C1 D8 03
RCR [BX], 1;  Rotate memory address right by 1 bit   D0 1F
RCR [BX], CL;  Rotate memory address right by value of CL   D2 1F
RCR [BX], 0x03 ;  Rotate memory address right by 8 bit
;  immediate
  C0 1F 03
RCR [BX+2], 1;  Rotate memory address right by 1 bit   D1 5F 02
RCR [BX+2], CL ;  Rotate memory address right by value of CL   D2 5F 02
RCR [BX+2], 0x03 ;  Rotate memory address right by 8 bit
;  immediate
  C0 5F 02 03