Pack the unpacked BCD NUMBERS
Statement : Pack the two unpacked BCD numbers stored in memory locations 4200H and 4201H and store result in memory location 4300H. Assume the least significant digit is stored at 4200H.
Sample problem:
(4200H) = 04
(4201H) = 09
Result = (4300H) = 94
Source program:
LDA 4201H : “Get the most significant BCD digit”
RLC
RLC
RLC
RLC : “Adjust the position of the second digit (09 is changed to 90)”
ANI FOH : “Make least significant BCD digit zero”
MOV C, A : “Store the partial result”
LDA 4200H : “Get the lower BCD digit”
ADD C : “Add lower BCD digit”
STA 4300H : “Store the result”
HLT : “Terminate program execution”
Sample problem:
(4200H) = 04
(4201H) = 09
Result = (4300H) = 94
Source program:
LDA 4201H : “Get the most significant BCD digit”
RLC
RLC
RLC
RLC : “Adjust the position of the second digit (09 is changed to 90)”
ANI FOH : “Make least significant BCD digit zero”
MOV C, A : “Store the partial result”
LDA 4200H : “Get the lower BCD digit”
ADD C : “Add lower BCD digit”
STA 4300H : “Store the result”
HLT : “Terminate program execution”
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment