ROL              Rotate Left                         Flags: O D I T S Z A P C
                                                            *               *
ROL destination,count
 
                      +----+    +-------------+
                      | CF |-+-+-Destination |-+
                      +----+  | +-------------+  |
                              +-----------------+
 
    ROL shifts the word or byte at the destination to the left by the
    number of bit positions specified in the second operand, COUNT. As
    bits are transferred out the left (high-order) end of the destination,
    they re-enter on the right (low-order) end. The Carry Flag is updated
    to match the last bit shifted out of the left end.
 
    If COUNT is not equal to 1, the Overflow flag is undefined. If COUNT
    is equal to 1, then the Overflow Flag is set to the XOR of the top 2
    bits of the original operand.
 
  --------------------------------------------------------------------------
   Operands                  Clocks   Transfers  Bytes   Example
                           byte(word)
   register, 1                 2          -        2     ROL DI,1
   register, CL            8 + 4/bit      -        2     ROL BX,CL
   memory, 1              15(23) + EA     2       2-4    ROL BYTE,1
   memory, CL           20(28)+EA+4/bit   2       2-4    ROL WORD,CL
  --------------------------------------------------------------------------
 
       Notes:         COUNT is normally taken as the value in CL. If,
                      however, you wish to rotate only one position,
                      replace the second operand, CL, with the value 1, as
                      shown in the first example above.
 
                      The 80286 and 80386 microprocessors limit the COUNT
                      value to 31.  If COUNT is greater than 31, these
                      microprocessors will use COUNT MOD 32 to produce a
                      new COUNT between 0 and 31.  This upper boundary
                      exists to limit the amount of time that an interrupt
                      response will be delayed waiting for the instruction
                      to complete.
 
                      Multiple ROLs that use 1 as the COUNT may be faster
                      and require less memory than a single ROL that uses
                      CL for COUNT.
 
                      The overflow flag is undefined when the rotate count
                      is greater than 1.

Seealso:



This page last updated on Fri Nov 30 10:49:50 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster