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

;--------------------------------------------------------
	.module sincosf
	.optsdcc -mmcs51 --model-small
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _sincosf
	.globl _sincosf_PARM_2
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; special function bits 
;--------------------------------------------------------
;--------------------------------------------------------
; overlayable register banks 
;--------------------------------------------------------
	.area REG_BANK_0	(REL,OVR,DATA)
	.ds 8
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
	.area DSEG    (DATA)
_sincosf_PARM_2::
	.ds 2
_sincosf_x_1_1::
	.ds 4
_sincosf_f_1_1::
	.ds 4
_sincosf_XN_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)
_sincosf_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 'sincosf'
;------------------------------------------------------------
;iscos                     Allocated with name '_sincosf_PARM_2'
;x                         Allocated with name '_sincosf_x_1_1'
;y                         Allocated to registers r6 r7 r0 r1 
;f                         Allocated with name '_sincosf_f_1_1'
;r                         Allocated to registers r2 r3 r4 r5 
;g                         Allocated to registers r6 r7 r0 r1 
;XN                        Allocated with name '_sincosf_XN_1_1'
;N                         Allocated to registers r2 r3 
;------------------------------------------------------------
;sincosf.c:39: float sincosf(const float x, const int iscos)
;	-----------------------------------------
;	 function sincosf
;	-----------------------------------------
_sincosf:
	ar2 = 0x02
	ar3 = 0x03
	ar4 = 0x04
	ar5 = 0x05
	ar6 = 0x06
	ar7 = 0x07
	ar0 = 0x00
	ar1 = 0x01
;     genReceive
	mov	_sincosf_x_1_1,dpl
	mov	(_sincosf_x_1_1 + 1),dph
	mov	(_sincosf_x_1_1 + 2),b
	mov	(_sincosf_x_1_1 + 3),a
;sincosf.c:49: if(iscos)
;     genIfx
	mov	a,_sincosf_PARM_2
	orl	a,(_sincosf_PARM_2 + 1)
;     genIfxJump
;       Peephole 110    removed ljmp by inverse jump logic
	jz      00105$
00126$:
;sincosf.c:51: y=fabsf(x)+HALF_PI;
;     genCall
	mov	dpl,_sincosf_x_1_1
	mov	dph,(_sincosf_x_1_1 + 1)
	mov	b,(_sincosf_x_1_1 + 2)
	mov	a,(_sincosf_x_1_1 + 3)
	lcall	_fabsf
;     genAssign
;     genCall
	mov     r6,dpl
	mov     r7,dph
	mov     r0,b
	mov     r1,a
	mov     ___fsadd_PARM_2,#0xDB
	mov     (___fsadd_PARM_2 + 1),#0x0F
	mov     (___fsadd_PARM_2 + 2),#0xC9
	mov     (___fsadd_PARM_2 + 3),#0x3F
;       Peephole 238.a  removed 4 redundant moves
	lcall	___fsadd
	mov	r6,dpl
	mov	r7,dph
	mov	r0,b
	mov	r1,a
;sincosf.c:52: sign=0;
;     genAssign
	clr	_sincosf_sign_1_1
;       Peephole 112.b  changed ljmp to sjmp
	sjmp    00106$
00105$:
;sincosf.c:56: if(x<0.0)
;     genAssign
	mov	___fslt_PARM_2,#0x00
	mov	(___fslt_PARM_2 + 1),#0x00
	mov	(___fslt_PARM_2 + 2),#0x00
	mov	(___fslt_PARM_2 + 3),#0x00
;     genCall
	mov	dpl,_sincosf_x_1_1
	mov	dph,(_sincosf_x_1_1 + 1)
	mov	b,(_sincosf_x_1_1 + 2)
	mov	a,(_sincosf_x_1_1 + 3)
	lcall	___fslt
	mov	a,dpl
;     genIfx
;     genIfxJump
;       Peephole 110    removed ljmp by inverse jump logic
	jz      00102$
00127$:
;sincosf.c:57: { y=-x; sign=1; }
;     genUminus
;     genUminusFloat
	mov	r6,_sincosf_x_1_1
	mov	r7,(_sincosf_x_1_1 + 1)
	mov	r0,(_sincosf_x_1_1 + 2)
	mov	a,(_sincosf_x_1_1 + 3)
	cpl	acc.7
	mov	r1,a
;     genAssign
	setb	_sincosf_sign_1_1
;       Peephole 112.b  changed ljmp to sjmp
	sjmp    00106$
00102$:
;sincosf.c:59: { y=x; sign=0; }
;     genAssign
	mov	r6,_sincosf_x_1_1
	mov	r7,(_sincosf_x_1_1 + 1)
	mov	r0,(_sincosf_x_1_1 + 2)
	mov	r1,(_sincosf_x_1_1 + 3)
;     genAssign
	clr	_sincosf_sign_1_1
00106$:
;sincosf.c:62: if(y>YMAX)
;     genAssign
	mov	___fsgt_PARM_2,#0x00
	mov	(___fsgt_PARM_2 + 1),#0x0C
	mov	(___fsgt_PARM_2 + 2),#0x49
	mov	(___fsgt_PARM_2 + 3),#0x46
;     genCall
	mov	dpl,r6
	mov	dph,r7
	mov	b,r0
	mov	a,r1
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fsgt
	mov	a,dpl
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genIfx
;     genIfxJump
;       Peephole 110    removed ljmp by inverse jump logic
	jz      00108$
00128$:
;sincosf.c:64: errno=ERANGE;
;     genAssign
	clr	a
	mov	(_errno + 1),a
	mov	_errno,#0x22
;sincosf.c:65: 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
00108$:
;sincosf.c:69: N=((y*iPI)+0.5); /*y is positive*/
;     genAssign
	mov	___fsmul_PARM_2,#0x83
	mov	(___fsmul_PARM_2 + 1),#0xF9
	mov	(___fsmul_PARM_2 + 2),#0xA2
	mov	(___fsmul_PARM_2 + 3),#0x3E
;     genCall
	mov	dpl,r6
	mov	dph,r7
	mov	b,r0
	mov	a,r1
	lcall	___fsmul
;     genAssign
;     genCall
	mov     r2,dpl
	mov     r3,dph
	mov     r4,b
	mov     r5,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
;     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
	lcall	___fs2sint
	mov	r2,dpl
	mov	r3,dph
;sincosf.c:72: if(N&1) sign=~sign;
;     genAnd
	mov	a,r2
;     genIfxJump
;       Peephole 111    removed ljmp by inverse jump logic
	jnb     acc.0,00110$
00129$:
;     genCpl
;       Peephole 167    removed redundant bit moves (c not set to _sincosf_sign_1_1)
	cpl     _sincosf_sign_1_1
00110$:
;sincosf.c:74: XN=N;
;     genCall
	mov	dpl,r2
	mov	dph,r3
	lcall	___sint2fs
	mov	_sincosf_XN_1_1,dpl
	mov	(_sincosf_XN_1_1 + 1),dph
	mov	(_sincosf_XN_1_1 + 2),b
	mov	(_sincosf_XN_1_1 + 3),a
;sincosf.c:76: if(iscos) XN-=0.5;
;     genIfx
	mov	a,_sincosf_PARM_2
	orl	a,(_sincosf_PARM_2 + 1)
;     genIfxJump
;       Peephole 110    removed ljmp by inverse jump logic
	jz      00112$
00130$:
;     genAssign
	mov	___fssub_PARM_2,#0x00
	mov	(___fssub_PARM_2 + 1),#0x00
	mov	(___fssub_PARM_2 + 2),#0x00
	mov	(___fssub_PARM_2 + 3),#0x3F
;     genCall
	mov	dpl,_sincosf_XN_1_1
	mov	dph,(_sincosf_XN_1_1 + 1)
	mov	b,(_sincosf_XN_1_1 + 2)
	mov	a,(_sincosf_XN_1_1 + 3)
	lcall	___fssub
	mov	_sincosf_XN_1_1,dpl
	mov	(_sincosf_XN_1_1 + 1),dph
	mov	(_sincosf_XN_1_1 + 2),b
	mov	(_sincosf_XN_1_1 + 3),a
00112$:
;sincosf.c:78: y=fabsf(x);
;     genCall
	mov	dpl,_sincosf_x_1_1
	mov	dph,(_sincosf_x_1_1 + 1)
	mov	b,(_sincosf_x_1_1 + 2)
	mov	a,(_sincosf_x_1_1 + 3)
	lcall	_fabsf
;sincosf.c:79: r=(int)y;
;     genCall
;       Peephole 191    removed redundant mov
	mov     r6,dpl
	mov     r7,dph
	mov     r0,b
	mov     r1,a
;       Peephole 238.b  removed 3 redundant moves
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fs2sint
	mov	r2,dpl
	mov	r3,dph
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genCall
	mov	dpl,r2
	mov	dph,r3
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___sint2fs
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;sincosf.c:80: g=y-r;
;     genAssign
	mov	___fssub_PARM_2,r2
	mov	(___fssub_PARM_2 + 1),r3
	mov	(___fssub_PARM_2 + 2),r4
	mov	(___fssub_PARM_2 + 3),r5
;     genCall
	mov	dpl,r6
	mov	dph,r7
	mov	b,r0
	mov	a,r1
	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
;sincosf.c:81: f=((r-XN*C1)+g)-XN*C2;
;     genAssign
	mov	___fsmul_PARM_2,#0x00
	mov	(___fsmul_PARM_2 + 1),#0x00
	mov	(___fsmul_PARM_2 + 2),#0x49
	mov	(___fsmul_PARM_2 + 3),#0x40
;     genCall
	mov	dpl,_sincosf_XN_1_1
	mov	dph,(_sincosf_XN_1_1 + 1)
	mov	b,(_sincosf_XN_1_1 + 2)
	mov	a,(_sincosf_XN_1_1 + 3)
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	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
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fssub
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genAssign
	mov	___fsadd_PARM_2,r6
	mov	(___fsadd_PARM_2 + 1),r7
	mov	(___fsadd_PARM_2 + 2),r0
	mov	(___fsadd_PARM_2 + 3),r1
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	lcall	___fsadd
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
;     genAssign
	mov	___fsmul_PARM_2,#0x22
	mov	(___fsmul_PARM_2 + 1),#0xAA
	mov	(___fsmul_PARM_2 + 2),#0x7D
	mov	(___fsmul_PARM_2 + 3),#0x3A
;     genCall
	mov	dpl,_sincosf_XN_1_1
	mov	dph,(_sincosf_XN_1_1 + 1)
	mov	b,(_sincosf_XN_1_1 + 2)
	mov	a,(_sincosf_XN_1_1 + 3)
	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,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	lcall	___fssub
;sincosf.c:83: g=f*f;
;     genAssign
;     genCall
	mov     _sincosf_f_1_1,dpl
	mov     (_sincosf_f_1_1 + 1),dph
	mov     (_sincosf_f_1_1 + 2),b
	mov     (_sincosf_f_1_1 + 3),a
	mov     ___fsmul_PARM_2,_sincosf_f_1_1
	mov     (___fsmul_PARM_2 + 1),(_sincosf_f_1_1 + 1)
	mov     (___fsmul_PARM_2 + 2),(_sincosf_f_1_1 + 2)
	mov     (___fsmul_PARM_2 + 3),(_sincosf_f_1_1 + 3)
;       Peephole 238.a  removed 4 redundant moves
	lcall	___fsmul
;sincosf.c:84: if(g>EPS2) //Used to be if(fabsf(f)>EPS)
;     genAssign
;     genCall
	mov     r6,dpl
	mov     r7,dph
	mov     r0,b
	mov     r1,a
	mov     ___fsgt_PARM_2,#0xF3
	mov     (___fsgt_PARM_2 + 1),#0xFF
	mov     (___fsgt_PARM_2 + 2),#0x7F
	mov     (___fsgt_PARM_2 + 3),#0x33
;       Peephole 238.a  removed 4 redundant moves
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fsgt
	mov	a,dpl
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genIfx
;     genIfxJump
	jnz	00131$
	ljmp	00114$
00131$:
;sincosf.c:86: r=(((r4*g+r3)*g+r2)*g+r1)*g;
;     genAssign
	mov	___fsmul_PARM_2,#0x5B
	mov	(___fsmul_PARM_2 + 1),#0x9C
	mov	(___fsmul_PARM_2 + 2),#0x2E
	mov	(___fsmul_PARM_2 + 3),#0x36
;     genCall
	mov	dpl,r6
	mov	dph,r7
	mov	b,r0
	mov	a,r1
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fsmul
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genAssign
	mov	___fsadd_PARM_2,#0x22
	mov	(___fsadd_PARM_2 + 1),#0xB2
	mov	(___fsadd_PARM_2 + 2),#0x4F
	mov	(___fsadd_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	___fsadd
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genAssign
	mov	___fsmul_PARM_2,r6
	mov	(___fsmul_PARM_2 + 1),r7
	mov	(___fsmul_PARM_2 + 2),r0
	mov	(___fsmul_PARM_2 + 3),r1
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fsmul
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genAssign
	mov	___fsadd_PARM_2,#0x3E
	mov	(___fsadd_PARM_2 + 1),#0x87
	mov	(___fsadd_PARM_2 + 2),#0x08
	mov	(___fsadd_PARM_2 + 3),#0x3C
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fsadd
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genAssign
	mov	___fsmul_PARM_2,r6
	mov	(___fsmul_PARM_2 + 1),r7
	mov	(___fsmul_PARM_2 + 2),r0
	mov	(___fsmul_PARM_2 + 3),r1
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fsmul
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genAssign
	mov	___fsadd_PARM_2,#0xA4
	mov	(___fsadd_PARM_2 + 1),#0xAA
	mov	(___fsadd_PARM_2 + 2),#0x2A
	mov	(___fsadd_PARM_2 + 3),#0xBE
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	___fsadd
	mov	r2,dpl
	mov	r3,dph
	mov	r4,b
	mov	r5,a
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
;     genAssign
	mov	___fsmul_PARM_2,r6
	mov	(___fsmul_PARM_2 + 1),r7
	mov	(___fsmul_PARM_2 + 2),r0
	mov	(___fsmul_PARM_2 + 3),r1
;     genCall
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
	lcall	___fsmul
	mov	___fsmul_PARM_2,dpl
	mov	(___fsmul_PARM_2 + 1),dph
	mov	(___fsmul_PARM_2 + 2),b
	mov	(___fsmul_PARM_2 + 3),a
;sincosf.c:87: f+=f*r;
;     genCall
	mov	dpl,_sincosf_f_1_1
	mov	dph,(_sincosf_f_1_1 + 1)
	mov	b,(_sincosf_f_1_1 + 2)
	mov	a,(_sincosf_f_1_1 + 3)
	lcall	___fsmul
	mov	___fsadd_PARM_2,dpl
	mov	(___fsadd_PARM_2 + 1),dph
	mov	(___fsadd_PARM_2 + 2),b
	mov	(___fsadd_PARM_2 + 3),a
;     genCall
	mov	dpl,_sincosf_f_1_1
	mov	dph,(_sincosf_f_1_1 + 1)
	mov	b,(_sincosf_f_1_1 + 2)
	mov	a,(_sincosf_f_1_1 + 3)
	lcall	___fsadd
	mov	_sincosf_f_1_1,dpl
	mov	(_sincosf_f_1_1 + 1),dph
	mov	(_sincosf_f_1_1 + 2),b
	mov	(_sincosf_f_1_1 + 3),a
00114$:
;sincosf.c:89: return (sign?-f:f);
;     genIfx
;     genIfxJump
;       Peephole 111    removed ljmp by inverse jump logic
	jnb     _sincosf_sign_1_1,00117$
00132$:
;     genUminus
;     genUminusFloat
	mov	r2,_sincosf_f_1_1
	mov	r3,(_sincosf_f_1_1 + 1)
	mov	r4,(_sincosf_f_1_1 + 2)
	mov	a,(_sincosf_f_1_1 + 3)
	cpl	acc.7
	mov	r5,a
;       Peephole 112.b  changed ljmp to sjmp
	sjmp    00118$
00117$:
;     genAssign
	mov	r2,_sincosf_f_1_1
	mov	r3,(_sincosf_f_1_1 + 1)
	mov	r4,(_sincosf_f_1_1 + 2)
	mov	r5,(_sincosf_f_1_1 + 3)
00118$:
;     genRet
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	mov	a,r5
00115$:
	ret
	.area CSEG    (CODE)
	.area XINIT   (CODE)
