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
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.
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.
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
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.