The ROL instruction
Rotate a register or a memory location left.
The ROL instruction format
| Instruction | Description |
|---|---|
| ROL reg/mem8, 1 | Rotate 8 bits of reg/mem8 left once. |
| ROL reg/mem8, CL | Rotate 8 bits of reg/mem8 left CL times. |
| ROL reg/mem16, 1 | Rotate 16 bits of reg/mem16 left once. |
| ROL reg/mem16, CL | Rotate 16 bits of reg/mem16 left CL times. |
Rotates the contents of the specified register or memory location left by the specified number of bits. The number of bits rotated, represented by the variable count, is either one or the number contained in the cl.
If the masked value is 0, the flags are not affected. If the masked count is 1, the OF flag is affected; otherwise (the masked count is greater than 1) the OF flag is undefined.
Usage example
title .model small .stack 100h code segment public ; Start of the code segment assume cs:code main proc ; Start of the main procedure mov ax, 00010001b ; Copy the value 11h into the ax register rol ax, 1 ; Rotate the ax register left by 1 rol ax, 1 ; Rotate the ax register left by 1 rol ax, 1 ; Rotate the ax register left by 1 mov ax, 00010001b ; Copy the value 11h into the ax register mov cl, 3 ; Copy the value 3 into the cl register rol ax, cl ; Rotate the ax register left by the count in cl mov ax, 4C00h ; Copy the process termination function number into ah and the value into al int 21h ; Call the interrupt main endp ; End of the main procedure code ends ; End of the code segment end main ; End of file. The main procedure is the entry point
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Processor status flags
CF
YesPF
NoAF
NoZF
NoSF
NoTF
NoIF
NoDF
NoOF
?