Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Notes  >  Program - 1s Complement of 8-bit Number - 8085

Program - 1s Complement of 8-bit Number - 8085 - Computer Science Engineering (CSE) PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


8085 Programs 
 
Gursharan Singh 
Maninder Kaur  Page 1 of 2 
Program 1: 1’s complement of an 8-bit number. 
 
Flowchart: 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Program: 
Address Mnemonics Operand Opcode Remarks 
2000 LDA 3000H 3A Load H-L pair with data from 3000H. 
2001   00 Lower-order of 3000H. 
2002   30 Higher-order of 3000H. 
2003 CMA  2F Complement accumulator. 
2004 STA 3001H 32 Store the result at memory location 3001H. 
2005   01 Lower-order of 3001H. 
2006   30 Higher-order of 3001H. 
2007 HLT  76 Halt. 
 
Explanation: 
? This program finds the 1’s complement of an 8-bit number stored in memory location 3000H. 
? Let us assume that the operand stored at memory location 3000H is 85H. 
? The operand is moved to accumulator from memory location 3000H. 
? Then, its complement is found by using CMA instruction. 
? The result is stored at memory location 3001H. 
 
Start 
Load accumulator with 
operand from memory. 
Complement accumulator. 
Store the result from 
accumulator to memory. 
Stop 
Page 2


8085 Programs 
 
Gursharan Singh 
Maninder Kaur  Page 1 of 2 
Program 1: 1’s complement of an 8-bit number. 
 
Flowchart: 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Program: 
Address Mnemonics Operand Opcode Remarks 
2000 LDA 3000H 3A Load H-L pair with data from 3000H. 
2001   00 Lower-order of 3000H. 
2002   30 Higher-order of 3000H. 
2003 CMA  2F Complement accumulator. 
2004 STA 3001H 32 Store the result at memory location 3001H. 
2005   01 Lower-order of 3001H. 
2006   30 Higher-order of 3001H. 
2007 HLT  76 Halt. 
 
Explanation: 
? This program finds the 1’s complement of an 8-bit number stored in memory location 3000H. 
? Let us assume that the operand stored at memory location 3000H is 85H. 
? The operand is moved to accumulator from memory location 3000H. 
? Then, its complement is found by using CMA instruction. 
? The result is stored at memory location 3001H. 
 
Start 
Load accumulator with 
operand from memory. 
Complement accumulator. 
Store the result from 
accumulator to memory. 
Stop 
8085 Programs 
 
Gursharan Singh 
Maninder Kaur  Page 2 of 2 
Output: 
Before Execution: 
3000H:  85H 
 
After Execution: 
3001H: 7AH 
 
 
Read More

FAQs on Program - 1s Complement of 8-bit Number - 8085 - Computer Science Engineering (CSE)

1. What is 1s complement of an 8-bit number?
Ans. The 1s complement of an 8-bit number is obtained by changing all 1s to 0s and 0s to 1s in the binary representation of the number.
2. How to find the 1s complement of an 8-bit number using 8085 assembly code?
Ans. To find the 1s complement of an 8-bit number using 8085 assembly code, we can use the instruction "CMA" which stands for "Complement Accumulator". This instruction complements all the bits in the accumulator.
3. What is the significance of 1s complement in computer arithmetic?
Ans. The 1s complement is used in computer arithmetic to represent negative numbers. The sign bit is the leftmost bit in the binary representation of a number. If the sign bit is 1, then the number is negative. To get the 1s complement of a negative number, we flip all the bits in the binary representation except the sign bit.
4. What is the difference between 1s complement and 2s complement?
Ans. The 1s complement and 2s complement are both used to represent negative numbers in computer arithmetic. The difference between them is that in 1s complement, the negative number is represented by flipping all the bits in the binary representation except the sign bit, whereas in 2s complement, the negative number is represented by taking the 1s complement and adding 1 to the result.
5. What are some applications of 1s complement in computer networking?
Ans. The 1s complement is used in computer networking for error detection and correction. In the Internet Protocol (IP) header, there is a field called "Checksum" which is used to ensure the integrity of the data being transmitted. The 1s complement is used to calculate the checksum value of the data. If there is an error in the data during transmission, the receiver can detect it by recalculating the checksum value using the 1s complement and comparing it with the received checksum value.
Download as PDF

Top Courses for Computer Science Engineering (CSE)

Related Searches

Objective type Questions

,

Free

,

Viva Questions

,

Exam

,

ppt

,

video lectures

,

Previous Year Questions with Solutions

,

past year papers

,

study material

,

shortcuts and tricks

,

Important questions

,

pdf

,

Semester Notes

,

mock tests for examination

,

Sample Paper

,

practice quizzes

,

Summary

,

Program - 1s Complement of 8-bit Number - 8085 - Computer Science Engineering (CSE)

,

Extra Questions

,

Program - 1s Complement of 8-bit Number - 8085 - Computer Science Engineering (CSE)

,

Program - 1s Complement of 8-bit Number - 8085 - Computer Science Engineering (CSE)

,

MCQs

;