; ACC = ACC * 0.0931323
; Temp = TEMP
; ACC size = 24 bits
; Error = 1e-006 %
; Bytes order = little endian
; Round = no

; ALGORITHM:
; Clear accumulator
; Add input / 16 to accumulator
; Add input / 32 to accumulator
; Substract input / 1024 from accumulator
; Add input / 4096 to accumulator
; Add input / 8192 to accumulator
; Substract input / 131072 from accumulator
; Add input / 4194304 to accumulator
; Move accumulator to result
;
; Approximated constant: 0.0931323, Error: 0 %

;     Input: ACC0 .. ACC2, 24 bits
;    Output: ACC0 .. ACC2, 21 bits
; Code size: 149 instructions

	cblock
	ACC0
	ACC1
	ACC2
	TEMP0
	TEMP1
	TEMP2
	endc

;copy accumulator to temporary
	movf	ACC2, w
	movwf	TEMP2
	movf	ACC1, w
	movwf	TEMP1
	movf	ACC0, w
	movwf	TEMP0


;shift accumulator right 5 times
	swapf	ACC0, w
	andlw	0x0F
	movwf	ACC0
	swapf	ACC1, w
	movwf	ACC1
	andlw	0xF0
	xorwf	ACC1, f
	iorwf	ACC0, f
	swapf	ACC2, w
	movwf	ACC2
	andlw	0xF0
	xorwf	ACC2, f
	iorwf	ACC1, f
	clrc
	rrf	ACC2, f
	rrf	ACC1, f
	rrf	ACC0, f

;substract temporary from accumulator
	movf	TEMP0, w
	subwf	ACC0, f
	movf	TEMP1, w
	skpc
	incfsz	TEMP1, w
	subwf	ACC1, f
	movf	TEMP2, w
	skpc
	incfsz	TEMP2, w
	subwf	ACC2, f

;shift accumulator right 4 times
	swapf	ACC0, w
	andlw	0x0F
	movwf	ACC0
	swapf	ACC1, w
	movwf	ACC1
	andlw	0xF0
	xorwf	ACC1, f
	iorwf	ACC0, f
	swapf	ACC2, w
	movwf	ACC2
	andlw	0xF0
	xorwf	ACC2, f
	iorwf	ACC1, f
	movlw	0xF0
	skpc
	iorwf	ACC2, f

;add temporary to accumulator
	movf	TEMP0, w
	addwf	ACC0, f
	movf	TEMP1, w
	skpnc
	incfsz	TEMP1, w
	addwf	ACC1, f
	movf	TEMP2, w
	skpnc
	incfsz	TEMP2, w
	addwf	ACC2, f

;shift accumulator right 1 times
	clrc
	rrf	ACC2, f
	rrf	ACC1, f
	rrf	ACC0, f

;add temporary to accumulator
	movf	TEMP0, w
	addwf	ACC0, f
	movf	TEMP1, w
	skpnc
	incfsz	TEMP1, w
	addwf	ACC1, f
	movf	TEMP2, w
	skpnc
	incfsz	TEMP2, w
	addwf	ACC2, f

;shift accumulator right 2 times
	rrf	ACC2, f
	rrf	ACC1, f
	rrf	ACC0, f
	clrc
	rrf	ACC2, f
	rrf	ACC1, f
	rrf	ACC0, f

;substract temporary from accumulator
	movf	TEMP0, w
	subwf	ACC0, f
	movf	TEMP1, w
	skpc
	incfsz	TEMP1, w
	subwf	ACC1, f
	movf	TEMP2, w
	skpc
	incfsz	TEMP2, w
	subwf	ACC2, f

;shift accumulator right 5 times
	swapf	ACC0, w
	andlw	0x0F
	movwf	ACC0
	swapf	ACC1, w
	movwf	ACC1
	andlw	0xF0
	xorwf	ACC1, f
	iorwf	ACC0, f
	swapf	ACC2, w
	movwf	ACC2
	andlw	0xF0
	xorwf	ACC2, f
	iorwf	ACC1, f
	movlw	0xF0
	skpc
	iorwf	ACC2, f
	rlf	ACC2, w
	rrf	ACC2, f
	rrf	ACC1, f
	rrf	ACC0, f

;add temporary to accumulator
	movf	TEMP0, w
	addwf	ACC0, f
	movf	TEMP1, w
	skpnc
	incfsz	TEMP1, w
	addwf	ACC1, f
	movf	TEMP2, w
	skpnc
	incfsz	TEMP2, w
	addwf	ACC2, f

;shift accumulator right 1 times
	clrc
	rrf	ACC2, f
	rrf	ACC1, f
	rrf	ACC0, f

;add temporary to accumulator
	movf	TEMP0, w
	addwf	ACC0, f
	movf	TEMP1, w
	skpnc
	incfsz	TEMP1, w
	addwf	ACC1, f
	movf	TEMP2, w
	skpnc
	incfsz	TEMP2, w
	addwf	ACC2, f

;shift accumulator right 4 times
	swapf	ACC0, w
	andlw	0x0F
	movwf	ACC0
	swapf	ACC1, w
	movwf	ACC1
	andlw	0xF0
	xorwf	ACC1, f
	iorwf	ACC0, f
	swapf	ACC2, w
	movwf	ACC2
	andlw	0xF0
	xorwf	ACC2, f
	iorwf	ACC1, f
	skpnc
	bsf	ACC2, 4


; Generated by www.piclist.com/cgi-bin/constdivmul.exe (1-May-2002 version)
; Tue Dec 22 22:28:55 2009 GMT
