In this program, we are going to write an assembly language program to Find the 1’s complement of a Number in 8085 microprocessor with a program flow chart and explanation of the program.
1’s complement of a Number in 8085
Find the 1’s complement of the number stored at memory location C200H and store the complemented number at memory location C300H.
Explanation of Program
- 1’s complement of a number means to invert each bit of that number. So our task is to complement each bit of the number.
- We will first load the number in the accumulator whose 1’s complement is to be found.
- Then using CMA instruction we will complement the accumulator. This is 1’s complement of the number.
- Store the result at memory location C300H.
- Let A = AAH
- i.e. A: 10101010
- 1’s complement of A: 01010101
- Thus, 1’s complement of A is 55H.
Assembly Language Program
|LDA C200H||Load the number in the accumulator from the C200H memory address.||A = AA H|
|CMA||Complement the number||A = 55 H|
|STA C300H||Store the 1’s complement of the number at memory location C300H.||C300H = H|
|HLT||Terminate program execution||Stop|