Question
USE 68K ASSEMBLY The Russian Peasant method of multiplication computes the product of two unsigned numbers by doubling/halving of the factors. The algorithm is described
USE 68K ASSEMBLY
The Russian Peasant method of multiplication computes the product of two unsigned numbers by doubling/halving of the factors. The algorithm is described through the example of multiplying 30 x 25. First, put the factors in two columns. On each iteration double the value in column 1 and divide the value in column 2 by 2. The process terminates when the quotient reaches 1. The product is formed by adding the terms in column 1 whose corresponding term in column 2 is odd. The product of 30 x 25 = 30 + 240 + 480 = 750.
(Apparently, real Russian peasants may have tracked their doublings with bowls of pebble instead of columns of numbers. The ancient Egyptians also invented a similar process thousands of years earlier, and computers are still using related methods today.)
Your task is to write a program that implements the Russian Peasant algorithm to perform unsigned multiplication. Assume the two factors (numbers to be multiplied) are 16-bit values stored in data registers D0 and D1, respectively. When implementing your algorithm do not use the 68000s multiplication or division instructions. Rather, use the (faster) shift instructions when performing multiplication and division by 2.
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