Experiment-4: Write a program to find 1‘s complement of an 8 bit number.

Objective:

  • To understand the complement process
  • To write the algorithm for 1’s complement
  • To develop the assembly program
  • To analyze the program and interpret errors and result

Requirement:

  • Operating System – Windows, Linux
  • 8085 Simulator

Theory:

1’s complement of a number is found in the following ways:

    • By complementing each bit of the number

OR

    • By subtracting the number from all 1’s

Eg.

1’s complement of binary number 10101100 is 01010011

OR

1’s complement of binary number 10101100

  1 11 11 111

-10101100

——————

 01010011

Algorithm:

  • Input the number into the accumulator
  • Complement using instruction CMA, Result in accumulator
  • Save the result

Program:

Address OP-CODE Label Mnemonic Comments
  C9 05 042   JMP start  
4203 45H X:    
4204 00 Y    
4205   start: NOP  
4206 21,03,42   LXI H, X  
4209 7E   MOV A,M  
421A 2F   CMA  
421B 76   HLT  

Viva Questions

 

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!