;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.5.1 #1058 (Jul 15 2005)
; This file generated Fri Jul 15 02:53:07 2005
;--------------------------------------------------------
	.module _atof
	.optsdcc -mz80
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _atof
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
;  ram data
;--------------------------------------------------------
	.area _DATA
;--------------------------------------------------------
; overlayable items in  ram 
;--------------------------------------------------------
	.area _OVERLAY
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area _CODE
	.area _GSINIT
	.area _GSFINAL
	.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
	.area _HOME
	.area _CODE
;--------------------------------------------------------
; code
;--------------------------------------------------------
	.area _CODE
;_atof.c:23: float atof(char * s)
;	genLabel
;	genFunction
;	---------------------------------
; Function atof
; ---------------------------------
_atof_start::
_atof:
	push	ix
	ld	ix,#0
	add	ix,sp
	ld	hl,#-16
	add	hl,sp
	ld	sp,hl
;_atof.c:30: while (isspace(*s)) s++;
;	genAssign
;	AOP_STK for 
	ld	c,4(ix)
	ld	b,5(ix)
;	genLabel
00101$:
;	genPointerGet
	ld	a,(bc)
	ld	e,a
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 1 deSending: 0
	push	bc
	ld	a,e
	push	af
	inc	sp
;	genCall
	call	_isspace
	ld	e,l
	inc	sp
	pop	bc
;	genAssign
;	AOP_STK for 
	ld	4(ix),c
	ld	5(ix),b
;	genIfx
	xor	a,a
	or	a,e
	jp	z,00103$
;	genPlus
;	genPlusIncr
	inc	bc
;	genGoto
	jp	00101$
;	genLabel
00103$:
;_atof.c:33: if (*s == '-')
;	genPointerGet
	ld	a,(bc)
;	genCmpEq
; genCmpEq: left 1, right 1, result 0
	ld	e,a
	cp	a,#0x2D
	jp	z,00149$
00148$:
	jp	00107$
00149$:
;_atof.c:35: sign=1;
;	genAssign
;	AOP_STK for _atof_sign_1_1
	ld	-10(ix),#0x01
;_atof.c:36: s++;
;	genPlus
;	AOP_STK for 
;	genPlusIncr
;	Can't optimise plus by inc, falling back to the normal way
	ld	a,c
	add	a,#0x01
	ld	4(ix),a
	ld	a,b
	adc	a,#0x00
	ld	5(ix),a
;	genGoto
	jp	00108$
;	genLabel
00107$:
;_atof.c:40: sign=0;
;	genAssign
;	AOP_STK for _atof_sign_1_1
	ld	-10(ix),#0x00
;_atof.c:41: if (*s == '+') s++;
;	genCmpEq
; genCmpEq: left 1, right 1, result 0
	ld	a,e
	cp	a,#0x2B
	jp	z,00151$
00150$:
	jp	00108$
00151$:
;	genPlus
;	AOP_STK for 
;	genPlusIncr
;	Can't optimise plus by inc, falling back to the normal way
	ld	a,c
	add	a,#0x01
	ld	4(ix),a
	ld	a,b
	adc	a,#0x00
	ld	5(ix),a
;	genLabel
00108$:
;_atof.c:45: for (value=0.0; isdigit(*s); s++)
;	genAssign
;	AOP_STK for _atof_value_1_1
	ld	-4(ix),#0x00
	ld	-3(ix),#0x00
	ld	-2(ix),#0x00
	ld	-1(ix),#0x00
;	genAssign
;	AOP_STK for 
;	AOP_STK for _atof__1_0
	ld	a,4(ix)
	ld	-12(ix),a
	ld	a,5(ix)
	ld	-11(ix),a
;	genLabel
00121$:
;	genPointerGet
;	AOP_STK for _atof__1_0
	ld	l,-12(ix)
	ld	h,-11(ix)
	ld	e,(hl)
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	ld	a,e
	push	af
	inc	sp
;	genCall
	call	_isdigit
	ld	e,l
	inc	sp
;	genAssign
;	AOP_STK for _atof__1_0
;	AOP_STK for 
	ld	a,-12(ix)
	ld	4(ix),a
	ld	a,-11(ix)
	ld	5(ix),a
;	genIfx
	xor	a,a
	or	a,e
	jp	z,00124$
;_atof.c:47: value=10.0*value+(*s-'0');
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	ld	hl,#0x4120
	push	hl
	ld	hl,#0x0000
	push	hl
;	genIpush
;	AOP_STK for _atof_value_1_1
	ld	l,-2(ix)
	ld	h,-1(ix)
	push	hl
	ld	l,-4(ix)
	ld	h,-3(ix)
	push	hl
;	genCall
	call	___fsmul
;	AOP_STK for _atof__1_0
	ld	-13(ix),d
	ld	-14(ix),e
	ld	-15(ix),h
	ld	-16(ix),l
	pop	af
	pop	af
	pop	af
	pop	af
;	genPointerGet
;	AOP_STK for _atof__1_0
	ld	l,-12(ix)
	ld	h,-11(ix)
	ld	c,(hl)
;	genCast
; Removed redundent load
	ld	a,c
	rla	
	sbc	a,a
	ld	b,a
;	genMinus
	ld	a,c
	add	a,#0xD0
	ld	c,a
	ld	a,b
	adc	a,#0xFF
	ld	b,a
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	push	bc
;	genCall
	call	___sint2fs
; Removed redundent load
; Removed redundent load
	ld	b,h
	ld	c,l
	pop	af
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	push	de
	push	bc
;	genIpush
;	AOP_STK for _atof__1_0
	ld	l,-14(ix)
	ld	h,-13(ix)
	push	hl
	ld	l,-16(ix)
	ld	h,-15(ix)
	push	hl
;	genCall
	call	___fsadd
; Removed redundent load
; Removed redundent load
	ld	b,h
	ld	c,l
	pop	af
	pop	af
	pop	af
	pop	af
;	genAssign
;	AOP_STK for _atof_value_1_1
	ld	-4(ix),c
	ld	-3(ix),b
	ld	-2(ix),e
	ld	-1(ix),d
;_atof.c:45: for (value=0.0; isdigit(*s); s++)
;	genPlus
;	AOP_STK for _atof__1_0
;	genPlusIncr
	inc	-12(ix)
	jp	nz,00152$
	inc	-11(ix)
00152$:
;	genGoto
	jp	00121$
;	genLabel
00124$:
;_atof.c:51: if (*s == '.')
;	genPointerGet
;	AOP_STK for _atof__1_0
	ld	l,-12(ix)
	ld	h,-11(ix)
	ld	c,(hl)
;	genCmpEq
; genCmpEq: left 1, right 1, result 0
	ld	a,c
	cp	a,#0x2E
	jp	z,00154$
00153$:
	jp	00110$
00154$:
;_atof.c:53: s++;
;	genPlus
;	AOP_STK for _atof__1_0
;	genPlusIncr
	ld	c,-12(ix)
	ld	b,-11(ix)
	inc	bc
;_atof.c:54: for (fraction=0.1; isdigit(*s); s++)
;	genAssign
;	AOP_STK for _atof_fraction_1_1
	ld	-8(ix),#0xCD
	ld	-7(ix),#0xCC
	ld	-6(ix),#0xCC
	ld	-5(ix),#0x3D
;	genAssign
;	AOP_STK for _atof__1_0
	ld	-16(ix),c
	ld	-15(ix),b
;	genLabel
00125$:
;	genPointerGet
;	AOP_STK for _atof__1_0
	ld	l,-16(ix)
	ld	h,-15(ix)
	ld	e,(hl)
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	ld	a,e
	push	af
	inc	sp
;	genCall
	call	_isdigit
	ld	e,l
	inc	sp
;	genAssign
;	AOP_STK for _atof__1_0
;	AOP_STK for 
	ld	a,-16(ix)
	ld	4(ix),a
	ld	a,-15(ix)
	ld	5(ix),a
;	genIfx
	xor	a,a
	or	a,e
	jp	z,00110$
;_atof.c:56: value+=(*s-'0')*fraction;
;	genPointerGet
;	AOP_STK for _atof__1_0
	ld	l,-16(ix)
	ld	h,-15(ix)
	ld	e,(hl)
;	genCast
; Removed redundent load
	ld	a,e
	rla	
	sbc	a,a
	ld	d,a
;	genMinus
	ld	a,e
	add	a,#0xD0
	ld	e,a
	ld	a,d
	adc	a,#0xFF
	ld	d,a
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	push	de
;	genCall
	call	___sint2fs
	ld	b,d
	ld	c,e
	ld	d,h
	ld	e,l
	pop	af
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
;	AOP_STK for _atof_fraction_1_1
	ld	l,-6(ix)
	ld	h,-5(ix)
	push	hl
	ld	l,-8(ix)
	ld	h,-7(ix)
	push	hl
;	genIpush
	ld	l,c
	ld	h,b
	push	hl
	ld	l,e
	ld	h,d
	push	hl
;	genCall
	call	___fsmul
; Removed redundent load
; Removed redundent load
	ld	b,h
	ld	c,l
	pop	af
	pop	af
	pop	af
	pop	af
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	push	de
	push	bc
;	genIpush
;	AOP_STK for _atof_value_1_1
	ld	l,-2(ix)
	ld	h,-1(ix)
	push	hl
	ld	l,-4(ix)
	ld	h,-3(ix)
	push	hl
;	genCall
	call	___fsadd
; Removed redundent load
; Removed redundent load
	ld	b,h
	ld	c,l
	pop	af
	pop	af
	pop	af
	pop	af
;	genAssign
;	AOP_STK for _atof_value_1_1
	ld	-4(ix),c
	ld	-3(ix),b
	ld	-2(ix),e
	ld	-1(ix),d
;_atof.c:57: fraction*=0.1;
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	ld	hl,#0x3DCC
	push	hl
	ld	hl,#0xCCCD
	push	hl
;	genIpush
;	AOP_STK for _atof_fraction_1_1
	ld	l,-6(ix)
	ld	h,-5(ix)
	push	hl
	ld	l,-8(ix)
	ld	h,-7(ix)
	push	hl
;	genCall
	call	___fsmul
; Removed redundent load
; Removed redundent load
	ld	b,h
	ld	c,l
	pop	af
	pop	af
	pop	af
	pop	af
;	genAssign
;	AOP_STK for _atof_fraction_1_1
	ld	-8(ix),c
	ld	-7(ix),b
	ld	-6(ix),e
	ld	-5(ix),d
;_atof.c:54: for (fraction=0.1; isdigit(*s); s++)
;	genPlus
;	AOP_STK for _atof__1_0
;	genPlusIncr
	inc	-16(ix)
	jp	nz,00155$
	inc	-15(ix)
00155$:
;	genGoto
	jp	00125$
;	genLabel
00110$:
;_atof.c:62: if (toupper(*s)=='E')
;	genAssign
;	AOP_STK for 
	ld	c,4(ix)
	ld	b,5(ix)
;	genPointerGet
	ld	a,(bc)
	ld	e,a
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 1 deSending: 0
	push	bc
	ld	a,e
	push	af
	inc	sp
;	genCall
	call	_islower
	ld	e,l
	inc	sp
	pop	bc
;	genIfx
	xor	a,a
	or	a,e
	jp	z,00131$
;	genPointerGet
	ld	a,(bc)
;	genCast
; Removed redundent load
	ld	e,a
	rla	
	sbc	a,a
	ld	d,a
;	genAnd
	ld	a,e
	and	a,#0xDF
	ld	e,a
;	genGoto
	jp	00132$
;	genLabel
00131$:
;	genPointerGet
	ld	a,(bc)
	ld	c,a
;	genCast
	ld	e,c
	ld	a,e
	rla	
	sbc	a,a
	ld	d,a
;	genLabel
00132$:
;	genCmpEq
; genCmpEq: left 2, right 2, result 0
	ld	a,e
	cp	a,#0x45
	jp	nz,00156$
	ld	a,d
	or	a,a
	jp	z,00157$
00156$:
	jp	00118$
00157$:
;_atof.c:64: s++;
;	genAssign
;	AOP_STK for 
	ld	c,4(ix)
	ld	b,5(ix)
;	genPlus
;	AOP_STK for 
;	genPlusIncr
;	Can't optimise plus by inc, falling back to the normal way
	ld	a,c
	add	a,#0x01
	ld	4(ix),a
	ld	a,b
	adc	a,#0x00
	ld	5(ix),a
;_atof.c:65: iexp=(char)atoi(s);
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
;	AOP_STK for 
	ld	l,4(ix)
	ld	h,5(ix)
	push	hl
;	genCall
	call	_atoi
	ld	b,h
	ld	c,l
	pop	af
;	genCast
;	AOP_STK for _atof_iexp_1_1
	ld	-9(ix),c
;_atof.c:67: while(iexp!=0)
;	genLabel
00114$:
;	genCmpEq
;	AOP_STK for _atof_iexp_1_1
; genCmpEq: left 1, right 1, result 0
	ld	a,-9(ix)
	or	a,a
	jp	z,00118$
00158$:
;_atof.c:69: if(iexp<0)
;	genCmpLt
;	AOP_STK for _atof_iexp_1_1
	ld	a,-9(ix)
	bit	7,a
	jp	z,00112$
;_atof.c:71: value*=0.1;
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	ld	hl,#0x3DCC
	push	hl
	ld	hl,#0xCCCD
	push	hl
;	genIpush
;	AOP_STK for _atof_value_1_1
	ld	l,-2(ix)
	ld	h,-1(ix)
	push	hl
	ld	l,-4(ix)
	ld	h,-3(ix)
	push	hl
;	genCall
	call	___fsmul
	ld	c,d
	ld	d,e
	ld	e,h
	ld	b,l
	pop	af
	pop	af
	pop	af
	pop	af
;	genAssign
;	AOP_STK for _atof_value_1_1
	ld	-4(ix),b
	ld	-3(ix),e
	ld	-2(ix),d
	ld	-1(ix),c
;_atof.c:72: iexp++;
;	genPlus
;	AOP_STK for _atof_iexp_1_1
;	genPlusIncr
	inc	-9(ix)
;	genGoto
	jp	00114$
;	genLabel
00112$:
;_atof.c:76: value*=10.0;
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	ld	hl,#0x4120
	push	hl
	ld	hl,#0x0000
	push	hl
;	genIpush
;	AOP_STK for _atof_value_1_1
	ld	l,-2(ix)
	ld	h,-1(ix)
	push	hl
	ld	l,-4(ix)
	ld	h,-3(ix)
	push	hl
;	genCall
	call	___fsmul
; Removed redundent load
; Removed redundent load
	ld	b,h
	ld	c,l
	pop	af
	pop	af
	pop	af
	pop	af
;	genAssign
;	AOP_STK for _atof_value_1_1
	ld	-4(ix),c
	ld	-3(ix),b
	ld	-2(ix),e
	ld	-1(ix),d
;_atof.c:77: iexp--;
;	genMinus
;	AOP_STK for _atof_iexp_1_1
	dec	-9(ix)
;	genGoto
	jp	00114$
;	genLabel
00118$:
;_atof.c:83: if(sign) value*=-1.0;
;	genIfx
;	AOP_STK for _atof_sign_1_1
	xor	a,a
	or	a,-10(ix)
	jp	z,00120$
;	genIpush
; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0
	ld	hl,#0xBF80
	push	hl
	ld	hl,#0x0000
	push	hl
;	genIpush
;	AOP_STK for _atof_value_1_1
	ld	l,-2(ix)
	ld	h,-1(ix)
	push	hl
	ld	l,-4(ix)
	ld	h,-3(ix)
	push	hl
;	genCall
	call	___fsmul
; Removed redundent load
; Removed redundent load
	ld	b,h
	ld	c,l
	pop	af
	pop	af
	pop	af
	pop	af
;	genAssign
;	AOP_STK for _atof_value_1_1
	ld	-4(ix),c
	ld	-3(ix),b
	ld	-2(ix),e
	ld	-1(ix),d
;	genLabel
00120$:
;_atof.c:84: return (value);
;	genRet
;	AOP_STK for _atof_value_1_1
; Dump of IC_LEFT: type AOP_STK size 4
;	 aop_stk -4
	ld	l,-4(ix)
	ld	h,-3(ix)
	ld	e,-2(ix)
	ld	d,-1(ix)
;	genLabel
00129$:
;	genEndFunction
	ld	sp,ix
	pop	ix
	ret
_atof_end::
	.area _CODE
