Statement: Pack the two unpacked BCD numbers stored in memory locations 2000H and 2001H and store the result in memory location 2002H. The least significant digit is stored at 2000H.
Example:
(2000H) = 04H
(2001H) = 09H
Result = (2002H) = 94H
Program:
LDA 2001H ; Obtain the most significant BCD digit
RLC ; Rotate left
RLC ; Rotate left
RLC ; Rotate left
RLC ; Rotate left
ANI F0H ; Make least significant BCD digit zero
MOV C, A ; Move the contents of accumulator into C register
LDA 2000H ; Obtain the least significant BCD digit
ADD C ; Add lower BCD digit
STA 2002H ; Store the result in 2002H
HLT ; Terminate program execution
Comments
Post a Comment