but store only the LSBĪdd %ax, %di # Now add the carry bit to the result Pop %ax # Put the least 16 bit of the flags into ax registerĪnd $01, %ax #. Shrl $1, %edx # Right shift edx so the LSB moves into the carry-flag Movl $255, %edx # Initialize edx to some valueĬmpl $32, %ecx # Loop runs over all 32 bits of the register # %edx stores the register whose digits are examined # %eax holds the carry flag bits and eventually the status code #OUTPUT: Returns the number of ones as a status code. Since this is basically my first ever, I would like to hear what I can improve or if there are some major flaws in this one: #PURPOSE: Simple program which counts the number of ones in the edx register and returns them as a status code I made a simple assembly program to count the number of ones in a register.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |