home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / MISC1.ASM < prev    next >
Assembly Source File  |  1994-11-24  |  672b  |  27 lines

  1.     PAGE    66,132
  2. ;******************************** MISC1.ASM  *********************************
  3. LIBSEG           segment byte public "LIB"
  4.         assume cs:LIBSEG , ds:nothing
  5. ;----------------------------------------------------------------------------
  6.  
  7.  
  8. comment 
  9. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  MISC   )
  10. ; bit_count - count the number of bits in -al-
  11. ;  inputs:  al = input value
  12. ;  output:  ah = count of number of bits set in -al-
  13. ;           
  14. ;* * * * * * * * * * * * * *
  15. 
  16.     public    bit_count
  17. bit_count    proc    far
  18.         xor    ah,ah
  19. bit_loop:    rol    al,1
  20.         adc    ah,20h
  21.         jnc    bit_loop
  22.         retf
  23. bit_count    endp
  24.  
  25. LIBSEG    ENDS
  26.     end
  27.