Statement: Unpack the two digit BCD number which is stored in memory location 2000H and store the two digits in memory locations 2001H and 2002H such that the lower BCD digit is stored in memory location 2001H.
Example:
(2000H) = 94H
Result = (2001H) = 04H and (2002H) = 09H
Program:
LDA 2000H ; Obtain the packed BCD number
RRC ; Rotate right
RRC ; Rotate right
RRC ; Rotate right
RRC ; Rotate right
STA 2002H ; Store the partial result
LDA 2000H ; Obtain the packed BCD number
ANI 0FH ; Mask higher nibble
STA 2001H ; Store the result in 2001H
HLT ; Terminate program execution
Comments
Post a Comment