;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 2.7.0 #4818 (Dec  8 2007)
; This file generated Sat Dec  8 06:12:38 2007
;--------------------------------------------------------
	.module _itoa
	.optsdcc -mz80
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl __itoa
	.globl __uitoa
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
;  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:
	push	ix
	ld	ix,#0
	add	ix,sp
	ld	hl,#-4
	add	hl,sp
	ld	sp,hl
;_itoa.c:26: do {
;	genAssign
;	AOP_STK for __uitoa_index_1_1
	ld	-1(ix),#0x10
;	genLabel
00103$:
;_itoa.c:27: string[--index] = '0' + (value % radix);
;	genMinus
;	AOP_STK for __uitoa_index_1_1
	dec	-1(ix)
;	genPlus
;	AOP_STK for 
;	AOP_STK for __uitoa_index_1_1
	ld	a,6(ix)
	add	a,-1(ix)
	ld	e,a
	ld	a,7(ix)
	adc	a,#0x00
	ld	d,a
;	genCast
;	AOP_STK for 
;	AOP_STK for __uitoa_sloc0_1_0
	ld	a,8(ix)
	ld	-4(ix),a
	ld	-3(ix),#0x00
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 1 bcInUse: 0 deSending: 0
	push	de
;	AOP_STK for __uitoa_sloc0_1_0
	ld	l,-4(ix)
	ld	h,-3(ix)
	push	hl
;	genIpush
;	AOP_STK for 
	ld	l,4(ix)
	ld	h,5(ix)
	push	hl
;	genCall
	call	__moduint_rrx_s
	ld	c,h
	ld	b,l
	pop	af
	pop	af
	pop	de
;	genCast
;	genPlus
;	genPlusIncr
	ld	a,b
	add	a,#0x30
;	genAssign (pointer)
;	isBitvar = 0
	ld	(de),a
;_itoa.c:28: if ( string[index] > '9') string[index] += 'A' - '9' - 1;
;	genPointerGet
	ld	a,(de)
	ld	c,a
;	genCmpGt
	ld	a,#0x39
	sub	a,c
	jp	P,00102$
;	genPointerGet
	ld	a,(de)
;	genPlus
;	genPlusIncr
	ld	c,a
	add	a,#0x07
;	genAssign (pointer)
;	isBitvar = 0
	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
	ld	l,-4(ix)
	ld	h,-3(ix)
	push	hl
;	genIpush
;	AOP_STK for 
	ld	l,4(ix)
	ld	h,5(ix)
	push	hl
;	genCall
	call	__divuint_rrx_s
	ld	b,h
	ld	c,l
	pop	af
	pop	af
;	genAssign
;	AOP_STK for 
	ld	4(ix),c
	ld	5(ix),b
;_itoa.c:30: } while (value != 0);
;	genCmpEq
;	AOP_STK for 
; genCmpEq: left 2, right 2, result 0
	ld	a,4(ix)
	or	a,5(ix)
	jr	Z,00118$
	jp	00103$
00118$:
;_itoa.c:32: do {
;	genAssign
;	AOP_STK for __uitoa_i_1_1
	ld	-2(ix),#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
	ld	e,-2(ix)
;	genPlus
;	AOP_STK for __uitoa_i_1_1
;	genPlusIncr
	inc	-2(ix)
;	genPlus
;	AOP_STK for 
	ld	a,6(ix)
	add	a,e
	ld	e,a
	ld	a,7(ix)
	adc	a,#0x00
	ld	d,a
;	genAssign
;	AOP_STK for __uitoa_index_1_1
	ld	c,-1(ix)
;	genPlus
;	AOP_STK for __uitoa_index_1_1
;	genPlusIncr
	inc	-1(ix)
;	genPlus
;	AOP_STK for 
	ld	a,6(ix)
	add	a,c
	ld	c,a
	ld	a,7(ix)
	adc	a,#0x00
	ld	b,a
;	genPointerGet
	ld	a,(bc)
;	genAssign (pointer)
;	isBitvar = 0
	ld	(de),a
;_itoa.c:34: } while ( index < NUMBER_OF_DIGITS );
;	genCmpLt
;	AOP_STK for __uitoa_index_1_1
	ld	a,-1(ix)
	sub	a,#0x10
	jr	C,00106$
;_itoa.c:36: string[i] = 0; /* string terminator */
;	genPlus
;	AOP_STK for 
;	AOP_STK for __uitoa_i_1_1
	ld	a,6(ix)
	add	a,-2(ix)
	ld	c,a
	ld	a,7(ix)
	adc	a,#0x00
	ld	b,a
;	genAssign (pointer)
;	isBitvar = 0
	ld	a,#0x00
	ld	(bc),a
;	genLabel
;	genEndFunction
	ld	sp,ix
	pop	ix
	ret
__uitoa_end::
;_itoa.c:39: void _itoa(int value, char* string, unsigned char radix)
;	genLabel
;	genFunction
;	---------------------------------
; Function _itoa
; ---------------------------------
__itoa_start::
__itoa:
	push	ix
	ld	ix,#0
	add	ix,sp
;_itoa.c:41: if (value < 0 && radix == 10) {
;	genCmpLt
;	AOP_STK for 
	ld	a,5(ix)
	bit	7,a
	jr	Z,00102$
;	genCmpEq
;	AOP_STK for 
; genCmpEq: left 1, right 1, result 0
	ld	a,8(ix)
	sub	a,#0x0A
	jr	Z,00109$
	jr	00102$
00109$:
;_itoa.c:42: *string++ = '-';
;	genAssign
;	AOP_STK for 
	ld	c,6(ix)
	ld	b,7(ix)
;	genAssign (pointer)
;	isBitvar = 0
	ld	a,#0x2D
	ld	(bc),a
;	genPlus
;	AOP_STK for 
;	genPlusIncr
	ld	a,c
	add	a,#0x01
	ld	6(ix),a
	ld	a,b
	adc	a,#0x00
	ld	7(ix),a
;_itoa.c:43: value = -value;
;	genUminus
;	AOP_STK for 
	xor	a,a
	sbc	a,4(ix)
	ld	4(ix),a
	ld	a,#0x00
	sbc	a,5(ix)
	ld	5(ix),a
;	genLabel
00102$:
;_itoa.c:45: _uitoa(value, string, radix);
;	genAssign
;	AOP_STK for 
	ld	c,4(ix)
	ld	b,5(ix)
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
;	AOP_STK for 
	ld	a,8(ix)
	push	af
	inc	sp
;	genIpush
;	AOP_STK for 
	ld	l,6(ix)
	ld	h,7(ix)
	push	hl
;	genIpush
	push	bc
;	genCall
	call	__uitoa
	pop	af
	pop	af
	inc	sp
;	genLabel
;	genEndFunction
	pop	ix
	ret
__itoa_end::
	.area _CODE
	.area _CABS
