code_junkie

x86 question about bit comparisons

Nov 11th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. sub AX,AX
  2. sub SI,SI
  3. mov bx,[bp+6] ;get message offset
  4.  
  5. @@mainLoop:
  6. mov cx,8
  7. mov dh,80h
  8. cmp byte ptr [bx + si],0
  9. je @@endChecker
  10. @@innerLoop:
  11. test byte ptr [bx + si],dh
  12. jz @@zeroFound
  13. inc AX
  14. @@zeroFound:
  15. shr bh,1
  16. loop @@innerLoop
  17. @@continue:
  18. inc si
  19. jmp @@mainLoop
  20.  
  21. mov cx, 8
  22. mov dh, byte ptr [bx+si]
  23. @@innerLoop:
  24. add dh, dh
  25. adc ax, 0
  26. loop @@innerLoop
Add Comment
Please, Sign In to add comment