SHR Instruction


The SHR (shift right) instruction performs a logical right shift on the destination operand, replacing the highest bit with 0. The lowest bit is copied into the Carry flag, and the bit that was in the Carry flag is lost.

 SHR — Shift Logical Right 
Usage: shr dest, count


Flag O D I S Z A P C
Result *     * * ? * *

Shifts the destination right by “count” bits with zeroes shifted in on the left. The Carry flag contains the last bit shifted out.

Clocks
Operands 286 386 486 Size Bytes
reg, 1 2 3 3 2
mem, 1 7 7 4 2-4
reg, CL 5+n 3 3 2
mem, CL 8+n 7 4 2-4
reg, immed8 5+n 3 2 3
mem, immed8 8+n 7 4 3-5

 Shift Positive Right   Shift Negative Right   Shift Arithmetic Right 
 .data
 value  SDWORD  32
 .code
 shr    value, 03
 mov    eax, value 
 call   WriteInt
 .data
 value  SDWORD  -32
 .code
 shr    value, 03
 mov    eax, value
 call   WriteInt
 .data
 value  SDWORD  -32
 .code
 sar    value, 03
 mov    eax, value
 call   WriteInt
 Output  Output  Output
  EAX =

 

  EAX =

 

  EAX =