Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

8X8 bit unsigned multiplication

Status
Not open for further replies.
Try the for examples
 
Got this in a lecture

; 8x8 unsigned multiply routine.
; No checks made for M1 or M2 equal to zero
Clrf R_hi ; Clear result location
clrf R_lo
movlw 0x08 ; setup loop count
movwf cntr
movf M1,W ; initialize W with M1

Umul rrf M2,F ; rotate into carry to check bits
Btfsc STATUS,C ; if carry set i.e. bit was 1
addwf R_hi,F ; ... we add
rrf R_hi,F ; shift over for the next addition
rrf R_lo,F
decf cntr,F ; check the loop count
btfss STATUS,Z
goto Umul
...


Looks good i think. Right?
 
8X8 Multiplication

Mike,

Yea mike it works fine. Thanks for this as well as the switching between ports code...Work great...You the man! :D
 
That simple loop multiplication is very slow though, if you start running out of processor time there are other multiplication routines out there that use more code space but take significantly less time to run.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top