1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

help"""""'''"""""

Discussion in 'Assembly Language Programming (ALP) Forum' started by bothie, Dec 6, 2006.

  1. bothie

    bothie New Member

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

    shabbir Administrator Staff Member

  3. DaWei

    DaWei New Member

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

    bothie New Member

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

    DaWei New Member

    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.
     

Share This Page