- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
8085 program to find 1's and 2's complement of 8-bit number
In this program we will see how to find 1's complement and 2's complement of an 8-bit number.
Problem Statement
Write 8085 Assembly language program to find 1's complement and 2's complement of a number stored in 8000H.
Discussion
8085 has an instruction CMA. This instruction complements the content of Accumulator. For 1's complement CMA instruction is sufficient, and for 2's complement we have to increase the number by 1 after complementing.
We are taking the number from 8000H and storing the 1's complement at location 8050H, and 2's complement to 8051H.
Input
Address | Data |
---|---|
. . . | . . . |
8000 | AB |
. . . | . . . |
Flow Diagram
Program
Address | HEX Codes | Mnemonics | Comments |
---|---|---|---|
F000 | 3A, 00, 80 | LDA 8000H | Load the number from memory |
F003 | 2F | CMA | Complement the accumulator |
F004 | 32, 50, 80 | STA 8050H | Store the 1's complemented result |
F007 | 3C | INR A | Increase A by 1 |
F008 | 32, 51, 80 | STA 8051H | Store the 2's complemented result |
F00B | 76 | HLT | Terminate the program |
Output
Address | Data |
---|---|
. . . | . . . |
8050 | 54 |
8051 | 55 |
. . . | . . . |
- Related Articles
- 8085 program to find 1's and 2's complement of 16-bit number
- 1's Complement vs 2's Complement
- 8085 program to find 2's complement of the contents of Flag Register
- 1's complement notation
- 2's complement notation
- 2's complement fractions
- 1’s and 2’s complement of a Binary Number?
- Design a Moore machine to generate 1's complement of a binary number.
- Programmer's view of 8085 Microprocessor
- C++ Largest Subtree having Equal No of 1's and 0's
- Program to find minimum number of characters to be deleted to make A's before B's in Python
- Find the index of first 1 in a sorted array of 0's and 1's in C++
- Python program using map function to find row with maximum number of 1's
- 8085 program to find square of a 8 bit number
- C# Program to Count the Number of 1's in the Entered Numbers

Advertisements