Home  Site Map  Instruction Index 

ROL  -  Roll Left Instruction


The ROL instruction is used to rotate the bits to the left.

As each bit is rotated it passes in to the Carry flag, where it can be assessed using a conditional jump JC or JNC.

As each bit moves off the highest bit it is inserted in the lowest bit.

This command has 3 part the Instruction, a Register or memory address, and the number of bits to rotate left.


Assembly
Sample
Description   16 bit Machine
  Code
ROL AL, 1;  Rotate AL left by 1 bit   D0 C0
ROL AL, CL;  Rotate AL left by value of CL   D2 C0
ROL AL, 0x03 ;  Rotate AL left by 8 bit immediate   C0 C0 03
ROL AX, 1;  Rotate AX left by 1 bit   D1 C0
ROL AX, CL ;  Rotate AX left by value of CL   D3 C0
ROL AX, 0x03 ;  Rotate AX left by 8 bit immediate   C1 C0 03
ROL [BX], 1;  Rotate memory address left by 1 bit   D0 07
ROL [BX], CL;  Rotate memory address left by value of CL   D2 07
ROL [BX], 0x03 ;  Rotate memory address left by 8 bit
;  immediate
  C0 07 03
ROL [BX+2], 1;  Rotate memory address left by 1 bit   D0 47 02
ROL [BX+2], CL ;  Rotate memory address left by value of CL   D2 47 02
ROL [BX+2], 0x03 ;  Rotate memory address left by 8 bit
;  immediate
  C0 47 02 03