RCL rotates left through the carry flag. The operand and CF together form a ring of 9 bits (for a byte) or 17 bits (for a word). Each step, every bit moves one place left, the old CF enters bit 0, and the old top bit becomes the new CF.
+-- CF <- b7 b6 b5 b4 b3 b2 b1 b0 <-+| |+------------------------------------+CF=1 0100 0000RCL 1 CF=0 1000 0001
Forms and flags
Register or memory operand; count 1 or CL on the 8086. Only CF and OF change; SF, ZF, PF and AF keep their values. With a count of 1, OF is set when the new CF and the new top bit differ. For other counts OF is undefined. Because the old CF goes into the value, set it on purpose first: CLC for a 0, STC for a 1.
Multi-word shifts
This is what RCL is for. To shift a value wider than one register left by one bit, shift the lowest part with SHL, then RCL each higher part: the bit leaving one part travels through CF into the next. For a 32-bit number in DX:AX:
SHL AX, 1 ; low word: top bit into CFRCL DX, 1 ; high word: CF into bit 0
Repeat the pair to shift further; a CL count does not work here, because the carry must pass between the words after every single bit. The same pattern collects bits one at a time: anything that leaves a result in CF (a compare, a shift of another register) can be followed by RCL BL, 1 to add that bit at the bottom of BL.
MOV BH, 01h ; high byte 0000 0001MOV BL, 0C3h ; low byte 1100 0011SHL BL, 1 ; low byte first: bit 7 -> CFRCL BH, 1 ; CF enters the high byteMOV AL, BHCALL SHOWBIN ; 0000 0011MOV AL, BLCALL SHOWBIN ; 1000 0110SHOWBIN PROC NEAR ; print AL as 8 binary digits and a spacePUSHF ; keep the caller's flagsPUSH AXPUSH BXPUSH CXPUSH DXMOV BL, ALMOV CX, 8NEXTBIT:SHL BL, 1 ; the top bit falls into CFMOV DL, "0"ADC DL, 0 ; "0" + CF = "0" or "1"MOV AH, 02hINT 21hLOOP NEXTBITMOV DL, " "MOV AH, 02hINT 21hPOP DXPOP CXPOP BXPOP AXPOPFRETSHOWBIN ENDP
Later CPUs
The 8086 takes the whole of CL as the count. The 80186 and later mask it to 5 bits and accept an immediate count, as in RCL AX, 2.