Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The exercise is to write an assembly program to perform division as a repeated subtraction. The number format is 8-bit signed integer. Procedure: Division
The exercise is to write an assembly program to perform division as a repeated subtraction. The number format is 8-bit signed integer. Procedure: Division as repeated subtraction. Division can be expressed as: = Z + The term Z is the number of times that Y will "fit" into X and W/Y is the remainder. This can be done by repeated subtractions. 15 =? Where 15 is the dividend and 4 is the divisor. 4 15 4 = 11 One time 11 - 4 = 7 Two TImes 7- 4 = 3 Three times 3 4 = -1 0nly three times, remainder 3 This can be seen as: This will result in = 15 = 3 + = 3.75. The divisor "fits" into the dividend three times and there is a remainder of 3. Tasks: Load data from memory. The divisor and dividend will be loaded into registers (I will use registers "A" and "B" for dividend and divisor respectively, for this example) from memory. (.data) The processor will subtract the contents of A and B and increment a count by one if the difference is greater than or equal to zero. The difference will replace the contents of A. The above operation will be repeated until the difference is less than zero. The results of the division will be stored (as eight-bit signed integers) in two different memory locations (.data). The program must be able to handle all three cases X > Y,X = Y, X < Y by providing the correct output.
Step by Step Solution
★★★★★
3.50 Rating (157 Votes )
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