;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.4.0 Tue Oct 12 01:18:37 2004

;--------------------------------------------------------
	.module expf
	.optsdcc -mmcs51 --model-small
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _expf
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; special function bits 
;--------------------------------------------------------
;--------------------------------------------------------
; overlayable register banks 
;--------------------------------------------------------
	.area REG_BANK_0	(REL,OVR,DATA)
	.ds 8
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
	.area DSEG    (DATA)
_expf_n_1_1::
	.ds 2
_expf_g_1_1::
	.ds 4
_expf_r_1_1::
	.ds 4
_expf_y_1_1::
	.ds 4
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
	.area OSEG    (OVR,DATA)
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
	.area ISEG    (DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
	.area BSEG    (BIT)
_expf_sign_1_1::
	.ds 1
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
	.area XSEG    (XDATA)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG   (XDATA)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area GSINIT  (CODE)
	.area GSFINAL (CODE)
	.area GSINIT  (CODE)
;--------------------------------------------------------
; Home
;--------------------------------------------------------
	.area HOME    (CODE)
	.area CSEG    (CODE)
;--------------------------------------------------------
; code
;--------------------------------------------------------
	.area CSEG    (CODE)
;------------------------------------------------------------
;Allocation info for local variables in function 'expf'
;------------------------------------------------------------
;x                         Allocated to registers r2 r3 r4 r5 
;n                         Allocated with name '_expf_n_1_1'
;xn                        Allocated to registers r2 r3 r4 r5 
;g                         Allocated with name '_expf_g_1_1'
;r                         Allocated with name '_expf_r_1_1'
;z                         Allocated to registers r2 r3 r4 r5 
;y                         Allocated with name '_expf_y_1_1'
;------------------------------------------------------------
;expf.c:42: float expf(const float x)
;	-----------------------------------------
;	 function expf
;	-----------------------------------------
_expf:
	ar2 = 0x02
	ar3 = 0x03
	ar4 = 0x04
	ar5 = 0x05
	ar6 = 0x06
	ar7 = 0x07
	ar0 = 0x00
	ar1 = 0x01
;     genReceive
;expf.c:52: if(x>=0.0)
;     genAssign
;     genCall
	mov     r2,dpl
	mov     r3,dph
	mov     r4,b
	mov     r5,a
	mov     ___fslt_PARM_2,#0x00
	mov     (___fslt_PARM_2 + 1),#0x00
	mov     (___fslt_PARM_2 + 2),#0x00
	mov     (___fslt_PARM_2 + 3),#0x00
;       Peephole 238.a  removed 4 redundant moves
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	lcall	___fslt
	mov	a,dpl
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;     genIfx
;     genIfxJump
;       Peephole 109    removed ljmp by inverse jump logic
	jnz     00102$
00127$:
;expf.c:53: { y=x;  sign=0; }
;     genAssign
	mov	_expf_y_1_1,r2
	mov	(_expf_y_1_1 + 1),r3
	mov	(_expf_y_1_1 + 2),r4
	mov	(_expf_y_1_1 + 3),r5
;     genAssign
	clr	_expf_sign_1_1
;       Peephole 112.b  changed ljmp to sjmp
	sjmp    00103$
00102$:
;expf.c:55: { y=-x; sign=1; }
;     genUminus
;     genUminusFloat
	mov	_expf_y_1_1,r2
	mov	(_expf_y_1_1 + 1),r3
	mov	(_expf_y_1_1 + 2),r4
	mov	a,r5
	cpl	acc.7
	mov	(_expf_y_1_1 + 3),a
;     genAssign
	setb	_expf_sign_1_1
00103$:
;expf.c:57: if(y<EXPEPS) return 1.0;
;     genAssign
	mov	___fslt_PARM_2,#0x95
	mov	(___fslt_PARM_2 + 1),#0xBF
	mov	(___fslt_PARM_2 + 2),#0xD6
	mov	(___fslt_PARM_2 + 3),#0x33
;     genCall
	mov	dpl,_expf_y_1_1
	mov	dph,(_expf_y_1_1 + 1)
	mov	b,(_expf_y_1_1 + 2)
	mov	a,(_expf_y_1_1 + 3)
	lcall	___fslt
	mov	a,dpl
;     genIfx
;     genIfxJump
;       Peephole 110    removed ljmp by inverse jump logic
	jz      00105$
00128$:
;     genRet
;       Peephole 182.b  used 16 bit load of dptr
	mov     dptr,#0x0000
	mov	b,#0x80
	mov	a,#0x3F
;       Peephole 251    replaced ljmp to ret with ret
	ret
00105$:
;expf.c:59: if(y>BIGX)
;     genAssign
	mov	___fsgt_PARM_2,#0x18
	mov	(___fsgt_PARM_2 + 1),#0x72
	mov	(___fsgt_PARM_2 + 2),#0xB1
	mov	(___fsgt_PARM_2 + 3),#0x42
;     genCall
	mov	dpl,_expf_y_1_1
	mov	dph,(_expf_y_1_1 + 1)
	mov	b,(_expf_y_1_1 + 2)
	mov	a,(_expf_y_1_1 + 3)
	lcall	___fsgt
	mov	a,dpl
;     genIfx
;     genIfxJump
;       Peephole 110    removed ljmp by inverse jump logic
	jz      00110$
00129$:
;expf.c:61: if(sign)
;     genIfx
;     genIfxJump
;       Peephole 111    removed ljmp by inverse jump logic
	jnb     _expf_sign_1_1,00107$
00130$:
;expf.c:63: errno=ERANGE;
;     genAssign
	clr	a
	mov	(_errno + 1),a
	mov	_errno,#0x22
;expf.c:64: return XMAX;
;     genRet
;       Peephole 182.b  used 16 bit load of dptr
	mov     dptr,#0xFFFF
	mov	b,#0x7F
	mov	a,#0x7F
;       Peephole 251    replaced ljmp to ret with ret
	ret
00107$:
;expf.c:68: return 0.0;
;     genRet
	mov	dpl,#0x00
;       Peephole 3.a    changed mov to clr
;       Peephole 3.b    changed mov to clr
	clr     a
	mov     dph,a
	mov     b,a
;       Peephole 251    replaced ljmp to ret with ret
	ret
00110$:
;expf.c:72: z=y*K1;
;     genAssign
	mov	___fsmul_PARM_2,#0x3B
	mov	(___fsmul_PARM_2 + 1),#0xAA
	mov	(___fsmul_PARM_2 + 2),#0xB8
	mov	(___fsmul_PARM_2 + 3),#0x3F
;     genCall
	mov	dpl,_expf_y_1_1
	mov	dph,(_expf_y_1_1 + 1)
	mov	b,(_expf_y_1_1 + 2)
	mov	a,(_expf_y_1_1 + 3)
	lcall	___fsmul
;expf.c:73: n=z;
;     genCall
;       Peephole 191    removed redundant mov
	mov     r2,dpl
	mov     r3,dph
	mov     r4,b
	mov     r5,a
;       Peephole 238.b  removed 3 redundant moves
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	lcall	___fs2sint
	mov	_expf_n_1_1,dpl
	mov	(_expf_n_1_1 + 1),dph
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;expf.c:75: if(n<0) --n;
;     genCmpLt
;     genCmp
	mov	a,(_expf_n_1_1 + 1)
;     genIfxJump
;       Peephole 111    removed ljmp by inverse jump logic
	jnb     acc.7,00112$
00131$:
;     genMinus
;     genMinusDec
	dec	_expf_n_1_1
	mov	a,#0xff
	cjne	a,_expf_n_1_1,00132$
	dec	(_expf_n_1_1 + 1)
00132$:
00112$:
;expf.c:76: if(z-n>=0.5) ++n;
;     genCall
	mov	dpl,_expf_n_1_1
	mov	dph,(_expf_n_1_1 + 1)
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	lcall	___sint2fs
	mov	___fssub_PARM_2,dpl
	mov	(___fssub_PARM_2 + 1),dph
	mov	(___fssub_PARM_2 + 2),b
	mov	(___fssub_PARM_2 + 3),a
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	lcall	___fssub
;     genAssign
;     genCall
	mov     r0,dpl
	mov     r1,dph
	mov     r6,b
	mov     r7,a
	mov     ___fslt_PARM_2,#0x00
	mov     (___fslt_PARM_2 + 1),#0x00
	mov     (___fslt_PARM_2 + 2),#0x00
	mov     (___fslt_PARM_2 + 3),#0x3F
;       Peephole 238.a  removed 4 redundant moves
	lcall	___fslt
	mov	a,dpl
;     genIfx
;     genIfxJump
;       Peephole 109    removed ljmp by inverse jump logic
	jnz     00114$
00133$:
;     genPlus
;     genPlusIncr
	inc	_expf_n_1_1
	clr	a
	cjne	a,_expf_n_1_1,00134$
	inc	(_expf_n_1_1 + 1)
00134$:
00114$:
;expf.c:77: xn=n;
;     genCall
	mov	dpl,_expf_n_1_1
	mov	dph,(_expf_n_1_1 + 1)
	lcall	___sint2fs
;expf.c:78: g=((y-xn*C1))-xn*C2;
;     genAssign
;     genCall
	mov     r2,dpl
	mov     r3,dph
	mov     r4,b
	mov     r5,a
	mov     ___fsmul_PARM_2,#0x00
	mov     (___fsmul_PARM_2 + 1),#0x80
	mov     (___fsmul_PARM_2 + 2),#0x31
	mov     (___fsmul_PARM_2 + 3),#0x3F
;       Peephole 238.a  removed 4 redundant moves
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	lcall	___fsmul
	mov	___fssub_PARM_2,dpl
	mov	(___fssub_PARM_2 + 1),dph
	mov	(___fssub_PARM_2 + 2),b
	mov	(___fssub_PARM_2 + 3),a
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;     genCall
	mov	dpl,_expf_y_1_1
	mov	dph,(_expf_y_1_1 + 1)
	mov	b,(_expf_y_1_1 + 2)
	mov	a,(_expf_y_1_1 + 3)
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	lcall	___fssub
	mov	r6,dpl
	mov	r7,dph
	mov	r0,b
	mov	r1,a
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;     genAssign
	mov	___fsmul_PARM_2,#0x83
	mov	(___fsmul_PARM_2 + 1),#0x80
	mov	(___fsmul_PARM_2 + 2),#0x5E
	mov	(___fsmul_PARM_2 + 3),#0xB9
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fsmul
	mov	___fssub_PARM_2,dpl
	mov	(___fssub_PARM_2 + 1),dph
	mov	(___fssub_PARM_2 + 2),b
	mov	(___fssub_PARM_2 + 3),a
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genCall
	mov	dpl,r6
	mov	dph,r7
	mov	b,r0
	mov	a,r1
	lcall	___fssub
;expf.c:79: z=g*g;
;     genAssign
;     genCall
	mov     _expf_g_1_1,dpl
	mov     (_expf_g_1_1 + 1),dph
	mov     (_expf_g_1_1 + 2),b
	mov     (_expf_g_1_1 + 3),a
	mov     ___fsmul_PARM_2,_expf_g_1_1
	mov     (___fsmul_PARM_2 + 1),(_expf_g_1_1 + 1)
	mov     (___fsmul_PARM_2 + 2),(_expf_g_1_1 + 2)
	mov     (___fsmul_PARM_2 + 3),(_expf_g_1_1 + 3)
;       Peephole 238.a  removed 4 redundant moves
	lcall	___fsmul
;expf.c:80: r=P(z)*g;
;     genAssign
;     genCall
	mov     r2,dpl
	mov     r3,dph
	mov     r4,b
	mov     r5,a
	mov     ___fsmul_PARM_2,#0x08
	mov     (___fsmul_PARM_2 + 1),#0x53
	mov     (___fsmul_PARM_2 + 2),#0x88
	mov     (___fsmul_PARM_2 + 3),#0x3B
;       Peephole 238.a  removed 4 redundant moves
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	lcall	___fsmul
	mov	r6,dpl
	mov	r7,dph
	mov	r0,b
	mov	r1,a
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;     genAssign
	mov	___fsadd_PARM_2,#0x00
	mov	(___fsadd_PARM_2 + 1),#0x00
	mov	(___fsadd_PARM_2 + 2),#0x80
	mov	(___fsadd_PARM_2 + 3),#0x3E
;     genCall
	mov	dpl,r6
	mov	dph,r7
	mov	b,r0
	mov	a,r1
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	lcall	___fsadd
	mov	r6,dpl
	mov	r7,dph
	mov	r0,b
	mov	r1,a
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;     genAssign
	mov	___fsmul_PARM_2,_expf_g_1_1
	mov	(___fsmul_PARM_2 + 1),(_expf_g_1_1 + 1)
	mov	(___fsmul_PARM_2 + 2),(_expf_g_1_1 + 2)
	mov	(___fsmul_PARM_2 + 3),(_expf_g_1_1 + 3)
;     genCall
	mov	dpl,r6
	mov	dph,r7
	mov	b,r0
	mov	a,r1
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	lcall	___fsmul
	mov	_expf_r_1_1,dpl
	mov	(_expf_r_1_1 + 1),dph
	mov	(_expf_r_1_1 + 2),b
	mov	(_expf_r_1_1 + 3),a
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;expf.c:81: r=0.5+(r/(Q(z)-r));
;     genAssign
	mov	___fsmul_PARM_2,#0x5B
	mov	(___fsmul_PARM_2 + 1),#0xBF
	mov	(___fsmul_PARM_2 + 2),#0x4C
	mov	(___fsmul_PARM_2 + 3),#0x3D
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	lcall	___fsmul
;     genAssign
;     genCall
	mov     r6,dpl
	mov     r7,dph
	mov     r0,b
	mov     r1,a
	mov     ___fsadd_PARM_2,#0x00
	mov     (___fsadd_PARM_2 + 1),#0x00
	mov     (___fsadd_PARM_2 + 2),#0x00
	mov     (___fsadd_PARM_2 + 3),#0x3F
;       Peephole 238.a  removed 4 redundant moves
	lcall	___fsadd
;     genAssign
;     genCall
	mov     r6,dpl
	mov     r7,dph
	mov     r0,b
	mov     r1,a
	mov     ___fssub_PARM_2,_expf_r_1_1
	mov     (___fssub_PARM_2 + 1),(_expf_r_1_1 + 1)
	mov     (___fssub_PARM_2 + 2),(_expf_r_1_1 + 2)
	mov     (___fssub_PARM_2 + 3),(_expf_r_1_1 + 3)
;       Peephole 238.a  removed 4 redundant moves
	lcall	___fssub
	mov	___fsdiv_PARM_2,dpl
	mov	(___fsdiv_PARM_2 + 1),dph
	mov	(___fsdiv_PARM_2 + 2),b
	mov	(___fsdiv_PARM_2 + 3),a
;     genCall
	mov	dpl,_expf_r_1_1
	mov	dph,(_expf_r_1_1 + 1)
	mov	b,(_expf_r_1_1 + 2)
	mov	a,(_expf_r_1_1 + 3)
	lcall	___fsdiv
;     genAssign
;     genCall
	mov     r6,dpl
	mov     r7,dph
	mov     r0,b
	mov     r1,a
	mov     ___fsadd_PARM_2,#0x00
	mov     (___fsadd_PARM_2 + 1),#0x00
	mov     (___fsadd_PARM_2 + 2),#0x00
	mov     (___fsadd_PARM_2 + 3),#0x3F
;       Peephole 238.a  removed 4 redundant moves
	lcall	___fsadd
	mov	_expf_r_1_1,dpl
	mov	(_expf_r_1_1 + 1),dph
	mov	(_expf_r_1_1 + 2),b
	mov	(_expf_r_1_1 + 3),a
;expf.c:83: n++;
;     genPlus
;     genPlusIncr
	mov	a,#0x01
	add	a,_expf_n_1_1
	mov	_ldexpf_PARM_2,a
;       Peephole 181    changed mov to clr
	clr     a
	addc	a,(_expf_n_1_1 + 1)
	mov	(_ldexpf_PARM_2 + 1),a
;expf.c:84: z=ldexpf(r, n);
;     genCall
	mov	dpl,_expf_r_1_1
	mov	dph,(_expf_r_1_1 + 1)
	mov	b,(_expf_r_1_1 + 2)
	mov	a,(_expf_r_1_1 + 3)
	lcall	_ldexpf
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
;expf.c:85: if(sign)
;     genIfx
;     genIfxJump
;       Peephole 111    removed ljmp by inverse jump logic
	jnb     _expf_sign_1_1,00116$
00135$:
;expf.c:86: return 1.0/z;
;     genAssign
	mov	___fsdiv_PARM_2,r2
	mov	(___fsdiv_PARM_2 + 1),r3
	mov	(___fsdiv_PARM_2 + 2),r4
	mov	(___fsdiv_PARM_2 + 3),r5
;     genCall
;       Peephole 182.b  used 16 bit load of dptr
	mov     dptr,#0x0000
	mov	b,#0x80
	mov	a,#0x3F
	lcall	___fsdiv
;     genRet
;       Peephole 191    removed redundant mov
	mov     r6,dpl
	mov     r7,dph
	mov     r0,b
	mov     r1,a
;       Peephole 238.b  removed 3 redundant moves
;       Peephole 112.b  changed ljmp to sjmp
	sjmp    00118$
00116$:
;expf.c:88: return z;
;     genRet
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
00118$:
	ret
	.area CSEG    (CODE)
	.area XINIT   (CODE)
