- Related Questions & Answers
- 2’s compliment for a given string using XOR ?
- 1’s and 2’s complement of a Binary Number?
- 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
- 8085 program to find 2's complement of the contents of Flag Register
- 2's complement notation
- 2's complement fractions
- 8085 program to add 2-BCD numbers
- Sum of series 1^2 + 3^2 + 5^2 + . . . + (2*n – 1)^2
- 1's Complement vs 2's Complement
- 8085 Program to multiply two 2-digit BCD numbers
- C++ Program to Implement Booth’s Multiplication Algorithm for Multiplication of 2 signed Numbers
- Assessing compatibility of 27128-20 with 8085AH-2 in 8085 Microprocessor
- Java Program to Find sum of Series with n-th term as n^2 – (n-1)^2
- How to set up angular 2 for Eclipse?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Here we will see how to find 2’s complement with carry.

Write 8085 Assembly language program to find 2’s complement of a number stored in F100 with the carry, and store at F150 and F151.

In 8085, there is CMA instruction to complement a number. Then we can add 01 with it to make it 2’s complement. While adding 01 with it, the carry may generate. We will store it to F151, and the actual complemented value will be at F150.

Address | Data |
---|---|

… | … |

F100 | 08 |

… | … |

Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|

F000 | 3A, 00, F1 | | LDA F100H | get number from memory to A |

F003 | 2F | | CMA | get 1's complement |

F004 | C6, 01 | | ADI 01 | Increase it by 1 |

F006 | 6F | | MOV L,A | Store A into L |

F007 | 3E, 00 | | MVI A,00H | Clear Accumulator |

F009 | 8F | | ADC A | Add A + A + carry |

F00A | 67 | | MOV H,A | Load A into H |

F00B | 22, 50, F1 | | SHLD F150 | Store HL into memory |

F00E | 76 | | HLT | Terminate the program |

Address | Data |
---|---|

… | … |

F150 | F8 |

F151 | 00 |

… | … |

Advertisements