0% found this document useful (0 votes)
25 views

Microprocessor 8085 Appendix A

This document describes how to unpack a binary coded decimal (BCD) number stored in memory location D000H into its individual digit components. It involves masking the lower and upper nibbles of the packed BCD number to extract the most and least significant digits, respectively, and rotating the lower nibble right four times to position the most significant digit as the least significant digit. The algorithm and program are presented to perform these steps and store the unpacked digits in memory locations D001H and D002H.

Uploaded by

manpreet kaur
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Microprocessor 8085 Appendix A

This document describes how to unpack a binary coded decimal (BCD) number stored in memory location D000H into its individual digit components. It involves masking the lower and upper nibbles of the packed BCD number to extract the most and least significant digits, respectively, and rotating the lower nibble right four times to position the most significant digit as the least significant digit. The algorithm and program are presented to perform these steps and store the unpacked digits in memory locations D001H and D002H.

Uploaded by

manpreet kaur
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Microprocessor 8085

Appendix A

Explanation :

A digit BCD number is available at memory location D000 H. We have to unpack this BCD number
i.e. we have to separate the BCD digits. e.g. : If the number = 92 H then in unpack form the two
digits will 02 H and 09 H.
We have to mask the lower nibble, first and rotate four times to the right to get the MSB digit.
Then to get the LSB digit mask the upper nibble.
Store the result.
Masking lower nibble means ANDing the number
with 0F0 to get MSB.

Algorithm :

Step I
: Load unpacked number into register A.
Step II
: Mask the lower nibble.
Step III : Rotate 4 times right to make MSB digit = LSB.
Step IV : Store the digit at memory location D001 H.
Step V
: Load number in A.
Step VI : Mask upper nibble.
Step VII : Store the result at memory location D002 H.
Step VIII : Stop.
Flowchart : Refer flowchart 25.

Program :

Instruction

Comment

LDA D000H

; Get the packed BCD number in register A

ANI 0F0H

; Mask lower nibble

RRC

; Make MSB BCD digit = LSB digit

RRC
RRC
RRC
STA D001H
LDA D000H
ANI 0FH
STA D002H
HLT

Flowchart 25

;
;
;
;
;

Store the partial result


Get the original BCD number in register A
Mask higher nibble
Store the result
Terminate program execution

You might also like