2s Complement of a Numbers Assembly Code

Posted on

2s Complement of a Numbers Assembly Program

2s Complement of a Numbers Algorithm

Step I          :    Initialize the data memory.

Step II        :    Load the number in AX.

Step III       :    Initialize counter = 16 in CX.

Step IV       :    Rotate number by 1 bit position to left with carry.

Step V         :    Complement carry.

Step VI       :    Decrement count.

Step VII     :    Check if count = 0. If not goto step IV

Step VIII    :    Rotate once again by 1 bit to restore original carry back.

Step IX       :    2’s complement = 1’s complement in AX + 1

Step X        :    Display result.

Step XI       :    Stop.

    

2s Complement of a Numbers Assembly Code

 

Source projectgeek.com