Count binary zeros in IA-32 assembly for signed integers

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 4K views
Cathartics
Messages
27
Reaction score
0
*****need help programing in assembly language*****

Hi there everyone. I am really new to this assembly language and i don't know how to code this simple programe.. Please help me with this. I would very much appreciate it.. here is the question..



Need to design assembly language programe IA-32 that could find the number of 0's [binary] in each integer in x and put and display the value in y.

.DATA

X SWORD -100,200,300,400,-500
Y BYTE 5 DUP (?)
 
Physics news on Phys.org
Bit oriented method:

Assume value in EAX, zero bit count will be in EDX

Code:
        mov     ecx,32
        mov     edx,0
lp0:    rol     eax,1
        cmc
        adc     edx,0
        loop    lp0
 
Last edited: