Searching \ for 'Multiplication program' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/method/math.htm?key=multiplication
Search entire site for: 'Multiplication program'.

Truncated match.
PICList Thread
'Multiplication program'
1998\12\09@003308 by Scott Shidel...

flavicon
face
O yeah, also I figured I mite include the problem I am working on incase
some of you can debug it.  The program SHOULD multiply 4 and 6.
Once again, I got this from Myke Predko's book.

       List    p=16c711
       include <p16c71.inc>
Prod    equ     0x0c
LoopC   equ     0x0e
Plier   equ     0x0f
Licand  equ     0x11
reset
       goto    start
       org     0x04
start
       clrf    Prod
       clrf    Prod+1
       movlw   H'6'
       movwf   Plier
       movlw   H'4'
       movwf   Licand
       movlw   16
       movwf   LoopC
Loop
       rrf     Plier+1
       rrf     Plier
       btfss   STATUS, C
        goto   AddSkip
       movf    Licand+1, w
       addwf   Prod+1
       movf    Licand, w
       addwf   Prod
       btfsc   STATUS, C
        incf   Prod+1

AddSkip
       bcf     STATUS, C
       rlf     Licand
       rlf     Licand+1

       decfsz  LoopC
       goto Loop
       end


-----------------------------------------------------------------------
               The Pinto Page:  http://www.eng.usf.edu/~shidel
                  Join the Ford Turbo Mailing List!
                 http://www.FindMail.com/list/turbo/
Scott
-71 Pinto, stock 2.3 turbo, 13.67@98, radials
       8.1@85 1/8th mile on slicks
-85 Merkur 13.764@98 on radials&3300lbs! Under $300 in mods!
------------------------------------------------------------------------

1998\12\09@004137 by Michael Hagberg

flavicon
face
here it is!!! make this a movlw D'16' (i think that's how to force decimal
mode)

>        movlw   16
>        movwf   LoopC

1998\12\09@065854 by Stig Brautaset

flavicon
face
How about:

Plier        equ    0x0c
PlierHI    equ    0x0d
Licand    equ    0x0e

       org      0x00
Start
       clrf      Plier
       clrf      PlierHI
       clrf      Licand

       movlw   6
       movwf   Plier
       movlw   4
       movwf   Licand

       movf   Licand, f             ; Test if zero
       btfss   STATUS, Z
         goto  finish                  ; A*0 = 0, so output is given

       movf   Plier, f                 ; Test if zero
       btfss   STATUS, Z
         goto  finish                  ; 0*B = 0, so output is given

Loop
       bcf      STATUS, C       ; Reset carry so it does not affect multiplication
       rlf        Plier                    ; Do multiplication
       btfss   STATUS, C       ; if carry, increment high byte
         incf    Plier+1
       
       decfsz   Licand                ; When Licand is zero, multiplication is done
         goto    Loop
       
finish

This is just out of my head, I do not have any helpers here, so I might not even remember the asm-instructions correctly...

Stig

========================================================
Stig Brautaset - spam_OUTsbrautasTakeThisOuTspamc2i.net - ICQ: 11052183
Student of electronics  -  http://home.c2i.net/sbrautas/
========================================================

     


{Quote hidden}

How about substituting the above with:
   org    0x00    ; start of program


{Quote hidden}

1998\12\09@150232 by myke predko

flavicon
face
Hi Folks (and Scott),

I just got a chance to look at this week's mail.

>here it is!!! make this a movlw D'16' (i think that's how to force decimal
>mode)
>
>>        movlw   16
>>        movwf   LoopC

In all my PICMicro code, I set the Radix to Decimal.

I also wanted to point out that on my 16 Bit operations page, I have
included a 16 Bit multiplication (with 32 bit result) snippet that is *very*
efficient and fast (much better than the routines I've come up with).  It
can be found at:

http://www.myke.com/PICMicro/16bit.htm

myke

Read Alfred Lansing's book on Sir Ernest Shackleton's 1914 voyage and
adventure in the Antarctic.  Two years trying to return to civilization:
this week's book at:

http://www.myke.com/Book_Room/book1a.htm

Also look at:

http://www.myke.com/My_Books/homcu.htm

for information on "Handbook of Microcontrollers" which has been named the
Main Selection for November 1998 for the Electronics Book Club!

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...