RCR rotates right through the carry flag. The operand and CF form a ring of 9 bits (byte) or 17 bits (word). Each step, every bit moves one place right, the old CF enters the top bit, and the old bit 0 becomes the new CF.

+-> CF -> b7 b6 b5 b4 b3 b2 b1 b0 --+
| |
+------------------------------------+
CF=1 0000 0010
RCR 1 CF=0 1000 0001

Forms and flags

Register or memory operand; count 1 or CL on the 8086. Only CF and OF are changed; SF, ZF, PF and AF are left as they were. With a count of 1, OF is set when the two highest bits of the result differ (the old CF and the old top bit were different). For other counts OF is undefined. Clear or set CF first (CLC, STC) if the bit coming in matters.

Multi-word shifts

To shift a wide value right by one bit, start at the highest part and work down: shift the top part, then RCR each lower part so the bit leaving one part enters the top of the next. For an unsigned 32-bit number in DX:AX, which divides it by 2:

SHR DX, 1 ; high word: bit 0 into CF
RCR AX, 1 ; low word: CF into bit 15
; signed value: use SAR DX, 1 instead of SHR

After the pair, CF holds the bit that dropped off the whole value, the remainder of the division. Left shifts go the other way round: SHL on the lowest part, then RCL upward.

RCR is also a way to put CF into the top bit of a register: STC then RCR AL, 1 sets bit 7 and moves the rest down.

BH:BL halved as one 16-bit value. Prints 00000001 10000100 CF=0
MOV BH, 03h ; high byte 0000 0011
MOV BL, 08h ; low byte 0000 1000: 0308h = 776
SHR BH, 1 ; high byte first: bit 0 -> CF
RCR BL, 1 ; CF enters bit 7 of the low byte
MOV AL, BH
CALL SHOWBIN ; 0000 0001
MOV AL, BL
CALL SHOWBIN ; 1000 0100: 0184h = 388
CALL SHOWCF ; nothing left over
SHOWBIN PROC NEAR ; print AL as 8 binary digits and a space
PUSHF ; keep the caller's flags
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV BL, AL
MOV CX, 8
NEXTBIT:
SHL BL, 1 ; the top bit falls into CF
MOV DL, "0"
ADC DL, 0 ; "0" + CF = "0" or "1"
MOV AH, 02h
INT 21h
LOOP NEXTBIT
MOV DL, " "
MOV AH, 02h
INT 21h
POP DX
POP CX
POP BX
POP AX
POPF
RET
SHOWBIN ENDP
SHOWCF PROC NEAR ; print "CF=0" or "CF=1" and a space
PUSHF
PUSH AX
PUSH DX
MOV DL, "0"
ADC DL, 0 ; "0" + CF, before anything changes CF
PUSH DX
MOV AH, 09h
MOV DX, OFFSET CFTXT
INT 21h
POP DX
MOV AH, 02h
INT 21h
MOV DL, " "
MOV AH, 02h
INT 21h
POP DX
POP AX
POPF
RET
SHOWCF ENDP
CFTXT DB "CF=$"

Later CPUs

The 8086 uses all 8 bits of CL as the count. The 80186 and later mask the count to 5 bits and accept an immediate count, as in RCR AX, 2.