> > Hi, > > Sorry, this still does not work. (I think!) I still don't see the goto at the bottom of the routine and the returns at the bottom are still in plae. > > TWOFOUR0 B'00010011' > TWOFOUR1 B'00100110' > TWOFOUR2 B'00000000' > TWOFOUR3 B'00000000' > PROD0 B'00010011' > PROD1 B'00100110' > PROD2 B'00000000' > PROD3 B'00000000' > MULITIPLIER B'00000111' How exactly are you defining these values above? It's looks like you're doing equates. Let me give you the rest of the setup code I used for my test: prod0 equ 20 prod1 equ 21 prod2 equ 22 prod3 equ 24 twofour0 equ 25 twofour1 equ 26 twofour2 equ 27 twofour3 equ 28 multiplier equ 29 STATUS EQU H'0003' C EQU H'0000' Z EQU H'0002' W EQU 0 F EQU 1 movlw 7 movwf multiplier ;TWOFOUR2 B'00001000' ; Equivalent: c0=534035 (dec) movlw B'00001000' ; movwf twofour2 ;TWOFOUR1 B'00100110' movlw B'00100110' ; movwf twofour1 ;TWOFOUR0 B'00010011' movlw B'00010011' ; movwf twofour0 call mult24x8 loop goto loop > > if I use the code below. > > Thanks in advance for taking a look. > > Regards, > > Saurabh > > ============================================== > mult24x8: > clrf prod0 ; Clear the product > clrf prod1 > clrf prod2 > clrf prod3 > clrf twofour3 ; Clear the top byte of the multiplicand > return > > multloop: > movf mulitiplier,W ; Check to see if eight bit is empty > btfsc STATUS,Z ; Done if zero > return > bcf STATUS,C ; clear carry > rrf mulitiplier,F ; Get the next bit > btfss STATUS,C ; Add if carry is set > goto multshift ; shift only if 0 > > movf twofour0,w > addwf prod0,f > > movf twofour1,w > btfsc STATUS,c > incfsz twofour1,w > addwf prod1,f > > movf twofour2,w > btfsc STATUS,c > incfsz twofour2,w > addwf prod2,f > > movf twofour3,w > btfsc STATUS,c > incfsz 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 > return > return > ============================================== >