The Gateway to Computer Science Excellence
+3 votes
4.4k views

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

Program
SUB A
MVI B,(01)$_H$
DCR B
HLT

  1.  (54)$_H$
  2. (00)$_H$
  3. (01)$_H$
  4. (45)$_H$
in CO and Architecture by Active (4.9k points) | 4.4k views
0
please anybody explain this question.I tried allot but unable to understand it.
0
m also getting 45h,,,,if v try to use again dcr b...it will result into 95h

5 Answers

+9 votes
Best answer

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.
 
by Active (2.4k points)
edited by
0
Another wrong thing in question - other bits are undefined- so we can't say it is 0.
0

Auxilary carry will be 1 after the decrement of (01)H

oooo ooo1 (original B)

1111 1111   (substracting 1) 

--------------

here auxilary carry will be 1 on decrement. so yeah. Isro is correct.

+2 votes

According to virtual 8085 processor , answer is 45H
please check

by Active (4.1k points)
+1 vote
ans is a.(54)h

can any one explain iam getting doubt..?
by Active (4.9k points)
+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

by Active (1.5k points)
0
I have also doubt in this q? Arjun sir please explain this?
0
Are you sure you did the execution correctly? Because then the control should be at HLT instruction. Also, CY at end must be 0 here.
0 votes
Ans is (54)H OPTION A
by (11 points)
0
how
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,297 answers
198,262 comments
104,977 users