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}$ $(54)_\textsf{H}$ $(00)_\textsf{H}$ $(01)_\textsf{H}$ $(45)_\textsf{H}$ CO & Architecture 8085-microprocessor non-gatecse isro2015 + – kvkumar 13.2k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply neha singh commented Jun 15, 2016 reply Follow flag please anybody explain this question.I tried allot but unable to understand it. 0 0 replyShare Swati Tandel commented Jun 25, 2016 i edited by Swati Tandel Jun 25, 2016 reply Follow flag m also getting 45h,,,,if v try to use again dcr b...it will result into 95h 0 0 replyShare Please log in or register to add a comment.
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. 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. Reference: http://labs.kitiyo.com/8085/free-online-assember-simulator-8085.html Mangilal Saraswat answered Jun 22, 2016 • edited Jul 2, 2016 by Arjun Mangilal Saraswat comment Share Follow See all 3 Comments 3 3 Comments reply Arjun commented Jun 25, 2016 reply Follow flag Another wrong thing in question - other bits are undefined- so we can't say it is 0. 0 0 replyShare abhishek_tyagi commented Jan 9, 2020 reply Follow flag 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. 0 0 replyShare Manish Kumar 24 commented Jun 12, 2023 reply Follow flag The answer to this question is (54)H. Here is the proff. The flag register in 8085 looks like: S Z X AC X P X CY 0 0 0 0 0 0 0 0 After performing this operations: Instruction 1 will subtract 0 from accumulator register value and initially accumulator register value is 0. So subtracting 0 from 0 will not affect any of the flag except zero flag and parity flag. As final value is zero(even) so Zero flag(Z) will be set and parity flag will be set. Instruction 3 is decrementing the value of a register. When initial value of register is 0 and we subtract 1 from it then value of register will become 11111111(considering 8 bit register). It will also set the Auxiliary Cary flag. Sign bit will not be set in decrement operation. S Z X AC X P X CY 0 1 0 1 0 1 0 0 So the final answer is 0101 0100 and that is (54)H 0 0 replyShare Please log in or register to add a comment.
3 3 votes According to virtual 8085 processor , answer is 45H please check Devwritt answered Jul 2, 2016 Devwritt comment Share Follow 0 reply Please log in or register to add a comment.
1 1 vote ans is a.(54)h can any one explain iam getting doubt..? kvkumar answered May 24, 2016 kvkumar comment Share Follow 0 reply Please log in or register to add a comment.
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 ... pps121 answered Jun 22, 2016 pps121 comment Share Follow See all 2 Comments 2 2 Comments reply neha singh commented Jun 22, 2016 reply Follow flag I have also doubt in this q? Arjun sir please explain this? 0 0 replyShare Arjun commented Jun 25, 2016 reply Follow flag 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 0 replyShare Please log in or register to add a comment.
0 0 votes Ans is (54)H OPTION A Raja Raman answered Jun 24, 2016 Raja Raman comment Share Follow See 1 comment 1 1 comment reply Srujana Manchikanti commented Jun 27, 2016 reply Follow flag how 0 0 replyShare Please log in or register to add a comment.