Microprocessor 8085
Appendix A
Explanation :
Ones complement of number means to invert each bit of that number. So our task is to complement
each bit of number.
We will first load the number whose 1s complement is to be found in
the accumulator.
Using the CMA instruction we will complement the accumulator.
This is 1s complement of the number.
Store the result at memory location C100 H.
Algorithm :
Step I : Get the number
Step II : Complement the number
Step III : Store the result.
Flowchart : Refer flowchart 9
Program :
Instruction
LDA C200H
CMA
STA C100H
HLT
Operation
Comments
; C200 A ; Get the number
; A; Complement number
;
; Store the result
; Stop
; Terminate program execution
Flowchart 9