907 views

2 Answers

1 votes
1 votes

The Given above assembly code belong to 32 bit Micro processor ( i think 8086)

LXI -- MEAN to initialise a variable  with some value .

In 8086 we have 4 pair of register pairs BC , HL , DE and one more 

BC Are 2 seperate register of 8 bit each ..But they are taken as a pair always in order to provide operands of larger size 

DCX : mean it used to decrement register pair BC 

MOV A,B-- to move the contents from B to A 

OR A , C it mean to ORED the result of accumulator  and contents of C ( iN BC pair ) 

JNZ : Jump not equal to zero 

LOP is label here 

NOW they say LXI B 0007 H = 0000 0000      0000 0111 ( the first 2 nibble are contents of B and last two are contents of  C ) 

DCX B = Decrement contents of BC pair = 0000 0000 0000 0110

MOV A ,B =  0000 0000 0000 0110 

OR A , C = 0000 0000 0000 0110  OR 0000 0000 0000 0110

             = 0000 0000 0000 0110

but here BC pair is still not zero so again decrement it 

BC = 0000 0000 0000 0101 

OR A , C = 0000 0000 0000 0110  OR 0000 0000 0000 0101

             = 0000 0000 0000 0111

 

but here BC pair is still not zero so again decrement it 

BC = 0000 0000 0000 0101 

OR A , C = 0000 0000 0000 0110  OR 0000 0000 0000 0101

             = 0000 0000 0000 0111

but here BC pair is still not zero so again decrement it 

BC = 0000 0000 0000 0100 

OR A , C = 0000 0000 0000 0111  OR 0000 0000 0000 0100

             = 0000 0000 0000 0111

but here BC pair is still not zero so again decrement it 

BC = 0000 0000 0000 0011 

OR A , C = 0000 0000 0000 0111  OR 0000 0000 0000 0011

             = 0000 0000 0000 0111

but here BC pair is still not zero so again decrement it 

BC = 0000 0000 0000 0010 

OR A , C = 0000 0000 0000 0111  OR 0000 0000 0000 0010

             = 0000 0000 0000 0111

but here BC pair is still not zero so again decrement it 

BC = 0000 0000 0000 0001

OR A , C = 0000 0000 0000 0110  OR 0000 0000 0000 0001

             = 0000 0000 0000 0111

but here BC pair is still not zero so again decrement it 

BC = 0000 0000 0000 0000 ( Here after decrementing it turn out to be 0 so it wont exceute next timesince JNZ will turn false )

OR A , C = 0000 0000 0000 0111  OR 0000 0000 0000 0000

             = 0000 0000 0000 0111

So if you see contents are 0000 0000 0000 0111 it  will run for 7  times 

edited by
0 votes
0 votes
7 times.

Inside loop there is only one instruction that modifies B (decrements by one) each time loop is executed. So the loop goes from B =7 to B=1 and exits.

Related questions

0 votes
0 votes
1 answer
1
Sanjay Sharma asked May 3, 2016
400 views
9 votes
9 votes
2 answers
3
sh!va asked May 7, 2017
4,292 views
Which interrupt in $8085$ Microprocessor is unmaskable?$\textsf{RST 5.5}$$\textsf{RST 7.5}$$\textsf{TRAP}$Both (a) and (b)
2 votes
2 votes
1 answer
4