Question: Assembly Language Help Detect Overflow after calling doSub, doAdd or doMult There are three kinds of overflow you should detect: positive overflow, , negative overflow

Assembly Language Help

Detect Overflow after calling doSub, doAdd or doMult

There are three kinds of overflow you should detect: positive overflow, , negative overflow and multiplication overflow where the product does not fit in eax alone. If the overflow is positive overflow, you should print the positive overflow message and go on to evaluating the next expression. If the overflow is negative overflow, you should print the negative overflow message and go on to evaluating the next expression.

Hint: if there is overflow after sub or add, look at the sign of the answer. If the answer is positive then there was negative overflow, otherwise it was positive overflow (answer was negative). Multiplication overflow If overflow is detected after calling doMult it means the product did not fit in eax alone and that the upper part of the product is in edx. Strictly speaking this is not an error condition for the 1 operand version of imul. It just means with the current program we do not have a way to print an 8 byte number contained in EDX:EAX. An overflow condition would indicate an error for the 2 and 3 operand versions of imul where the product did not fit in operand 1. If overflow is detected after calling doMult, print the "**Multiplication Overflow** message and go on to evaluating the next expression. No overflow after division Overflow cannot occur after division so you should not check for overflow after calling doDiv. It is up to you to figure out the most efficient way to print the overflow messages and go on to evaluating the next expression. You should not repeat code except code to print the different overflow message. When you are comparing the operator you should use the character not the ascii value. For example use '*' not 2Ah.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!