Code:
; 16bit by 8bit unsigned multiply ; by Martin Sturm 2010 ; tested over all input combinations ; ; Nothing special, just a modified version of 16x16 code on piclist.com ; ; if t is a temp ; W * bH:bL -> r3:r2:r1 ; 19 cycles, 85-125, 105 average ; ; else, comment out MOVWF t ; t * bH:bL -> r3:r2:r1 (t is modified) ; 18 cycles, 84-124, 104 average ; MULT_16x8_SMALL MACRO bH,bL, t, r3,r2,r1 LOCAL m1, m2 CLRF r3 CLRF r2 CLRF r1 MOVWF t ; optionally comment out BSF r1,7 m1: RRF t,F SKPC GOTO m2 MOVFW bL ADDWF r2,F MOVFW bH SKPNC INCFSZ bH,W ADDWF r3,F m2: RRF r3,F RRF r2,F RRF r1,F SKPC GOTO m1 ENDM