PIC Microcontroller Math Method

24x8 multiplication from Byron A Jeff

posted to PICList

Something like this:
--------------------
mult24x8:
        clrf    prod0           ; Clear the product
        clrf    prod1
        clrf    prod2
        clrf    prod3
        clrf    twofour3        ; Clear the top byte of the multiplicand
multloop:
        movf    eight,W         ; Check to see if eight bit is empty
        btfsc   STATUS,Z        ; Done if zero
        return
        bcf     STATUS,C        ; clear carry
        rrl     eight,F         ; Get the next bit
        btfss   STATUS,C        ; Add if carry is set
        goto    multshift       ; shift only if 0
        movf    twofour0,W      ; Add the 32 bits of multiplicand to product
        addwf   prod0,F         ; each addwf sets the carry
        btfsc   STATUS,C        ; Don't increment if no carry
        call    carryprop1 	; Propigate carry to next byte(s)
        movf    twofour1,W      ;
        addwf   prod1,F         ;
        btfsc   STATUS,C        ; Don't increment if no carry
        call    carryprop2 	; Propigate carry to next byte(s)
        movf    twofour2,W      ;
        addwf   prod2,F         ;
        btfsc   STATUS,C        ; Don't increment if no carry
        incf    prod3,F         ; Add one to next byte if carry occured
        movf    twofour3,W      ;
        addwf   prod3,F         ;
multshift:
        bcf     STATUS,C        ; clear carry
        rlf     twofour0,F      ; Shift the 24 bits one bit to the left
        rlf     twofour1,F
        rlf     twofour2,F
        rlf     twofour3,F
        goto    multloop

carryprop1:
        incfsz  prod1,F
        return
carryprop2:
        incfsz  prod2,F
        return
carryprop3:
        incf    prod3,F
        return
------------------------------------------------------------

I wrote this off the top of my head and I haven't tested it, but it should be
in the ballpark.

Not speedy, but should work.