Privacy Policy

Thursday, 9 May 2013

GATE 2002 Questions on Micro processor

Two mark questions:

Question 1:

Consider the following assembly language program.



1MVIB,87H
2MOVA, B
3START: JMPNEXT
4MVIB, 00H
5XRAB
6OUTPORT 1
7HLT

8NEXT:XRAB
9JPSTART
10OUTPORT 2
11HLT

The execution of the above program in an 8085 microprocessor will result in

(a) an output of 87H at PORT1
(b) an output of 87H at PORT2
(c) infinite looping of the program execution with accumulator data remaining at 00H.
(d) infinite looping of the program execution with accumulator data alternating between 00H and 87H.

Answer: (b)

Explanation:

1. MVI command moves or stores the 87H(10000111H) to the B Register
2. MOV A, B moves the content of B Register to the A Register
       Now Accumulator will contain 87H (10000111H)
        and B register will contain 87H(10000111H)

3. JMP NEXT will be executed so the program will be jumped to NEXT(8th command). In that XRA B (Accumulator will be Exor-ed with B register and store the output in Accumulato).

A ==> 10000111H
B ==> 10000111H
------------------------------- After XRA B command
A ==> 00000000H

Sign Flag will be 0 (+ve)

4. The next "JP START" will jump to start only when the sign flag is zero. since the sign flag is zero it will jump to START that is 3rd command"JMP NEXT".
5. After JMP NEXT was jumped to NEXT. XRA B command will be executed.
(currently)
A ==> 00000000H
B ==> 10000111H
-------------------------------After XRA B command
A ==> 10000111H (87H)

sign flag will be 1 (-ve)
 so JP START will not be executed.

6. The output 87H will be at PORT 2 .

(b) an output of 87H at PORT 2.

No comments:

Post a Comment