Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
BSF/BSR Instruction
 Detail Key                               Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
  Title:    Bit Scan                              Flags: O D I T S Z A P C
            80386/486 Only                               ═════════════════
                                                                   ±
  Syntax:   BSF dest,src
            BSR dest,src
 
  See also: .386
 
  Description:
 
     Scans an operand to find the first set bit. If a set bit is found,
     the zero flag is cleared and the destination operand is loaded
     with the bit index of the first set bit encountered. If no set bit is
     found, the zero flag is set.
 
     BSF (Bit Scan Forward) scans from bit 0 to the most significant
     bit. BSR (Bit Scan Reverse) scans from the most significant bit of
     an operand to bit 0.
                                    -♦-