assembly
mov dl,5
shl dl,1 ; DL = 10
assembly
mov dl,5
shl dl,2 ; DL = 20
assembly
mov dl,80
shr dl,1 ; DL = 40
shr dl,2 ; DL = 10
assembly
mov dl,-80
sar dl,1 ; DL = -40
sar dl,2 ; DL = -10
assembly
mov al,11110000b
rol al,1 ; AL = 11100001b
mov dl,3Fh
rol dl,4 ; DL = F3h
assembly
mov al,11110000b
ror al,1 ; AL = 01111000b
mov dl,3Fh
ror dl,4 ; DL = F3h
assembly
clc ; CF = 0
mov bl,88h ; CF,BL = 0 10001000b
rcl bl,1 ; CF,BL = 1 00010000b
rcl bl,1 ; CF,BL = 0 00100001b
assembly
stc ; CF = 1
mov ah,10h ; CF,AH = 1 00010000b
rcr ah,1 ; CF,AH = 0 10001000b
assembly
mov al,11100000b
mov bl,10011101b
shld al,bl,1
assembly
mov al,11000001b
mov bl,00011101b
shrd al,bl,1
Shifting Multiple Doublewords
assembly
.data
ArraySize = 3
array DWORD ArraySize DUP(99999999h) ; 1001 1001...
.code
mov esi,0
shr array[esi + 8],1 ; high dword
rcr array[esi + 4],1 ; middle dword, include Carry
rcr array[esi],1 ; low dword, include Carry
Binary Multiplication
assembly
mov eax,123
mov ebx,eax
shl eax,5 ; mult by 2^5
shl ebx,2 ; mult by 2^2
add eax,ebx
Displaying Binary Bits