;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.5.0 #1020 (Mar  4 2006)
; This file generated Sat Mar  4 14:59:51 2006
;--------------------------------------------------------
	.module _itoa
	.optsdcc -mmcs51 --model-large
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl __itoa
	.globl __uitoa
	.globl __itoa_PARM_3
	.globl __itoa_PARM_2
	.globl __uitoa_PARM_3
	.globl __uitoa_PARM_2
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
	.area RSEG    (DATA)
;--------------------------------------------------------
; special function bits 
;--------------------------------------------------------
	.area RSEG    (DATA)
;--------------------------------------------------------
; overlayable register banks 
;--------------------------------------------------------
	.area REG_BANK_0	(REL,OVR,DATA)
	.ds 8
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
	.area DSEG    (DATA)
__uitoa_sloc0_1_0::
	.ds 2
__uitoa_sloc1_1_0::
	.ds 3
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
	.area OSEG    (OVR,DATA)
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
	.area ISEG    (DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
	.area BSEG    (BIT)
;--------------------------------------------------------
; paged external ram data
;--------------------------------------------------------
	.area PSEG    (PAG,XDATA)
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
	.area XSEG    (XDATA)
__uitoa_PARM_2::
	.ds 3
__uitoa_PARM_3::
	.ds 1
__uitoa_value_1_1::
	.ds 2
__itoa_PARM_2::
	.ds 3
__itoa_PARM_3::
	.ds 1
__itoa_value_1_1::
	.ds 2
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG   (XDATA)
	.area CSEG    (CODE)
	.area GSINIT0 (CODE)
	.area GSINIT1 (CODE)
	.area GSINIT2 (CODE)
	.area GSINIT3 (CODE)
	.area GSINIT4 (CODE)
	.area GSINIT5 (CODE)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area CSEG    (CODE)
	.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 '_uitoa'
;------------------------------------------------------------
;sloc0                     Allocated with name '__uitoa_sloc0_1_0'
;sloc1                     Allocated with name '__uitoa_sloc1_1_0'
;string                    Allocated with name '__uitoa_PARM_2'
;radix                     Allocated with name '__uitoa_PARM_3'
;value                     Allocated with name '__uitoa_value_1_1'
;index                     Allocated with name '__uitoa_index_1_1'
;i                         Allocated with name '__uitoa_i_1_1'
;------------------------------------------------------------
;_itoa.c:18: void _uitoa(unsigned int value, char* string, unsigned char radix)
;	-----------------------------------------
;	 function _uitoa
;	-----------------------------------------
__uitoa:
	ar2 = 0x02
	ar3 = 0x03
	ar4 = 0x04
	ar5 = 0x05
	ar6 = 0x06
	ar7 = 0x07
	ar0 = 0x00
	ar1 = 0x01
;     genReceive
	mov	r2,dph
	mov	a,dpl
	mov	dptr,#__uitoa_value_1_1
	movx	@dptr,a
	inc	dptr
	mov	a,r2
	movx	@dptr,a
;_itoa.c:26: do {
;     genAssign
	mov	dptr,#__uitoa_PARM_2
	movx	a,@dptr
	mov	r2,a
	inc	dptr
	movx	a,@dptr
	mov	r3,a
	inc	dptr
	movx	a,@dptr
	mov	r4,a
;     genAssign
	mov	dptr,#__uitoa_PARM_3
	movx	a,@dptr
	mov	r5,a
;     genAssign
	mov	r6,#0x10
00103$:
;_itoa.c:27: string[--index] = '0' + (value % radix);
;     genMinus
;     genMinusDec
	dec	r6
;     genPlus
;	Peephole 236.g	used r6 instead of ar6
	mov	a,r6
;	Peephole 236.a	used r2 instead of ar2
	add	a,r2
	mov	r7,a
;	Peephole 181	changed mov to clr
	clr	a
;	Peephole 236.b	used r3 instead of ar3
	addc	a,r3
	mov	r0,a
	mov	ar1,r4
;     genIpush
	push	ar2
	push	ar3
	push	ar4
;     genAssign
	mov	dptr,#__uitoa_value_1_1
	movx	a,@dptr
	mov	r2,a
	inc	dptr
	movx	a,@dptr
	mov	r3,a
;     genCast
	mov	__uitoa_sloc0_1_0,r5
	mov	(__uitoa_sloc0_1_0 + 1),#0x00
;     genAssign
	mov	dptr,#__moduint_PARM_2
	mov	a,__uitoa_sloc0_1_0
	movx	@dptr,a
	inc	dptr
	mov	a,(__uitoa_sloc0_1_0 + 1)
	movx	@dptr,a
;     genCall
	mov	dpl,r2
	mov	dph,r3
	push	ar4
	push	ar5
	push	ar6
	push	ar7
	push	ar0
	push	ar1
	lcall	__moduint
	mov	r2,dpl
	mov	r3,dph
	pop	ar1
	pop	ar0
	pop	ar7
	pop	ar6
	pop	ar5
	pop	ar4
;     genCast
;     genPlus
	mov	a,#0x30
;	Peephole 236.a	used r2 instead of ar2
	add	a,r2
;     genPointerSet
;     genGenPointerSet
;	Peephole 191	removed redundant mov
	mov	r2,a
	mov	dpl,r7
	mov	dph,r0
	mov	b,r1
	lcall	__gptrput
;_itoa.c:28: if ( string[index] > '9') string[index] += 'A' - '9' - 1;
;     genCmpGt
;     genCmp
	clr	c
	mov	a,#0x39
	subb	a,r2
	clr	a
	rlc	a
;     genIpop
	pop	ar4
	pop	ar3
	pop	ar2
;     genIfx
;     genIfxJump
;	Peephole 110	removed ljmp by inverse jump logic
	jz	00102$
00115$:
;     genIpush
	push	ar5
;     genPointerGet
;     genGenPointerGet
	mov	dpl,r7
	mov	dph,r0
	mov	b,r1
	lcall	__gptrget
	mov	r5,a
;     genPlus
	mov	a,#0x07
;	Peephole 236.a	used r5 instead of ar5
	add	a,r5
;     genPointerSet
;     genGenPointerSet
;	Peephole 191	removed redundant mov
	mov	r5,a
	mov	dpl,r7
	mov	dph,r0
	mov	b,r1
	lcall	__gptrput
;_itoa.c:36: string[i] = 0; /* string terminator */
;     genIpop
	pop	ar5
;_itoa.c:28: if ( string[index] > '9') string[index] += 'A' - '9' - 1;
00102$:
;_itoa.c:29: value /= radix;
;     genAssign
	mov	dptr,#__uitoa_value_1_1
	movx	a,@dptr
	mov	r7,a
	inc	dptr
	movx	a,@dptr
	mov	r0,a
;     genAssign
	mov	dptr,#__divuint_PARM_2
	mov	a,__uitoa_sloc0_1_0
	movx	@dptr,a
	inc	dptr
	mov	a,(__uitoa_sloc0_1_0 + 1)
	movx	@dptr,a
;     genCall
	mov	dpl,r7
	mov	dph,r0
	push	ar2
	push	ar3
	push	ar4
	push	ar5
	push	ar6
	lcall	__divuint
	mov	a,dpl
	mov	b,dph
	pop	ar6
	pop	ar5
	pop	ar4
	pop	ar3
	pop	ar2
;     genAssign
	mov	dptr,#__uitoa_value_1_1
	movx	@dptr,a
	inc	dptr
	mov	a,b
	movx	@dptr,a
;_itoa.c:30: } while (value != 0);
;     genAssign
	mov	dptr,#__uitoa_value_1_1
	movx	a,@dptr
	mov	r7,a
	inc	dptr
	movx	a,@dptr
	mov	r0,a
;     genCmpEq
	cjne	r7,#0x00,00116$
	cjne	r0,#0x00,00116$
	sjmp	00117$
00116$:
	ljmp	00103$
00117$:
;_itoa.c:32: do {
;     genAssign
	mov	r5,#0x00
;     genAssign
00106$:
;_itoa.c:33: string[i++] = string[index++];
;     genAssign
	mov	ar7,r5
;     genPlus
;     genPlusIncr
	inc	r5
;     genPlus
;	Peephole 236.g	used r7 instead of ar7
	mov	a,r7
;	Peephole 236.a	used r2 instead of ar2
	add	a,r2
	mov	__uitoa_sloc1_1_0,a
;	Peephole 181	changed mov to clr
	clr	a
;	Peephole 236.b	used r3 instead of ar3
	addc	a,r3
	mov	(__uitoa_sloc1_1_0 + 1),a
	mov	(__uitoa_sloc1_1_0 + 2),r4
;     genAssign
	mov	ar7,r6
;     genPlus
;     genPlusIncr
	inc	r6
;     genPlus
;	Peephole 236.g	used r7 instead of ar7
	mov	a,r7
;	Peephole 236.a	used r2 instead of ar2
	add	a,r2
	mov	r7,a
;	Peephole 181	changed mov to clr
	clr	a
;	Peephole 236.b	used r3 instead of ar3
	addc	a,r3
	mov	r0,a
	mov	ar1,r4
;     genPointerGet
;     genGenPointerGet
	mov	dpl,r7
	mov	dph,r0
	mov	b,r1
	lcall	__gptrget
;     genPointerSet
;     genGenPointerSet
;	Peephole 191	removed redundant mov
	mov	r7,a
	mov	dpl,__uitoa_sloc1_1_0
	mov	dph,(__uitoa_sloc1_1_0 + 1)
	mov	b,(__uitoa_sloc1_1_0 + 2)
	lcall	__gptrput
;_itoa.c:34: } while ( index < NUMBER_OF_DIGITS );
;     genCmpLt
;     genCmp
	cjne	r6,#0x10,00118$
00118$:
;     genIfxJump
;	Peephole 112.b	changed ljmp to sjmp
;	Peephole 160	removed sjmp by inverse jump logic
	jc	00106$
00119$:
;_itoa.c:36: string[i] = 0; /* string terminator */
;     genPlus
;	Peephole 236.g	used r5 instead of ar5
	mov	a,r5
;	Peephole 236.a	used r2 instead of ar2
	add	a,r2
	mov	r2,a
;	Peephole 181	changed mov to clr
	clr	a
;	Peephole 236.b	used r3 instead of ar3
	addc	a,r3
	mov	r3,a
;     genPointerSet
;     genGenPointerSet
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
;	Peephole 181	changed mov to clr
	clr	a
;	Peephole 253.b	replaced lcall/ret with ljmp
	ljmp	__gptrput
;------------------------------------------------------------
;Allocation info for local variables in function '_itoa'
;------------------------------------------------------------
;string                    Allocated with name '__itoa_PARM_2'
;radix                     Allocated with name '__itoa_PARM_3'
;value                     Allocated with name '__itoa_value_1_1'
;------------------------------------------------------------
;_itoa.c:39: void _itoa(int value, char* string, unsigned char radix)
;	-----------------------------------------
;	 function _itoa
;	-----------------------------------------
__itoa:
;     genReceive
	mov	r2,dph
	mov	a,dpl
	mov	dptr,#__itoa_value_1_1
	movx	@dptr,a
	inc	dptr
	mov	a,r2
	movx	@dptr,a
;_itoa.c:41: if (value < 0 && radix == 10) {
;     genAssign
	mov	dptr,#__itoa_value_1_1
	movx	a,@dptr
	mov	r2,a
	inc	dptr
	movx	a,@dptr
;     genCmpLt
;     genCmp
;	Peephole 105	removed redundant mov
	mov	r3,a
;     genIfxJump
;	Peephole 111	removed ljmp by inverse jump logic
	jnb	acc.7,00102$
00109$:
;     genAssign
	mov	dptr,#__itoa_PARM_3
	movx	a,@dptr
	mov	r4,a
;     genCmpEq
;	Peephole 112.b	changed ljmp to sjmp
;	Peephole 199	optimized misc jump sequence
	cjne	r4,#0x0A,00102$
;00110$:
;	Peephole 200	removed redundant sjmp
00111$:
;_itoa.c:42: *string++ = '-';
;     genAssign
	mov	dptr,#__itoa_PARM_2
	movx	a,@dptr
	mov	r5,a
	inc	dptr
	movx	a,@dptr
	mov	r6,a
	inc	dptr
	movx	a,@dptr
	mov	r7,a
;     genPointerSet
;     genGenPointerSet
	mov	dpl,r5
	mov	dph,r6
	mov	b,r7
	mov	a,#0x2D
	lcall	__gptrput
;     genPlus
	mov	dptr,#__itoa_PARM_2
;     genPlusIncr
	mov	a,#0x01
;	Peephole 236.a	used r5 instead of ar5
	add	a,r5
	movx	@dptr,a
;	Peephole 181	changed mov to clr
	clr	a
;	Peephole 236.b	used r6 instead of ar6
	addc	a,r6
	inc	dptr
	movx	@dptr,a
	inc	dptr
	mov	a,r7
	movx	@dptr,a
;_itoa.c:43: _uitoa(-value, string, radix);
;     genUminus
	clr	c
	clr	a
	subb	a,r2
	mov	r2,a
	clr	a
	subb	a,r3
	mov	r3,a
;     genAssign
	mov	dptr,#__itoa_PARM_2
	movx	a,@dptr
	mov	r5,a
	inc	dptr
	movx	a,@dptr
	mov	r6,a
	inc	dptr
	movx	a,@dptr
	mov	r7,a
;     genAssign
	mov	dptr,#__uitoa_PARM_2
	mov	a,r5
	movx	@dptr,a
	inc	dptr
	mov	a,r6
	movx	@dptr,a
	inc	dptr
	mov	a,r7
	movx	@dptr,a
;     genAssign
	mov	dptr,#__uitoa_PARM_3
	mov	a,r4
	movx	@dptr,a
;     genCall
	mov	dpl,r2
	mov	dph,r3
;	Peephole 112.b	changed ljmp to sjmp
;	Peephole 251.b	replaced sjmp to ret with ret
;	Peephole 253.a	replaced lcall/ret with ljmp
	ljmp	__uitoa
00102$:
;_itoa.c:46: _uitoa(value, string, radix);
;     genAssign
	mov	dptr,#__itoa_value_1_1
	movx	a,@dptr
	mov	r2,a
	inc	dptr
	movx	a,@dptr
	mov	r3,a
;     genAssign
	mov	dptr,#__itoa_PARM_2
	movx	a,@dptr
	mov	r4,a
	inc	dptr
	movx	a,@dptr
	mov	r5,a
	inc	dptr
	movx	a,@dptr
	mov	r6,a
;     genAssign
	mov	dptr,#__itoa_PARM_3
	movx	a,@dptr
	mov	r7,a
;     genAssign
	mov	dptr,#__uitoa_PARM_2
	mov	a,r4
	movx	@dptr,a
	inc	dptr
	mov	a,r5
	movx	@dptr,a
	inc	dptr
	mov	a,r6
	movx	@dptr,a
;     genAssign
	mov	dptr,#__uitoa_PARM_3
	mov	a,r7
	movx	@dptr,a
;     genCall
	mov	dpl,r2
	mov	dph,r3
;	Peephole 253.c	replaced lcall with ljmp
	ljmp	__uitoa
00105$:
	ret
	.area CSEG    (CODE)
	.area XINIT   (CODE)
