;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.6.1 #4330 (Oct 18 2006)
; This file generated Wed Oct 18 23:31:02 2006
;--------------------------------------------------------
	.module _atol
	.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 _atol
;--------------------------------------------------------
;  ram data
;--------------------------------------------------------
	.area DSEG
_atol_rv_1_1:
	.ds 4
_atol_sign_1_1:
	.ds 1
_atol_sloc0_1_0:
	.ds 2
_atol_sloc1_1_0:
	.ds 4
_atol_sloc2_1_0:
	.ds 2
_atol_sloc3_1_0:
	.ds 4
;--------------------------------------------------------
; overlayable items in  ram 
;--------------------------------------------------------
	.area OSEG    (OVR)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG
;--------------------------------------------------------
; extended address mode data
;--------------------------------------------------------
	.area XSEG
_atol_s_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 'atol'
;------------------------------------------------------------
;rv                        Allocated with name '_atol_rv_1_1'
;sign                      Allocated with name '_atol_sign_1_1'
;sloc0                     Allocated with name '_atol_sloc0_1_0'
;sloc1                     Allocated with name '_atol_sloc1_1_0'
;sloc2                     Allocated with name '_atol_sloc2_1_0'
;sloc3                     Allocated with name '_atol_sloc3_1_0'
;s                         Allocated with name '_atol_s_1_1'
;------------------------------------------------------------
;_atol.c:25: long atol(char * s)
;	-----------------------------------------
;	 function atol
;	-----------------------------------------
_atol:
;     genReceive
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, EXT(_atol_s_1_1), 0), stacked=0, isaddr=0
	sta	(_atol_s_1_1 + 1)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, EXT(_atol_s_1_1), 1), stacked=0, isaddr=0
	stx	_atol_s_1_1
;_atol.c:27: register long rv=0; 
;     genAssign
	clr	*_atol_rv_1_1
	clr	*(_atol_rv_1_1 + 1)
	clr	*(_atol_rv_1_1 + 2)
	clr	*(_atol_rv_1_1 + 3)
;_atol.c:31: while (*s) {
;     genAssign
;     loadRegFromAop (a, EXT(_atol_s_1_1), 1)
	lda	_atol_s_1_1
;     storeRegToAop (a, DIR(_atol_sloc0_1_0), 1), stacked=0, isaddr=0
	sta	*_atol_sloc0_1_0
;     loadRegFromAop (a, EXT(_atol_s_1_1), 0)
	lda	(_atol_s_1_1 + 1)
;     storeRegToAop (a, DIR(_atol_sloc0_1_0), 0), stacked=0, isaddr=0
	sta	*(_atol_sloc0_1_0 + 1)
00107$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     genIfxJump
; Peephole 2d	- eliminated jmp
	beq	00133$
00135$:
;_atol.c:32: if (*s <= '9' && *s >= '0')
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmp	(>)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x39
; Peephole 2i	- eliminated bra
	bgt	00102$
00136$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmp	(<)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x30
; Peephole 2l	- eliminated bra
	bge	00133$
00137$:
;_atol.c:33: break;
00102$:
;_atol.c:34: if (*s == '-' || *s == '+') 
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2D
; Peephole 2d	- eliminated jmp
	beq	00133$
00138$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2B
; Peephole 2d	- eliminated jmp
	beq	00133$
00139$:
;_atol.c:36: s++;
; checking lic
; checking IS_ITEMP
; pset=0, pget=0
;     genPlus
; IS_AOP_HX = 0
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	aix	#1
;     storeRegToAop (hx, DIR(_atol_sloc0_1_0), 0), stacked=0, isaddr=0
	sthx	*_atol_sloc0_1_0
; Peephole 3	- shortened jmp to bra
	bra	00107$
00133$:
;     genAssign
;     loadRegFromAop (a, DIR(_atol_sloc0_1_0), 1)
	lda	*_atol_sloc0_1_0
;     storeRegToAop (a, EXT(_atol_s_1_1), 1), stacked=0, isaddr=0
	sta	_atol_s_1_1
;     loadRegFromAop (a, DIR(_atol_sloc0_1_0), 0)
	lda	*(_atol_sloc0_1_0 + 1)
;     storeRegToAop (a, EXT(_atol_s_1_1), 0), stacked=0, isaddr=0
	sta	(_atol_s_1_1 + 1)
;_atol.c:39: sign = (*s == '-');
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2D
	beq	00141$
	clra
	bra	00140$
00141$:
	lda	#0x01
00140$:
;     storeRegToAop (a, DIR(_atol_sign_1_1), 0), stacked=0, isaddr=0
	sta	*_atol_sign_1_1
; forgot to free a
; forgot to free xa
;_atol.c:40: if (*s == '-' || *s == '+') s++;
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2D
; Peephole 2d	- eliminated jmp
	beq	00110$
00142$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2B
; Peephole 2c	- eliminated jmp
	bne	00131$
00143$:
00110$:
; checking lic
; checking IS_ITEMP
; pset=0, pget=0
;     genPlus
; IS_AOP_HX = 0
; icount = 1, sameRegs=1
;     genPlusIncr
;     loadRegFromAop (a, EXT(_atol_s_1_1), 0)
	lda	(_atol_s_1_1 + 1)
	inca
;     storeRegToAop (a, EXT(_atol_s_1_1), 0), stacked=0, isaddr=0
	sta	(_atol_s_1_1 + 1)
	bne	00144$
;     loadRegFromAop (a, EXT(_atol_s_1_1), 1)
	lda	_atol_s_1_1
	inca
;     storeRegToAop (a, EXT(_atol_s_1_1), 1), stacked=0, isaddr=0
	sta	_atol_s_1_1
00144$:
;_atol.c:42: while (*s && *s >= '0' && *s <= '9') {
00131$:
;     genAssign
;     loadRegFromAop (a, EXT(_atol_s_1_1), 1)
	lda	_atol_s_1_1
;     storeRegToAop (a, DIR(_atol_sloc0_1_0), 1), stacked=0, isaddr=0
	sta	*_atol_sloc0_1_0
;     loadRegFromAop (a, EXT(_atol_s_1_1), 0)
	lda	(_atol_s_1_1 + 1)
;     storeRegToAop (a, DIR(_atol_sloc0_1_0), 0), stacked=0, isaddr=0
	sta	*(_atol_sloc0_1_0 + 1)
00115$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     genIfxJump
	bne	00145$
	jmp	00117$
00145$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmp	(<)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x30
	bge	00146$
	jmp	00117$
00146$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmp	(>)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x39
	ble	00147$
	jmp	00117$
00147$:
;_atol.c:43: rv = (rv * 10) + (*s - '0');
;     genAssign
;     loadRegFromAop (a, DIR(_atol_rv_1_1), 3)
	lda	*_atol_rv_1_1
;     storeRegToAop (a, EXT(__mullong_PARM_1), 3), stacked=0, isaddr=1
	sta	__mullong_PARM_1
;     loadRegFromAop (a, DIR(_atol_rv_1_1), 2)
	lda	*(_atol_rv_1_1 + 1)
;     storeRegToAop (a, EXT(__mullong_PARM_1), 2), stacked=0, isaddr=1
	sta	(__mullong_PARM_1 + 1)
;     loadRegFromAop (a, DIR(_atol_rv_1_1), 1)
	lda	*(_atol_rv_1_1 + 2)
;     storeRegToAop (a, EXT(__mullong_PARM_1), 1), stacked=0, isaddr=1
	sta	(__mullong_PARM_1 + 2)
;     loadRegFromAop (a, DIR(_atol_rv_1_1), 0)
	lda	*(_atol_rv_1_1 + 3)
;     storeRegToAop (a, EXT(__mullong_PARM_1), 0), stacked=0, isaddr=1
	sta	(__mullong_PARM_1 + 3)
;     genAssign
;     loadRegFromAop (a, LIT(#0x0A), 3)
;     storeRegToAop (a, EXT(__mullong_PARM_2), 3), stacked=0, isaddr=1
;     loadRegFromAop (a, LIT(#0x0A), 2)
;     storeRegToAop (a, EXT(__mullong_PARM_2), 2), stacked=0, isaddr=1
;     loadRegFromAop (a, LIT(#0x0A), 1)
;     storeRegToAop (a, EXT(__mullong_PARM_2), 1), stacked=0, isaddr=1
; Peephole 5b   - eliminated redundant clra
	clra
	sta	__mullong_PARM_2
	sta	(__mullong_PARM_2 + 1)
	sta	(__mullong_PARM_2 + 2)
;     loadRegFromAop (a, LIT(#0x0A), 0)
	lda	#0x0A
;     storeRegToAop (a, EXT(__mullong_PARM_2), 0), stacked=0, isaddr=1
	sta	(__mullong_PARM_2 + 3)
;     genCall
	jsr	__mullong
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, DIR(_atol_sloc1_1_0), 0), stacked=0, isaddr=0
	sta	*(_atol_sloc1_1_0 + 3)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, DIR(_atol_sloc1_1_0), 1), stacked=0, isaddr=0
	stx	*(_atol_sloc1_1_0 + 2)
	mov	*__ret2,*(_atol_sloc1_1_0 + 1)
	mov	*__ret3,*_atol_sloc1_1_0
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atol_sloc0_1_0), 0)
	ldhx	*_atol_sloc0_1_0
	lda	,x
	aix	#1
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     storeRegToAop (hx, DIR(_atol_sloc0_1_0), 0), stacked=0, isaddr=0
	sthx	*_atol_sloc0_1_0
;     genCast
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, DIR(_atol_sloc2_1_0), 0), stacked=0, isaddr=0
	sta	*(_atol_sloc2_1_0 + 1)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	rola	
	clra	
	sbc	#0x00
;     storeRegToAop (a, DIR(_atol_sloc2_1_0), 1), stacked=0, isaddr=0
	sta	*_atol_sloc2_1_0
; forgot to free a
;     genMinus
;     loadRegFromAop (a, DIR(_atol_sloc2_1_0), 0)
	lda	*(_atol_sloc2_1_0 + 1)
	sub	#0x30
;     storeRegToAop (a, DIR(_atol_sloc2_1_0), 0), stacked=0, isaddr=0
	sta	*(_atol_sloc2_1_0 + 1)
;     loadRegFromAop (a, DIR(_atol_sloc2_1_0), 1)
	lda	*_atol_sloc2_1_0
	sbc	#0x00
;     storeRegToAop (a, DIR(_atol_sloc2_1_0), 1), stacked=0, isaddr=0
	sta	*_atol_sloc2_1_0
;     genCast
	mov	*(_atol_sloc2_1_0 + 1),*(_atol_sloc3_1_0 + 3)
	mov	*_atol_sloc2_1_0,*(_atol_sloc3_1_0 + 2)
;     loadRegFromAop (a, DIR(_atol_sloc2_1_0), 1)
	lda	*_atol_sloc2_1_0
	rola	
	clra	
	sbc	#0x00
;     storeRegToAop (a, DIR(_atol_sloc3_1_0), 2), stacked=0, isaddr=0
	sta	*(_atol_sloc3_1_0 + 1)
;     storeRegToAop (a, DIR(_atol_sloc3_1_0), 3), stacked=0, isaddr=0
	sta	*_atol_sloc3_1_0
; checking lic
; checking IS_ITEMP
; pset=0, pget=0
;     genPlus
;  left size = 4
;  right size = 4
;  result size = 4
;     loadRegFromAop (a, DIR(_atol_sloc1_1_0), 0)
	lda	*(_atol_sloc1_1_0 + 3)
	add	*(_atol_sloc3_1_0 + 3)
;     storeRegToAop (a, DIR(_atol_rv_1_1), 0), stacked=0, isaddr=0
	sta	*(_atol_rv_1_1 + 3)
;     loadRegFromAop (a, DIR(_atol_sloc1_1_0), 1)
	lda	*(_atol_sloc1_1_0 + 2)
	adc	*(_atol_sloc3_1_0 + 2)
;     storeRegToAop (a, DIR(_atol_rv_1_1), 1), stacked=0, isaddr=0
	sta	*(_atol_rv_1_1 + 2)
;     loadRegFromAop (a, DIR(_atol_sloc1_1_0), 2)
	lda	*(_atol_sloc1_1_0 + 1)
	adc	*(_atol_sloc3_1_0 + 1)
;     storeRegToAop (a, DIR(_atol_rv_1_1), 2), stacked=0, isaddr=0
	sta	*(_atol_rv_1_1 + 1)
;     loadRegFromAop (a, DIR(_atol_sloc1_1_0), 3)
	lda	*_atol_sloc1_1_0
	adc	*_atol_sloc3_1_0
;     storeRegToAop (a, DIR(_atol_rv_1_1), 3), stacked=0, isaddr=0
	sta	*_atol_rv_1_1
;_atol.c:44: s++;
	jmp	00115$
00117$:
;_atol.c:47: return (sign ? -rv : rv);
;     genIfx
	tst	*_atol_sign_1_1
;     genIfxJump
; Peephole 2d	- eliminated jmp
	beq	00120$
00148$:
;     genUminus
	clra
	sub	*(_atol_rv_1_1 + 3)
;     storeRegToAop (a, DIR(_atol_sloc3_1_0), 0), stacked=0, isaddr=0
	sta	*(_atol_sloc3_1_0 + 3)
	clra
	sbc	*(_atol_rv_1_1 + 2)
;     storeRegToAop (a, DIR(_atol_sloc3_1_0), 1), stacked=0, isaddr=0
	sta	*(_atol_sloc3_1_0 + 2)
	clra
	sbc	*(_atol_rv_1_1 + 1)
;     storeRegToAop (a, DIR(_atol_sloc3_1_0), 2), stacked=0, isaddr=0
	sta	*(_atol_sloc3_1_0 + 1)
	clra
	sbc	*_atol_rv_1_1
;     storeRegToAop (a, DIR(_atol_sloc3_1_0), 3), stacked=0, isaddr=0
	sta	*_atol_sloc3_1_0
; Peephole 3	- shortened jmp to bra
	bra	00121$
00120$:
;     genAssign
	mov	*_atol_rv_1_1,*_atol_sloc3_1_0
	mov	*(_atol_rv_1_1 + 1),*(_atol_sloc3_1_0 + 1)
	mov	*(_atol_rv_1_1 + 2),*(_atol_sloc3_1_0 + 2)
	mov	*(_atol_rv_1_1 + 3),*(_atol_sloc3_1_0 + 3)
00121$:
;     genRet
	mov	*_atol_sloc3_1_0,*__ret3
	mov	*(_atol_sloc3_1_0 + 1),*__ret2
;     loadRegFromAop (x, DIR(_atol_sloc3_1_0), 1)
	ldx	*(_atol_sloc3_1_0 + 2)
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, DIR(_atol_sloc3_1_0), 0)
	lda	*(_atol_sloc3_1_0 + 3)
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
00118$:
	rts
	.area CSEG (CODE)
	.area CONST   (CODE)
	.area XINIT
