Assembly Language division without using DIV HELP
Posted on 2006-04-18
I have a homework assignment that I understand the theory behind but do not know how to write it in assembly. The program must perform integer division that the user inputs, without using DIV.
It must use this alogorithm:
const int MAX_REPS =8;
for (int reps=1; resp <=MAX_REPS; reps++)
if (Product (LSB) == 1)
Add multiplicand to the left half of the product and place the result in the left half of the Product register;
Shift the Product register right 1 bit;
The dividend and the divisor must be positive and smaller than 65,535. All inputs are to be validated with a reprompt occurring when there is illegal input. The program is to prompt for and validate a dividend and a divisor and then display the quotient and the remainder.
This is an extra part I need to do for this assignment:
Allow the user to enter both positive and negative numbers. You can choose to half the ranges as is done with the Integer type variable in a high level language, or you can choose to keep the same ranges, just allow negatives as well as positives. It must indicate the range by displaying it at the beginning of the program, so the user can know what test valuses to use.
I know the basic therory of multiplying by 1/10 and then shifting the register, I just dont know how to do it in assembly. And I have no idea how to do the second part. Please help