Advertisements
Advertisements
Question
Study the following program and answer the questions given below :
Label | Mnemonics /Operand |
BACK | LXIH,COOOH |
MOVC,M | |
INXH | |
MOVA,M | |
XRAA | |
MOV M,A | |
DCR C | |
JNZBACK | |
HLT |
i) Write the purpose of the program.
ii) Write comments for the instructions used in the program.
iii) If the input data at memory location COOO H is 05 H, then write the result along with corresponding memory locations.
Answer in Brief
Solution
(i) The purpose of the program is to rotate the data (8 times) obtained from memory location 6000 H and store the result obtained at next location. i.e. copying same data to another memory location.
(ii)
Label | Mnemonics /Operand | Comments |
BACK | MVIC,08H | ; Set C reg to 08 H |
LXIH,6000H | ; Set HL to 6000 H | |
MOVA,M | ; get first no in Accumulator | |
RRC | ; Rotate the contents of accumulator right by 1 bit | |
DCRC | ; Decrement C reg by 1 | |
JNZ BACK | ; Repeat if c ≠ 0 | |
INX H | ; Increment HL by 1 | |
MOV M, A | ; Store the contents of Accumulator to M reg | |
IILT | ; Stop processing |
(iii)
Memory Location | Before Execution | After Execution |
6000 | FF | FF |
6001 | 10 | FF |
shaalaa.com
Instruction Set and Programming of 8085
Is there an error in this question or solution?