Question

Assembly Code & debug the following program in VS, then answer these questions at the end...

Assembly

Code & debug the following program in VS, then answer these questions at the end of the code using comments:

a) To which label the program jumped?

b) Why did the program jump to this label?

c) Why the program didn’t jump to the other label, since ‘80h > 7Fh’ is correct?

mov al,+127 ;hex value is 7Fh (+127)

cmp al,-128 ;hex value is 80h (-128)

ja IsAbove

jg IsGreater

IsAbove:

exit

IsGreater:

exit

Homework Answers

Answer #1

To answer this question lets, first understand the JA and JF flags.

JA Flag : Algorithm: if (CF = 0) and (ZF = 0) then jump

JG Flag : if (ZF = 0) and (SF = OF) then jump

Now, let us understand the CMP label:

Compare. Algorithm: operand1 - operand2

The immediate result is not stored anywhere, flags are set (OF, SF, ZF, AF, PF, CF) according to result.

Now in the question we are using CMP on +127 and -128, when subtracting it will result in -1.

For jump condtion to stasify we need to set ZF = 0.

But ZF = 0 only if  After any arithmetical or logical operation if the result is 0 or 00H, the zero flag becomes set i.e. 1, otherwise it becomes reset i.e. 0.
We can see that carry flag is also 0.

So JA Flag would be used.

a) isAbove label

b) I have explained it above.

c) Because the result is not stored in immediate result, but using flags, as explained above.

Know the answer?
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
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • MS KP MM Corporation is a manufacturer that produces cosmetics. The following information has been taken...
    asked 4 minutes ago
  • Dr. Bunson Honeydew and Dr. Strangepork both wanted to know how effective TV ads were at...
    asked 5 minutes ago
  • 1)  Consider the following temperature surroundings. Ground level, 21oC; 500m, 20oC; 600m, 19oC; 1000m, 20oC. If we...
    asked 11 minutes ago
  • 1. An AA iron-nickel battery delivers a constant current of 750 mA at 1.2 V (a)Calculate...
    asked 15 minutes ago
  • In the process of recrystallization, after dissolving the product in hot methanol, why do we have...
    asked 29 minutes ago
  • Finish buildFloat(): It does three things: Given exponent it computes exponentPattern. If exponent is less than...
    asked 29 minutes ago
  • A chemist has two large containers of sulfuric acid solution, with different concentrations of acid in...
    asked 39 minutes ago
  • Training Goal: Based on Enterprise business strategy and goals develop several training goals based on your...
    asked 39 minutes ago
  • Let f(x) = 5x2 + x − 2. Use the limit definition of f′(a) and the...
    asked 39 minutes ago
  • "Discuss whether free market is necessarily efficient. Give some examples to illustrate the limitations of government...
    asked 1 hour ago
  • Three separate random samples of students (one sample selected from each of three different colleges) were...
    asked 1 hour ago
  • , NEED ANSWER ASAP / ANSWER NEVER USED BEFORE, COMPLETELY NEW ANSWER PLEASE Discuss an example...
    asked 1 hour ago