;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.3.3 Sun Nov 18 14:30:04 2007

;--------------------------------------------------------
	.module main
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _main
	.globl _mymodify
	.globl _myputchar
	.globl _mygetchar
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
_SCON	=	0x0098
_TMOD	=	0x0089
_TCON	=	0x0088
_PCON	=	0x0087
_TH1	=	0x008d
_TL1	=	0x008b
_SBUF	=	0x0099
;--------------------------------------------------------
; special function bits 
;--------------------------------------------------------
_RI	=	0x0098
_TI	=	0x0099
;--------------------------------------------------------
; overlayable register banks 
;--------------------------------------------------------
	.area REG_BANK_0	(REL,OVR,DATA)
	.ds 8
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
	.area DSEG    (DATA)
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
	.area	OSEG    (OVR,DATA)
	.area	OSEG    (OVR,DATA)
;--------------------------------------------------------
; Stack segment in internal ram 
;--------------------------------------------------------
	.area	SSEG	(DATA)
__start__stack:
	.ds	1

;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
	.area ISEG    (DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
	.area BSEG    (BIT)
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
	.area XSEG    (XDATA)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG   (XDATA)
;--------------------------------------------------------
; interrupt vector 
;--------------------------------------------------------
	.area CSEG    (CODE)
__interrupt_vect:
	ljmp	__sdcc_gsinit_startup
	reti
	.ds	7
	reti
	.ds	7
	reti
	.ds	7
	reti
	.ds	7
	reti
	.ds	7
	reti
	.ds	7
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area GSINIT  (CODE)
	.area GSFINAL (CODE)
	.area GSINIT  (CODE)
__sdcc_gsinit_startup:
	mov	sp,#__start__stack - 1
	lcall	__sdcc_external_startup
	mov	a,dpl
	jz	__sdcc_init_data
	ljmp	__sdcc_program_startup
__sdcc_init_data:
;	_mcs51_genXINIT() start
	mov	a,#l_XINIT
	orl	a,#l_XINIT>>8
	jz	00003$
	mov	a,#s_XINIT
	add	a,#l_XINIT
	mov	r1,a
	mov	a,#s_XINIT>>8
	addc	a,#l_XINIT>>8
	mov	r2,a
	mov	dptr,#s_XINIT
	mov	r0,#s_XISEG
	mov	p2,#(s_XISEG >> 8)
00001$:	clr	a
	movc	a,@a+dptr
	movx	@r0,a
	inc	dptr
	inc	r0
	cjne	r0,#0,00002$
	inc	p2
00002$:	mov	a,dpl
	cjne	a,ar1,00001$
	mov	a,dph
	cjne	a,ar2,00001$
	mov	p2,#0xFF
00003$:
;	_mcs51_genXINIT() end
	.area GSFINAL (CODE)
	ljmp	__sdcc_program_startup
;--------------------------------------------------------
; Home
;--------------------------------------------------------
	.area HOME    (CODE)
	.area CSEG    (CODE)
;--------------------------------------------------------
; code
;--------------------------------------------------------
	.area CSEG    (CODE)
__sdcc_program_startup:
	lcall	_main
;	return from main will lock up
	sjmp .
;------------------------------------------------------------
;Allocation info for local variables in function 'mygetchar'
;------------------------------------------------------------
;------------------------------------------------------------
;main.c:12: char mygetchar(void)
;	-----------------------------------------
;	 function mygetchar
;	-----------------------------------------
_mygetchar:
	ar2 = 0x02
	ar3 = 0x03
	ar4 = 0x04
	ar5 = 0x05
	ar6 = 0x06
	ar7 = 0x07
	ar0 = 0x00
	ar1 = 0x01
;main.c:14: while (RI == 0) { };
00101$:
;     genNot
	mov	c,_RI
	cpl	c
	clr	a
	rlc	a
;     genIfx
;       Peephole 105   removed redundant mov
	mov  r2,a
;     genIfxJump
;       Peephole 109   removed ljmp by inverse jump logic
	jnz  00101$
00108$:
;main.c:15: RI = 0;
;     genAssign
	clr	_RI
;main.c:16: return (char) SBUF;
;     genAssign
	mov	dpl,_SBUF
;     genRet
00104$:
	ret
;------------------------------------------------------------
;Allocation info for local variables in function 'myputchar'
;------------------------------------------------------------
;------------------------------------------------------------
;main.c:19: void myputchar(char c)
;	-----------------------------------------
;	 function myputchar
;	-----------------------------------------
_myputchar:
;     genReceive
	mov	_SBUF,dpl
;main.c:22: while (TI == 0) { };
00101$:
;     genNot
	mov	c,_TI
	cpl	c
	clr	a
	rlc	a
;     genIfx
;       Peephole 105   removed redundant mov
	mov  r2,a
;     genIfxJump
;       Peephole 109   removed ljmp by inverse jump logic
	jnz  00101$
00108$:
;main.c:23: TI = 0;
;     genAssign
	clr	_TI
00104$:
	ret
;------------------------------------------------------------
;Allocation info for local variables in function 'mymodify'
;------------------------------------------------------------
;------------------------------------------------------------
;main.c:26: char mymodify(char c)
;	-----------------------------------------
;	 function mymodify
;	-----------------------------------------
_mymodify:
;     genReceive
	mov	r2,dpl
;main.c:28: return c + 5;
;     genPlus
	mov	a,#0x05
;       Peephole 236a
	add  a,r2
	mov	dpl,a
;     genRet
00101$:
	ret
;------------------------------------------------------------
;Allocation info for local variables in function 'main'
;------------------------------------------------------------
;znak                      Allocated to registers r2 
;------------------------------------------------------------
;main.c:30: void main(void)
;	-----------------------------------------
;	 function main
;	-----------------------------------------
_main:
;main.c:33: SCON=0x50;
;     genAssign
	mov	_SCON,#0x50
;main.c:34: TMOD &= 0x0f;
;     genAnd
	anl	_TMOD,#0x0F
;main.c:35: TMOD |= 0x20;
;     genOr
	orl	_TMOD,#0x20
;main.c:36: TCON=0x40;
;     genAssign
	mov	_TCON,#0x40
;main.c:37: PCON=0x80;
;     genAssign
	mov	_PCON,#0x80
;main.c:38: TH1 = TL1 = 0xfd;
;     genAssign
	mov	_TL1,#0xFD
;     genAssign
	mov	_TH1,#0xFD
;main.c:39: TI = 0;
;     genAssign
	clr	_TI
00102$:
;main.c:43: myputchar('E');
;     genCall
	mov	dpl,#0x45
	lcall	_myputchar
;main.c:44: myputchar('D');
;     genCall
	mov	dpl,#0x44
	lcall	_myputchar
;main.c:45: myputchar('Y');
;     genCall
	mov	dpl,#0x59
	lcall	_myputchar
;main.c:46: myputchar('2');
;     genCall
	mov	dpl,#0x32
	lcall	_myputchar
;main.c:47: myputchar('0');
;     genCall
	mov	dpl,#0x30
	lcall	_myputchar
;main.c:48: myputchar(' ');
;     genCall
	mov	dpl,#0x20
	lcall	_myputchar
;main.c:49: myputchar('M');
;     genCall
	mov	dpl,#0x4D
	lcall	_myputchar
;main.c:50: myputchar('A');
;     genCall
	mov	dpl,#0x41
	lcall	_myputchar
;main.c:51: myputchar(' ');
;     genCall
	mov	dpl,#0x20
	lcall	_myputchar
;main.c:52: myputchar('K');
;     genCall
	mov	dpl,#0x4B
	lcall	_myputchar
;main.c:53: myputchar('O');
;     genCall
	mov	dpl,#0x4F
	lcall	_myputchar
;main.c:54: myputchar('T');
;     genCall
	mov	dpl,#0x54
	lcall	_myputchar
;main.c:55: myputchar('A');
;     genCall
	mov	dpl,#0x41
	lcall	_myputchar
;main.c:56: myputchar(' ');
;     genCall
	mov	dpl,#0x20
	lcall	_myputchar
;main.c:57: myputchar('A');
;     genCall
	mov	dpl,#0x41
	lcall	_myputchar
;main.c:58: myputchar('L');
;     genCall
	mov	dpl,#0x4C
	lcall	_myputchar
;main.c:59: myputchar('I');
;     genCall
	mov	dpl,#0x49
	lcall	_myputchar
;main.c:60: myputchar('K');
;     genCall
	mov	dpl,#0x4B
	lcall	_myputchar
;main.c:61: myputchar('A');
;     genCall
	mov	dpl,#0x41
	lcall	_myputchar
;main.c:62: myputchar('\r');
;     genCall
	mov	dpl,#0x0D
	lcall	_myputchar
;main.c:63: myputchar('\n');
;     genCall
	mov	dpl,#0x0A
	lcall	_myputchar
;main.c:64: znak = mygetchar();
;     genCall
	lcall	_mygetchar
	mov	a,dpl
;     genAssign
	mov	r2,a
;main.c:65: myputchar(znak);
;     genCall
	mov	dpl,r2
	push	ar2
	lcall	_myputchar
	pop	ar2
;main.c:66: znak = mymodify(znak);
;     genCall
	mov	dpl,r2
	push	ar2
	lcall	_mymodify
	mov	a,dpl
	pop	ar2
;     genAssign
	mov	r2,a
;main.c:67: myputchar(znak);
;     genCall
	mov	dpl,r2
	lcall	_myputchar
;main.c:68: myputchar('\r');
;     genCall
	mov	dpl,#0x0D
	lcall	_myputchar
;main.c:69: myputchar('\n');
;     genCall
	mov	dpl,#0x0A
	lcall	_myputchar
	ljmp	00102$
00104$:
	ret
	.area CSEG    (CODE)
	.area XINIT   (CODE)
