MSP430 series for no hardware multipliers
R11 * R12 -> R15 | R14R11, R12 is two unsigned numbers; R15, R14 is product, where R15 is high character, R14 is low word
Simple thinking: R12 R11 is accumulating their product
The procedure is as follows: CLR R14 CLR R15 ClrCloop add R11, R14; R11 R14 -> R14 ADC R15; add the inlet position to the R15 DEC R12; R12-1H jnz loop; repeated addition
The main procedures can multiply function, but it is very time consuming (maximum of 4 * fffh cycles).
Therefore, a way of shift can be employed.
The reference procedures are as follows: CLR R14 CLR R15 CLR R13 MOV # 1, R10LOOP1 BIT R10, R11 JZ LOOP2 ADD R12, R14 ADDC R13, R15LOOP2 RLA R12 RLC R13 RLA R10 JNC LOOP1
This reference program is based on the "MSP430 Series MCU Interface Technology and System Design Example" written by Teacher Wei Xiaolong.