Some time ago, I had to implement a multiplication routine in 6502 assembly for two integer factors, each one byte in size, using Booth’s multiplication algorithm. Implementing Booth’s method itself was not particularly tricky. However, it took me some time to come up with a solution that requires only around 40 lines of code.
I also found it important to write a routine that tests the multiplication with various predefined combinations of the two factors. The tests included all edge cases, as well as cases where at least one of the factors is zero.
The code I ended up with is listed below:
In one of the following posts I will describe the ideas behind the Booth method in more detail.
Enjoy Reading This Article?
Here are some more articles you might like to read next: