rol - rotate left

dest = dest @<< source      ; made up notation for rotate

The rol instruction rotates the destination left the number of times indicated by the source. Rotating left by is like shifting left, but the bits shifted out the left end are entered onto the right end. The destination can be a 64, 32, 16 or 8 bit register or memory location. The source can be either an immediate value or the cl register.

There is also a rcl instruction which adds the carry flag as an additional bit in the rotation.

Here is an example of a rotate left:

     1010010010101011
               @<<  3
     ----------------
     0010010101011101

Some examples of using rol:

        rol     rax, 15         ; rotate rax 15 bits
        rol     eax, 10         ; rotate eax 10 bits
                                ; fills upper half of rax with 0
        rol     dx, cl          ; rotate dx the cl bits left
                                ; leaves the rest of rdx alone
        rol     [x], 2          ; rotate 32 bit variable x 2 bits

flags: OF CF

CF contains the last bit shifted out. OF is changed only for single bit shifts.