Question
Theory Division using shift Use the assembly language (masm615) Two numbers A (a n a n-1 ... a 2 a 1 a 0 ) and
Theory
Division using shift
Use the assembly language (masm615)
Two numbers A (an an-1 ... a2 a1 a0) and B (bn bn-1 ... b2 b1 b0). The division of A/B yields a quotient Q (bn qn-1 ... q2 q1 q0) and a remainder R that can be calculated by a series of shifts and subtractions.
Algorithm:(note: << represents logic shift to left)
Initialize i = n, Q = 0, Y = 0
Y = (Y << 1) + ai
If Y >= B then: {Q = Q + 1, Y = Y - B}
i = i - 1
If i > 0 then goto 2
R = Y
Assignment
Your assignment will be to implement division suing shift instruction and conditional instructions and separately signed division.
Make sure your code works for 0's as arguments.
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