The SHR instruction

Logical shift of a register or a memory location right.

The SHR instruction format

InstructionDescription
SHR reg/mem8, 1Unsigned division of reg/mem8 by 2, once.
SHR reg/mem8, CLUnsigned division of reg/mem8 by 2, CL times.
SHR reg/mem16, 1Unsigned division of reg/mem16 by 2, once.
SHR reg/mem16, CLUnsigned division of reg/mem16 by 2, CL times.

Shifts the bits in the first operand (the destination operand) right by the number of bits specified in the second operand. Bits shifted beyond the boundary of the destination operand are first shifted into the CF flag and then discarded. At the end of the shift operation the CF flag contains the last bit shifted out of the destination operand.

Usage example

title Author: Evgeny Sergeevich Dovgopolov

.model small
.stack 100h

code segment public            ; Start of the code segment
    assume cs:code

    main proc                  ; Start of the main procedure
        mov     al, 0011100b  ; Copy the value 00111100 into the al register
        mov     cl, 2          ; Copy the value 2 into the cl register
        shr     al, cl         ; Perform a logical shift of al right by 2, 00001111

        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
Yes
PF
Yes
AF
?
ZF
Yes
SF
Yes
TF
No
IF
No
DF
No
OF
?