Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   help"""""'''""""" (http://www.go4expert.com/forums/help-t2153/)

bothie 6Dec2006 14:54

i need assistance on writing an 8085 assembly language code that will determine how many of the bits in two given data bytes are different

shabbir 6Dec2006 15:57

Re: help"""""'''"""""
bothie, you have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum. Please try to avoid it.

DaWei 6Dec2006 21:06

Re: help"""""'''"""""
I take it you're looking for a Hamming Distance or something. You can get a value with a zero in each bit that is different by using XOR. If you want to deal with ones, then invert it. You can count by setting up a loop and applying an AND mask for each bit, successively, or you can use shift/rotate and count when the carry flag is set after each shift/rotate. I haven't written 8085 assember in about 15 years, so I'm not posting actual code.

bothie 7Dec2006 14:09

Re: help"""""'''"""""
i think i got the one of using the rotate instruction and then counting the carry flag,but am a bit confused by the one of using the AND mask

DaWei 7Dec2006 18:25

Re: help"""""'''"""""
If you set b0 of the mask and AND it with the target, then you can tell if the target bit was set by the outcome. If it's set, increment your count. Move the bit in the mask to b1. Wash, rinse, repeat, until done.

All times are GMT +5.5. The time now is 02:05.