Multiply 	;16x16 Multiply routine from Myke Predko
; NOTE: THIS ROUTINE REQUIRES THE MULTIPLICAND TO BE POSITIVE!!!
; THE MULTIPLIER, HOWEVER, CAN BE NEGATIVE.
  clrf   Product + 2               ;  "Product" will be the 
  clrf   Product + 3               ;   Result of the Operation

  movlw  D'16'                     ;  Operating on 16 Bits
  movwf  BitCount

  bcf NegMult			;Clear the negative multiplication flag
  ifclr Multiplier+1,7		;Check high bit to see if negative
  goto Loop2			;Positive - continue w/normal multiplication
  bsf NegMult			;Set negative multiplication flag
;
;  Multiplier is Negative, so take two's complement of Multiplier before doing operation
;
	movlw 0xFF		;Take Two's Complement of Multiplier
	xorwf Multiplier,f
	xorwf Multiplier+1,f	
	incfsz Multiplier,f
	goto Loop2
	incf Multiplier+1,f	;Done w/two's complement

Loop2                              ;  Loop Here for Each Bit
;
  rrf    Multiplier + 1, f         ;  Shift the Multiplier down
  rrf    Multiplier, f             ;   by one

  btfss  STATUS, C                 ;  If the bit is set, add 
  goto  Skip                       ;   the Multiplicand to the
				   ;   "Product"
  clrf   Product + 4
  movf   Multiplicand + 1, w
  addwf  Product + 3, f
  btfsc  STATUS, C		   ;  Make Sure the Carry is Passed
  incf  Product + 4, f		   ;   to the Next Byte
  movf   Multiplicand, w
  addwf  Product + 2, f
  btfsc  STATUS, C
  incfsz Product + 3, f	   	   ;  Make Sure Carry is Passed with
  goto $ + 2			   ;   the Shift
  incf Product + 4, f

Skip                               ;  Shift "Product" Down with 
  bcf    STATUS, C 
  rrf    Product + 4, f
  rrf    Product + 3, f            ;   the Reset Carry from the 
  rrf    Product + 2, f            ;   Multiplier shift down or
  rrf    Product + 1, f            ;   the result of the sixteen
  rrf    Product, f                ;   bit addition.

  decfsz BitCount,f
   goto  Loop2

;
;  Check if Multiplier was Negative. If so, take two's complement of Product
;
	ifclr NegMult
	goto MultDone		;Positive multiplication, so exit
	movlw 0xFF		;Take Two's Complement of Temp
	xorwf Product,f
	xorwf Product+1,f
	xorwf Product+2,f
	xorwf Product+3,f
	incfsz Product,f
	goto MultDone
	incfsz Product+1,f
	goto MultDone	
	incfsz Product+2,f
	goto MultDone
	incf Product+3,f	;Done w/two's complement
MultDone
   return