You are on page 1of 1

Microprocessor 8085

Appendix A

Explanation :

We have two digits available at the memory locations D000 H and D001 H in unpacked BCD form.
The digit at D000 H is the LSB, whereas digit at D001 H is MSB. To pack the two numbers,
means to combine the two numbers.
To make the digit at D001 H as MSB we rotate it 4 times to the left. i.e. if digit = 09 H, after rotating
it by a 4 times it becomes 90 H. Now add the two numbers. Result will be packed BCD. Store the
result.
e.g. : D001 H = 09 N
D000 H = 02 H
Result = 92 H

Algorithm :

Step I
: Load the most significant BCD digit in A.
Step II
: Rotate MSB 4 times to left.
Step III : Store the result of rotation in register C
Step IV : Load the least significant BCD digit in A.
Step V
: Add least significant BCD digit into ; rotated number.
Step VI : Store the result.
Step VII : Stop.
Flowchart : Refer flowchart 24.

Program :
Instruction
LDA D001H
RLC
RLC
RLC
RLC
MOV C, A
LDA D000H
ADD C
STA D002
HLT

Flowchart 24
Comment
; Get the Most significant BCD digit
; Rotate the BCD 4 times to left to make it MSB

; Store the partial result


; Get the lower BCD digit
; Add lower BCD digit
; Store the result
; Terminate program execution

You might also like