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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started