Write a program to move the contents of memory location 2000H to accumulator.
Increment these contents and place then in location 2001H.
Answers
Answer:
The contents of the accumulator are copied into the memory location specified by the contents of the operand. The contents of register L are stored in the memory location specified by the 16-bit address in the operand and the contents of H register are stored into the next memory location by incrementing the operand.
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"
Unpack a BCD number
Statement: Two digit BCD number is stored in memory location 4200H. Unpack the BCD number and store the two digits in memory locations 4300H and 4301H such that memory location 4300H will have lower BCD digit.
Sample problem:
(4200H) = 58
Result = (4300H) = 08 and
(4301H) = 05
Source program:
LDA 4200H : "Get the packed BCD number"
ANI FOH : "Mask lower nibble"
RRC
RRC
RRC
RRC : "Adjust higher BCD digit as a lower digit"
STA 4301H : "Store the partial result"
LDA 4200H : "Get the original BCD number"
ANI OFH : "Mask higher nibble"
STA 4201H : "Store the result"
HLT : "Terminate program execution"
Execution format of instructions
Statement: Read the program given below and state the contents of all registers after the execution of each instruction in sequence.
Main program:
4000H LXI SP, 27FFH
4003H LXI H, 2000H
4006H LXI B, 1020H
4009H CALL SUB
400CH HLT
Subroutine program:
4100H SUB: PUSH B
4101H PUSH H
4102H LXI B, 4080H
4105H LXI H, 4090H
4108H SHLD 2200H
4109H DAD B
410CH POP H
410DH POP B
410EH RET
Right shift, bit of data( 8 bit and 16 bit)