Multiplying in binary follows the same method as multiplying in decimal,
shift and add.
When you do 123 x 45 you would do:
123 times 5 gives 615
shift the 45 right one place, shift the 123 left one place
1230 times 4 is 4920
add to the running total
shift the 45 right again, no more digits left, all done
Binary is the same, with the added advantage that everything is either times
zero or times one, so you're just adding or not adding
When you do 10101 times 101 you would do:
10101 times 1 - just copy the 10101, add to running total
shift the 101 right one place, shift the 10101 left one place
101010 times 0 - zero, nothing to add
shift the 101 right one place, shift the 101010 left one place
1010100 times 1 - just copy the 1010100, add to running total
shift the 101 right one place, shift the 1010100 left one place
the 101 has now become zero, so BEQ out of the loop
You will now have added:
..10101 * 1 = ..10101
.101010 * 0 = .000000
1010100 * 1 = 1010100
total:
..............1101001
(dots added for formatting)
which is 105 which is indeed %10101 x %101 which is 21 x 5.