Question

What is the value of AX after these five lines of code? mov AX,10 shl AX,1...

What is the value of AX after these five lines of code?

mov AX,10

shl AX,1

add AX,10

cmp AX, 10

dec ax

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

Instruction1: mov AX,10

Explanation: Here mov is opcode and AX is called destination register value and 10 is called source register value. mov copies the source register value into destination register value, hence AX = 10

Instruction 2:shl AX,1

Explanation: shl is used to left-shift the binary value of register by some digit which is represented in second part. Here AX,1 represents the binary value of AX will be left-shifted by 1 digit so AX=10 which is 00001010 and after the execution of instruction shl AX,1 the binary value of AX will be left-shifted by 1 digit so finally it will be 00010100 which is 20 so now AX =20

Instruction 3: add AX,10

Explanation: add is opcode used to add contents of two registers and assigning final value to first register.Here AX=20 and other value=10 so AX= 20+10=30, So after 3rd instruction execution AX=30

Instruction 4: cmp AX,10

Explanation : cmp is opcode which is used to compare the two register contents which are source register at the side and destination register at the left side.

If destination register content > source register content => ZF(zero flag) = 0, CF(carry flag) =0

If destination register content < source register content => ZF(zero flag) = 0, CF(carry flag) =1

If destination register content = source register content => ZF(zero flag) = 1, CF(carry flag) =0

here AX>10 hence ZF=0,CF=0

Instruction 5:dec AX

Explanation: dec is opcode and AX is operand, dec is used to decrease the value of operand by 1

Hence AX-1 =30-1 = 29 (Final value of AX)

Add a comment
Know the answer?
Add Answer to:
What is the value of AX after these five lines of code? mov AX,10 shl AX,1...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT