<<< RET Return from Procedure     Index     ROR Rotate Right >>>


ROL Rotate Left

Flags affected:

        O D I T S Z A P C  OF: Overflow flag  TF: Trap flag AF: Aux carry
        F F F F F F F F F  DF: Direction flag SF: Sign flag PF: Parity flag
        *               *  IF: Interrupt flag ZF: Zero flag CF: Carry flag

Legal forms:

        ROL r8,1
        ROL m8,1
        ROL r16,1
        ROL m16,1
        ROL r32,1    386+
        ROL m32,1    386+
        ROL r8,CL
        ROL m8,CL
        ROL r16,CL
        ROL m16,CL
        ROL r32,CL   386+
        ROL m32,CL   386+
        ROL r8,i8    286+
        ROL m8,i8    286+
        ROL r16,i8   286+
        ROL m16,i8   286+
        ROL r32,i8   386+
        ROL m32,i8   386+

Examples:

        ROL AL,1
        ROL WORD [BX+SI],CL
        ROL BP,1
        ROL DWORD [EBX+ESI],9
        ROL BP,CL

Notes:

ROL rotates the bits within the destination operand to the left, where left is toward the most significant bit (MSB). A rotate is a shift (see SHL and SHR) that wraps around; the leftmost bit of the operand is shifted into the rightmost bit, and all intermediate bits are shifted one bit to the left. Except for the direction the shift operation takes, ROL is identical to ROR.

The number of bit positions shifted may be specified either as an 8-bit immediate value, or by the value in CL-not CX or ECX. (The 8086 and 8088 are limited to the immediate value 1.) Note that while CL may accept a value up to 255, it is meaningless to shift by any value larger than 16, even though the shifts are actually performed on the 8086 and 8088. (The 286 and later limit the number of shift operations performed to the native word size except when running in Virtual 86 mode.)

The leftmost bit is copied into the Carry flag on each shift operation. OF is modified only by the shift-by-one forms of ROL; after shift-by-CL forms, OF becomes undefined.

        r8 = AL AH BL BH CL CH DL DH        r16 = AX BX CX DX BP SP SI DI
        sr = CS DS SS ES FS GS              r32 = EAX EBX ECX EDX EBP ESP ESI EDI
        m8 = 8-bit memory data              m16 = 16-bit memory data
        m32 = 32-bit memory data            i8 = 8-bit immediate data
        i16 = 16-bit immediate data         i32 = 32-bit immediate data
        d8 = 8-bit signed displacement      d16 = 16-bit signed displacement
        d32 = 32-bit unsigned displacement


<<< RET Return from Procedure     Index     ROR Rotate Right >>>