Question: Problem: Division Procedure ( Atmel studio 7 in assembly langauge ) You are to create a program that contains a procedure that performs division. You

Problem: Division Procedure (Atmel studio 7 in assembly langauge)
You are to create a program that contains a procedure that performs division. You will use a simple brute-force approach to compute the quotient and remainder. Since division is simply multiplication in reverse, we can take a brute- force approach to division that iteratively tries a number of quotients until it finds the correct one. In other words, consider the linear equation:
y = q * x + r
Division, and in particular, integer division, corresponds to the case when we are
given values for y an x and want to determine q and r The value of y is our initial value, the dividend or numerator, and the value of x is the divisor or denominator, the value by which we will be dividing y. The result includes q, the quotient, and r, the remainder.
We'll assume unsigned division for simplicity. In this case, the remainder, r, must (by
definition), be less than the value of x, the divisor. Consequently, we can determine the quotient and remainder of division of y by x by taking x and iteratively testing it
(multiplying it) by possible quotients, starting from 0. In other words, start with q =0
and iterate through q =0,1,2,3,... until we find the smallest q such that r < x,
where r = y -(q * x).
Create an assembly program with a procedure that performs division of a 16-bit unsigned dividend by an 8-bit unsigned divisor. The result will be an 8-bit unsigned quotient and an 8-bit unsigned remainder. The procedure will need to receive (from the caller) the input values for the dividend and divisor, and return (to the caller) the quotient and remainder.
Have the main body of your program contain a few calls (at least three) to your Division procedure, each called with different values for the dividend and divisor, to appropriately test your procedure.
Bonus : Question3_1: For each of the calls to your Division procedure, how many cycles did it take to compute the quotient and remainder?

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 Programming Questions!