**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 –**

D7 |
D6 |
D5 |
D4 |
D3 |
D2 |
D1 |
D0 |

1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |

**Algorithm –**

- Construct the control word register.
- Input value of accumulator A.
- Display value of A in Port A.
- Now 1’s complement of A is calculated and result is displayed in Port B.
- 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 –**

Mnemonics |
Comments |
---|---|

MVI A, 80 | A<–80 |

OUT 33 | Control Register<–A |

MVI A, 99 | A<–99 |

OUT 30 | Port A<–A |

CMA | 1’s complement of A |

OUT 31 | Port B<–A |

INR A | A<–A+1 |

OUT 32 | Port C<–A |

RET | Return |

**Explanation –**

**.MVI A, 80:**Value of control register is 80.**OUT 33:**Putting the value of A in 33H which is port number of port control register.**.MVI A, 99:**Value of A is equals to 99.**OUT 30:**Displaying the value of A in 30H which is port number of Port A.**CMA:**Calculates 1’s complement of A.**OUT 31:**Displaying 1’s complement of A in 31H which is port number of Port B.**INR A:**1’s complement of A is incremented by 1 i.e. 2’s complement of A is calculated.**OUT 32**: Displaying 2’s complement of A in 32 H which is port number of Port C.**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.

## Recommended Posts:

- Interface 8255 with 8085 microprocessor for addition
- Subtract content of two ports by interfacing 8255 with 8085 microprocessor
- Microprocessor | 8255 (programmable peripheral interface)
- 8255 microprocessor operating modes
- Interface 8254 PIT with 8085 microprocessor
- Programmable peripheral interface 8255
- What’s difference between 1's Complement and 2's Complement?
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to find 1’s and 2’s complement of 16-bit number
- Differences between 8085 and 8086 microprocessor
- Difference between SIM and RIM instructions in 8085 microprocessor
- Difference between 8080 and 8085 Microprocessor
- 8085 program to find 2's complement of the contents of Flag Register
- Interrupts in 8085 microprocessor
- Registers of 8085 microprocessor
- Flag register in 8085 microprocessor
- Arithmetic instructions in 8085 microprocessor
- Logical instructions in 8085 microprocessor
- Data transfer instructions in 8085 microprocessor
- Branching instructions in 8085 microprocessor

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.