;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 2.7.0 #4818 (Mar 17 2010)
; This file generated Wed Mar 17 20:29:22 2010
;--------------------------------------------------------
	.module _itoa
	.optsdcc -mgbz80
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl __itoa
	.globl __uitoa
;--------------------------------------------------------
;  ram data
;--------------------------------------------------------
	.area _DATA
;--------------------------------------------------------
; overlayable items in  ram 
;--------------------------------------------------------
	.area _OVERLAY
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area _HOME
	.area _GSINIT
	.area _GSFINAL
	.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
	.area _HOME
	.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
	.area _CODE
;_itoa.c:18: void _uitoa(unsigned int value, char* string, unsigned char radix)
;	genLabel
;	genFunction
;	---------------------------------
; Function _uitoa
; ---------------------------------
__uitoa_start::
__uitoa:
	lda	sp,-6(sp)
;_itoa.c:26: do {
;	genAssign
;	AOP_STK for __uitoa_index_1_1
	lda	hl,5(sp)
	ld	(hl),#0x10
;	genLabel
00103$:
;_itoa.c:27: string[--index] = '0' + (value % radix);
;	genMinus
;	AOP_STK for __uitoa_index_1_1
	lda	hl,5(sp)
	dec	(hl)
;	genPlus
;	AOP_STK for 
;	AOP_STK for __uitoa_index_1_1
;	AOP_STK for __uitoa_sloc1_1_0
	lda	hl,10(sp)
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	lda	hl,5(sp)
	ld	l,(hl)
	ld	h,#0x00
	add	hl,de
	ld	a,l
	ld	d,h
	lda	hl,0(sp)
	ld	(hl+),a
	ld	(hl),d
;	genCast
;	AOP_STK for 
;	AOP_STK for __uitoa_sloc0_1_0
	lda	hl,12(sp)
	ld	a,(hl)
	lda	hl,2(sp)
	ld	(hl+),a
	ld	(hl),#0x00
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
;	AOP_STK for __uitoa_sloc0_1_0
	dec	hl
	ld	a,(hl+)
	ld	h,(hl)
	ld	l,a
	push	hl
;	genIpush
;	AOP_STK for 
	lda	hl,10(sp)
	ld	a,(hl+)
	ld	h,(hl)
	ld	l,a
	push	hl
;	genCall
	call	__moduint_rrx_s
	ld	b,d
	ld	c,e
	lda	sp,4(sp)
;	genCast
;	genPlus
;	genPlusIncr
	ld	a,c
	add	a,#0x30
;	genAssign (pointer)
;	AOP_STK for __uitoa_sloc1_1_0
;	isBitvar = 0
	lda	hl,0(sp)
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	ld	(de),a
;_itoa.c:28: if ( string[index] > '9') string[index] += 'A' - '9' - 1;
;	genPointerGet
;	AOP_STK for __uitoa_sloc1_1_0
	dec	hl
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	ld	a,(de)
	ld	c,a
;	genCmpGt
	ld	a,#0x39
	sub	a,c
	rlca
	jp	NC,00102$
;	genPointerGet
;	AOP_STK for __uitoa_sloc1_1_0
	dec	hl
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	ld	a,(de)
;	genPlus
;	genPlusIncr
	ld	c,a
	add	a,#0x07
;	genAssign (pointer)
;	AOP_STK for __uitoa_sloc1_1_0
;	isBitvar = 0
	dec	hl
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	ld	(de),a
;	genLabel
00102$:
;_itoa.c:29: value /= radix;
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
;	AOP_STK for __uitoa_sloc0_1_0
	lda	hl,2(sp)
	ld	a,(hl+)
	ld	h,(hl)
	ld	l,a
	push	hl
;	genIpush
;	AOP_STK for 
	lda	hl,10(sp)
	ld	a,(hl+)
	ld	h,(hl)
	ld	l,a
	push	hl
;	genCall
	call	__divuint_rrx_s
	ld	b,d
	ld	c,e
	lda	sp,4(sp)
;	genAssign
;	AOP_STK for 
	lda	hl,8(sp)
	ld	(hl),c
	inc	hl
	ld	(hl),b
;_itoa.c:30: } while (value != 0);
;	genCmpEq
;	AOP_STK for 
; genCmpEq: left 2, right 2, result 0
	dec	hl
	ld	a,(hl+)
	or	a,(hl)
	jp	NZ,00117$
	jr	00118$
00117$:
	jp	00103$
00118$:
;_itoa.c:32: do {
;	genAssign
;	AOP_STK for __uitoa_i_1_1
	lda	hl,4(sp)
	ld	(hl),#0x00
;	genAssign
;	AOP_STK for __uitoa_index_1_1
;	(registers are the same)
;	genLabel
00106$:
;_itoa.c:33: string[i++] = string[index++];
;	genAssign
;	AOP_STK for __uitoa_i_1_1
	lda	hl,4(sp)
	ld	c,(hl)
;	genPlus
;	AOP_STK for __uitoa_i_1_1
;	genPlusIncr
	inc	(hl)
;	genPlus
;	AOP_STK for 
;	AOP_STK for __uitoa_sloc1_1_0
	lda	hl,10(sp)
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	ld	l,c
	ld	h,#0x00
	add	hl,de
	ld	a,l
	ld	d,h
	lda	hl,0(sp)
	ld	(hl+),a
	ld	(hl),d
;	genAssign
;	AOP_STK for __uitoa_index_1_1
	lda	hl,5(sp)
	ld	c,(hl)
;	genPlus
;	AOP_STK for __uitoa_index_1_1
;	genPlusIncr
	inc	(hl)
;	genPlus
;	AOP_STK for 
	lda	hl,10(sp)
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	ld	l,c
	ld	h,#0x00
	add	hl,de
	ld	c,l
	ld	b,h
;	genPointerGet
	ld	a,(bc)
;	genAssign (pointer)
;	AOP_STK for __uitoa_sloc1_1_0
;	isBitvar = 0
	lda	hl,0(sp)
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	ld	(de),a
;_itoa.c:34: } while ( index < NUMBER_OF_DIGITS );
;	genCmpLt
;	AOP_STK for __uitoa_index_1_1
	lda	hl,5(sp)
	ld	a,(hl)
	sub	a,#0x10
	jp	C,00106$
;_itoa.c:36: string[i] = 0; /* string terminator */
;	genPlus
;	AOP_STK for 
;	AOP_STK for __uitoa_i_1_1
	lda	hl,10(sp)
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	lda	hl,4(sp)
	ld	l,(hl)
	ld	h,#0x00
	add	hl,de
	ld	c,l
	ld	b,h
;	genAssign (pointer)
;	isBitvar = 0
	ld	a,#0x00
	ld	(bc),a
;	genLabel
00109$:
;	genEndFunction
	lda	sp,6(sp)
	ret
__uitoa_end::
;_itoa.c:39: void _itoa(int value, char* string, unsigned char radix)
;	genLabel
;	genFunction
;	---------------------------------
; Function _itoa
; ---------------------------------
__itoa_start::
__itoa:
	
;_itoa.c:41: if (value < 0 && radix == 10) {
;	genCmpLt
;	AOP_STK for 
	lda	hl,3(sp)
	ld	a,(hl)
	bit	7,a
	jp	Z,00102$
;	genCmpEq
;	AOP_STK for 
; genCmpEq: left 1, right 1, result 0
	lda	hl,6(sp)
	ld	a,(hl)
	sub	a,#0x0A
	jp	NZ,00108$
	jr	00109$
00108$:
	jp	00102$
00109$:
;_itoa.c:42: *string++ = '-';
;	genAssign
;	AOP_STK for 
	lda	hl,4(sp)
	ld	c,(hl)
	inc	hl
	ld	b,(hl)
;	genAssign (pointer)
;	isBitvar = 0
	ld	a,#0x2D
	ld	(bc),a
;	genPlus
;	AOP_STK for 
;	genPlusIncr
	ld	hl,#0x0001
	add	hl,bc
	ld	a,l
	ld	d,h
	lda	hl,4(sp)
	ld	(hl+),a
	ld	(hl),d
;_itoa.c:43: value = -value;
;	genUminus
;	AOP_STK for 
	xor	a,a
	lda	hl,2(sp)
	ld	a,#0x00
	sbc	a,(hl)
	ld	(hl+),a
	ld	a,#0x00
	sbc	a,(hl)
	ld	(hl),a
;	genLabel
00102$:
;_itoa.c:45: _uitoa(value, string, radix);
;	genAssign
;	AOP_STK for 
	lda	hl,2(sp)
	ld	c,(hl)
	inc	hl
	ld	b,(hl)
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
;	AOP_STK for 
	lda	hl,6(sp)
	ld	a,(hl)
	push	af
	inc	sp
;	genIpush
;	AOP_STK for 
	dec	hl
	dec	hl
	ld	a,(hl+)
	ld	h,(hl)
	ld	l,a
	push	hl
;	genIpush
	push	bc
;	genCall
	call	__uitoa
	lda	sp,5(sp)
;	genLabel
00104$:
;	genEndFunction
	
	ret
__itoa_end::
	.area _CODE
	.area _CABS
