edited by
13,225 views
4 4 votes

The contents of the flag register after execution of the following program by $8085$ microprocessor will be

$\textbf{Program}$
$\textsf{SUB A}$
$\textsf{MVI B,(01)}_\textsf{H}$
$\textsf{DCR B}$
$\textsf{HLT}$

  1.  $(54)_\textsf{H}$
  2. $(00)_\textsf{H}$
  3. $(01)_\textsf{H}$
  4. $(45)_\textsf{H}$

5 Answers

Best answer
10 10 votes

My Answer: None of These, ISRO Answer: (a)

Explanation: 8085 microprocessor has a 8 bit flag register to indicate certain conditions arising after arithmetic and logical operations or to control certain operations.

8085 flag register

  • Carry flag indicates whether there is carry or not after an arithmetic and logical operation.
  • Parity flag indicates whether the result contains odd number of 1s or even number of 1s.
  • Auxiliary carry (or half carry) flag indicates that is there carry from the 3rd bit to 4th.
  • Zero flag indicates whether the result of an arithmetic or logical operation is zero or nonzero.
  • Sign flag indicates whether the result is positive or negative.
  • Other bits in this register are undefined.
Lets traverse the program:
  • SUB A: subtracts the content of accumulator (A) from the content of the accumulator (A); Content of A will become (00)H; Flag Register: 0100 0100 because result is zero and result contains 0 (even) number of 1s.
  • MVI B, (01)H : stores 01 in register B; No computation, no change in Flag Register.
  • DCR B: decreases content of register B; Content of B will become (00)H; Flag Register: 0100 0100 because result is zero and result contains 0 (even) number of 1s and DCR/INC don't affect the carry flag in 8085. 
So, flag register after execution will be 0100 0100 = (44)H.
 
edited by
1 1 vote

I ran this code in 8085 simulator and step in each step and Got o/p = (45)h as flag value.. Arjun Sir could you explain ...

ISRO 2015 Qtn

Answer:
Position:
Show:

Related questions

4 4 votes
1 answers 1 answer
5.7k
5.7k views
go_editor asked Jun 21, 2016
5,673 views
Consider an uncompressed stereo audio signal of CD quality which is sampled at 44.1 kHz and quantized using 16 bits. What is required storage space if a compression ratio...
5 5 votes
3 answers 3 answers
6.1k
6.1k views
go_editor asked Jun 21, 2016
6,117 views
Which of the following is not an image type used in $\text{MPEG}?$$\text{A}$ frame$\text{B}$ frame$\text{D}$ frame$\text{P}$ frame
6 6 votes
1 answers 1 answer
4.2k
4.2k views
go_editor asked Jun 20, 2016
4,201 views
Which of the following compression algorithms is used to generate a $\textsf{.png}$ file?$\text{LZ78}$Deflate$\text{LZW}$Huffman
3 3 votes
2 2 answers
12.7k
12.7k views
go_editor asked Jun 20, 2016
12,659 views
If in a software project the number of user input, user output, enquiries, files and external interfaces are (15, 50, 24, 12, 8), respectively, with complexity average we...