Skip to content
Related Articles

Related Articles

Improve Article

Interface 8255 with 8085 microprocessor for 1’s and 2’s complement of a number

  • Last Updated : 03 Oct, 2018

Problem – Interface 8255 with 8085 microprocessor and write an assembly language program to display 99 in Port A, 1’s complement of 99 in Port B, and 2’s complement of 99 in Port C. If Port addresses are 30H, 32H, and 33H resp.

Example –

D7D6D5D4D3D2D1D0
10000000

Algorithm –



  1. Construct the control word register.
  2. Input value of accumulator A.
  3. Display value of A in Port A.
  4. Now 1’s complement of A is calculated and result is displayed in Port B.
  5. Now 2’s complement of A is calculated by adding 1 to 1’s complement of A. The result is displayed in Port C.

Program –

MnemonicsComments
MVI A, 80A<–80
OUT 33Control Register<–A
MVI A, 99A<–99
OUT 30Port A<–A
CMA1’s complement of A
OUT 31Port B<–A
INR AA<–A+1
OUT 32Port C<–A
RETReturn

Explanation –

  1. .MVI A, 80: Value of control register is 80.
  2. OUT 33: Putting the value of A in 33H which is port number of port control register.
  3. .MVI A, 99: Value of A is equals to 99.
  4. OUT 30: Displaying the value of A in 30H which is port number of Port A.
  5. CMA: Calculates 1’s complement of A.
  6. OUT 31: Displaying 1’s complement of A in 31H which is port number of Port B.
  7. INR A: 1’s complement of A is incremented by 1 i.e. 2’s complement of A is calculated.
  8. OUT 32: Displaying 2’s complement of A in 32 H which is port number of Port C.
  9. RET: Return.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :