Project #155711 - assembly program

Computer Tutors

Subject Computer
Due By (Pacific Time) 11/27/2016 05:00 pm

Please note: this is a ASSEMBLY LANGUAGE PROGRAM. NOT A C or C++ program! Thank you
Problem:

       Write an assembly program that implements the following algorithm to perform an integer division 
       and print a message as the following ones:

       12 DIV 5 = (Q = 2, R = 2)
       12 DIV 6 = (Q = 2, R = 0)

       12 and 5 (or 6) will be the user input. You will be preparing a readme with sample test cases.
       The readme must include at least three sample screen shots of your simulator.


        Note:
                a. You are not allowed to use DIV (or similar built in) function 
                  (even if it is available with your simulator! For armSim, I guess it is not available.
                  But not sure about other simulators). 
                b. You will get a straight 0, if you fail to implement the function according to the algorithm. 
               c. The Algorithm written below is taken from the textbook (figure 3.9). If you fail to understand 
                   it, consult with the TA/Grader and the Instructor. Always use the book as your first source 
                   of reference.
                

**** Algorithm ****
----------------------------------------------------------------------------
Given: Two positive integers: a Divisor X, and a Dividend Y
Use three General Purpose Registers (R, Q, X)
where R stores the Remainder, Q stores the Quotient, and X stores the Divisor. 
Steps:
1. Copy Y into the Remainder register (R)
   Register Q will be initialized as 0 
2. update: R =  R - X
3. If R >= 0 then
        Shift the Quotient Register (Q) to the left (1 bit)
        and set the new rightmost bit to 1
   Else
        Restore the original value by of R:  R = R + X
        Also, Shift the Quotient Register (Q) to the left (1 bit)
        and set the new least significant bit to 0
4. Shift the Divisor Register (X) to the right (1 bit)
5. If you are using 32 bit data, then stop after 33 repetitions (for 64 bit data, stop after 65 repetitions)
-------------------------------------------------------------------------------

TutorRating
pallavi

out of 1971 reviews
amosmm

out of 766 reviews
PhyzKyd

out of 1164 reviews
rajdeep77

out of 721 reviews
sctys

out of 1600 reviews
sharadgreen

out of 770 reviews
topnotcher

out of 766 reviews
XXXIAO

out of 680 reviews