;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.6.1 #4330 (Oct 18 2006)
; This file generated Wed Oct 18 23:31:23 2006
;--------------------------------------------------------
	.module sprintf
	.optsdcc -mhc08
	
	.area HOME (CODE)
	.area GSINIT0 (CODE)
	.area GSINIT (CODE)
	.area GSFINAL (CODE)
	.area CSEG (CODE)
	.area XINIT
	.area CONST   (CODE)
	.area DSEG
	.area OSEG    (OVR)
	.area BSEG
	.area XSEG
	.area XISEG
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _vsprintf_PARM_3
	.globl _vsprintf_PARM_2
	.globl _vsprintf
	.globl _sprintf
;--------------------------------------------------------
;  ram data
;--------------------------------------------------------
	.area DSEG
;--------------------------------------------------------
; overlayable items in  ram 
;--------------------------------------------------------
	.area OSEG    (OVR)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG
;--------------------------------------------------------
; extended address mode data
;--------------------------------------------------------
	.area XSEG
_vsprintf_PARM_2:
	.ds 2
_vsprintf_PARM_3:
	.ds 2
_vsprintf_buf_1_1:
	.ds 2
_vsprintf_i_1_1:
	.ds 2
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area HOME (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 'put_char_to_string'
;------------------------------------------------------------
;p                         Allocated to stack - offset 2
;c                         Allocated to stack - offset -1
;buf                       Allocated to registers 
;sloc0                     Allocated to stack - offset -3
;sloc1                     Allocated to stack - offset -5
;------------------------------------------------------------
;sprintf.c:29: static void put_char_to_string( char c, void* p ) _REENTRANT
;	-----------------------------------------
;	 function put_char_to_string
;	-----------------------------------------
_put_char_to_string:
;     genReceive
	psha
	ais	#-4
;sprintf.c:31: char **buf = (char **)p;
;     genAssign
;sprintf.c:32: *(*buf)++ = c;
;     genPointerGet
;     loadRegFromAop (hx, SOF(iTemp2), 0)
;     loadRegFromAop (a, SOF(iTemp2), 1)
	lda	8,s
;     loadRegFromAop (x, SOF(iTemp2), 0)
	ldx	9,s
; transferRegReg(a,h)
	psha
	pulh
	lda	,x
	aix	#1
;     storeRegToAop (a, SOF(iTemp4), 1), stacked=0, isaddr=0
	sta	3,s
	lda	,x
;     storeRegToAop (a, SOF(iTemp4), 0), stacked=0, isaddr=0
	sta	4,s
; checking lic
; checking IS_ITEMP
; pset=1, pget=0
; checking pset operandsEqu
;     genPlus
; IS_AOP_HX = 0
; icount = 1, sameRegs=0
;  left size = 2
;  right size = 1
;  result size = 2
;     loadRegFromAop (a, SOF(iTemp4), 0)
	lda	4,s
	add	#0x01
;     storeRegToAop (a, SOF(iTemp6), 0), stacked=0, isaddr=0
	sta	2,s
;     loadRegFromAop (a, SOF(iTemp4), 1)
	lda	3,s
	adc	#0x00
;     storeRegToAop (a, SOF(iTemp6), 1), stacked=0, isaddr=0
	sta	1,s
;     genPointerSet
;     loadRegFromAop (hx, SOF(iTemp2), 0)
;     loadRegFromAop (a, SOF(iTemp2), 1)
	lda	8,s
;     loadRegFromAop (x, SOF(iTemp2), 0)
	ldx	9,s
; transferRegReg(a,h)
	psha
	pulh
;     loadRegFromAop (a, SOF(iTemp6), 1)
	lda	1,s
	sta	,x
	aix	#1
;     loadRegFromAop (a, SOF(iTemp6), 0)
	lda	2,s
	sta	,x
;     genPointerSet
;     loadRegFromAop (hx, SOF(iTemp4), 0)
;     loadRegFromAop (a, SOF(iTemp4), 1)
	lda	3,s
;     loadRegFromAop (x, SOF(iTemp4), 0)
	ldx	4,s
; transferRegReg(a,h)
	psha
	pulh
;     loadRegFromAop (a, SOF(iTemp0), 0)
	lda	5,s
	sta	,x
00101$:
	ais	#5
	rts
;------------------------------------------------------------
;Allocation info for local variables in function 'vsprintf'
;------------------------------------------------------------
;format                    Allocated with name '_vsprintf_PARM_2'
;ap                        Allocated with name '_vsprintf_PARM_3'
;buf                       Allocated with name '_vsprintf_buf_1_1'
;i                         Allocated with name '_vsprintf_i_1_1'
;------------------------------------------------------------
;sprintf.c:35: int vsprintf (char *buf, const char *format, va_list ap)
;	-----------------------------------------
;	 function vsprintf
;	-----------------------------------------
_vsprintf:
;     genReceive
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, EXT(_vsprintf_buf_1_1), 0), stacked=0, isaddr=1
	sta	(_vsprintf_buf_1_1 + 1)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, EXT(_vsprintf_buf_1_1), 1), stacked=0, isaddr=1
	stx	_vsprintf_buf_1_1
;sprintf.c:38: i = _print_format( put_char_to_string, &buf, format, ap );
;     genAddrOf
	lda	#_vsprintf_buf_1_1
;     storeRegToAop (a, EXT(__print_format_PARM_2), 0), stacked=0, isaddr=1
	sta	(__print_format_PARM_2 + 1)
	lda	#>_vsprintf_buf_1_1
;     storeRegToAop (a, EXT(__print_format_PARM_2), 1), stacked=0, isaddr=1
	sta	__print_format_PARM_2
;     genAssign
;     loadRegFromAop (a, EXT(_vsprintf_PARM_2), 1)
	lda	_vsprintf_PARM_2
;     storeRegToAop (a, EXT(__print_format_PARM_3), 1), stacked=0, isaddr=1
	sta	__print_format_PARM_3
;     loadRegFromAop (a, EXT(_vsprintf_PARM_2), 0)
	lda	(_vsprintf_PARM_2 + 1)
;     storeRegToAop (a, EXT(__print_format_PARM_3), 0), stacked=0, isaddr=1
	sta	(__print_format_PARM_3 + 1)
;     genAssign
;     loadRegFromAop (a, EXT(_vsprintf_PARM_3), 1)
	lda	_vsprintf_PARM_3
;     storeRegToAop (a, EXT(__print_format_PARM_4), 1), stacked=0, isaddr=1
	sta	__print_format_PARM_4
;     loadRegFromAop (a, EXT(_vsprintf_PARM_3), 0)
	lda	(_vsprintf_PARM_3 + 1)
;     storeRegToAop (a, EXT(__print_format_PARM_4), 0), stacked=0, isaddr=1
	sta	(__print_format_PARM_4 + 1)
;     genCall
;     loadRegFromAop (x, IMMD(_put_char_to_string), 1)
	ldx	#>_put_char_to_string
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, IMMD(_put_char_to_string), 0)
	lda	#_put_char_to_string
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
	jsr	__print_format
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, EXT(_vsprintf_i_1_1), 0), stacked=0, isaddr=0
	sta	(_vsprintf_i_1_1 + 1)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, EXT(_vsprintf_i_1_1), 1), stacked=0, isaddr=0
	stx	_vsprintf_i_1_1
;sprintf.c:39: *buf = 0;
;     genAssign
;     loadRegFromAop (x, EXT(_vsprintf_buf_1_1), 1)
	ldx	_vsprintf_buf_1_1
;     storeRegToAop (x, REG(-,-,x,a), 1), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, EXT(_vsprintf_buf_1_1), 0)
	lda	(_vsprintf_buf_1_1 + 1)
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genPointerSet
;     loadRegFromAop (hx, REG(-,-,x,a), 0)
; transferRegReg(xa,hx)
	pshx
	pulh
	tax
;     loadRegFromAop (a, LIT(#0x00), 0)
	clra
	sta	,x
;sprintf.c:40: return i;
;     genRet
;     loadRegFromAop (x, EXT(_vsprintf_i_1_1), 1)
	ldx	_vsprintf_i_1_1
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, EXT(_vsprintf_i_1_1), 0)
	lda	(_vsprintf_i_1_1 + 1)
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
00101$:
	rts
;------------------------------------------------------------
;Allocation info for local variables in function 'sprintf'
;------------------------------------------------------------
;buf                       Allocated to stack - offset 2
;format                    Allocated to stack - offset 4
;arg                       Allocated to registers 
;i                         Allocated to stack - offset -2
;sloc0                     Allocated to stack - offset -4
;------------------------------------------------------------
;sprintf.c:43: int sprintf (char *buf, const char *format, ...)
;	-----------------------------------------
;	 function sprintf
;	-----------------------------------------
_sprintf:
	ais	#-4
;sprintf.c:48: va_start (arg, format);
;     genAddrOf
	tsx
	aix	#8
;     storeRegToAop (hx, SOF(iTemp1), 0), stacked=0, isaddr=0
; transferRegReg(h,a)
	pshh
	pula
;     storeRegToAop (a, SOF(iTemp1), 1), stacked=0, isaddr=0
	sta	1,s
;     storeRegToAop (x, SOF(iTemp1), 0), stacked=0, isaddr=0
	stx	2,s
; checking lic
; checking IS_ITEMP
;     genPlus
; IS_AOP_HX = 0
; icount = 2, sameRegs=0
;  left size = 2
;  right size = 1
;  result size = 2
;     loadRegFromAop (a, SOF(iTemp1), 0)
	lda	2,s
	add	#0x02
;     storeRegToAop (a, EXT(__print_format_PARM_4), 0), stacked=0, isaddr=1
	sta	(__print_format_PARM_4 + 1)
;     loadRegFromAop (a, SOF(iTemp1), 1)
	lda	1,s
	adc	#0x00
;     storeRegToAop (a, EXT(__print_format_PARM_4), 1), stacked=0, isaddr=1
	sta	__print_format_PARM_4
;sprintf.c:49: i = _print_format( put_char_to_string, &buf, format, arg );
;     genAddrOf
	tsx
	aix	#6
;     storeRegToAop (hx, EXT(__print_format_PARM_2), 0), stacked=0, isaddr=1
; transferRegReg(h,a)
	pshh
	pula
;     storeRegToAop (a, EXT(__print_format_PARM_2), 1), stacked=0, isaddr=1
	sta	__print_format_PARM_2
;     storeRegToAop (x, EXT(__print_format_PARM_2), 0), stacked=0, isaddr=1
	stx	(__print_format_PARM_2 + 1)
;     genAssign
;     loadRegFromAop (a, SOF(format), 1)
	lda	9,s
;     storeRegToAop (a, EXT(__print_format_PARM_3), 1), stacked=0, isaddr=1
	sta	__print_format_PARM_3
;     loadRegFromAop (a, SOF(format), 0)
	lda	10,s
;     storeRegToAop (a, EXT(__print_format_PARM_3), 0), stacked=0, isaddr=1
	sta	(__print_format_PARM_3 + 1)
;     genCall
;     loadRegFromAop (x, IMMD(_put_char_to_string), 1)
	ldx	#>_put_char_to_string
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, IMMD(_put_char_to_string), 0)
	lda	#_put_char_to_string
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
	jsr	__print_format
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, SOF(iTemp7), 0), stacked=0, isaddr=0
	sta	4,s
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, SOF(iTemp7), 1), stacked=0, isaddr=0
	stx	3,s
;     genAssign
;sprintf.c:50: *buf = 0;
;     genAssign
;     loadRegFromAop (x, SOF(buf), 1)
	ldx	7,s
;     storeRegToAop (x, REG(-,-,x,a), 1), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, SOF(buf), 0)
	lda	8,s
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genPointerSet
;     loadRegFromAop (hx, REG(-,-,x,a), 0)
; transferRegReg(xa,hx)
	pshx
	pulh
	tax
;     loadRegFromAop (a, LIT(#0x00), 0)
	clra
	sta	,x
;sprintf.c:53: return i;
;     genRet
;     loadRegFromAop (x, SOF(iTemp4), 1)
	ldx	3,s
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, SOF(iTemp4), 0)
	lda	4,s
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
00101$:
	ais	#4
	rts
	.area CSEG (CODE)
	.area CONST   (CODE)
	.area XINIT
