;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.3.3 Sun Jan 27 14:46:45 2008

;--------------------------------------------------------
	.module main
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _kolumna
	.globl _klawiszZKolumny
	.globl _wysw
	.globl _cyfra
	.globl _main
	.globl _obsluga_timera
	.globl _init
	.globl _U10
	.globl _U12
	.globl _U15
	.globl _k
	.globl _u15
	.globl _tab
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
_SCON	=	0x0098
_TMOD	=	0x0089
_TCON	=	0x0088
_PCON	=	0x0087
_TH1	=	0x008d
_TL1	=	0x008b
_SBUF	=	0x0099
_IE	=	0x00a8
;--------------------------------------------------------
; 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)
_tab::
	.ds 4
_u15::
	.ds 1
_k::
	.ds 2
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
	.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)
_U15	=	0x8000
_U12	=	0x8000
_U10	=	0xffff
;--------------------------------------------------------
; 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
	ljmp	_obsluga_timera
	.ds	5
	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
;main.c:65: int k = 0; /* kolumna */
;     genAssign
	clr	a
	mov	(_k + 1),a
	mov	_k,a
	.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 'init'
;------------------------------------------------------------
;------------------------------------------------------------
;main.c:54: void init(void)
;	-----------------------------------------
;	 function init
;	-----------------------------------------
_init:
	ar2 = 0x02
	ar3 = 0x03
	ar4 = 0x04
	ar5 = 0x05
	ar6 = 0x06
	ar7 = 0x07
	ar0 = 0x00
	ar1 = 0x01
;main.c:56: IE = 0x88;
;     genAssign
	mov	_IE,#0x88
;main.c:57: TMOD = 0x20;
;     genAssign
	mov	_TMOD,#0x20
;main.c:58: TH1 = TL1 = 0x64;
;     genAssign
	mov	_TL1,#0x64
;     genAssign
	mov	_TH1,#0x64
;main.c:59: TCON = 0x40;
;     genAssign
	mov	_TCON,#0x40
;main.c:60: U15 = U15 & kolumna[0];
;     genPointerGet
;     genCodePointerGet
	mov	dptr,#_kolumna
	clr	a
	movc	a,@a+dptr
	mov	r2,a
;     genAssign
	mov	dptr,#_U15
	movx	a,@dptr
	mov	r3,a
;     genAnd
	mov	dptr,#_U15
	mov	a,r2
	anl	a,r3
	movx	@dptr,a
00101$:
	ret
;------------------------------------------------------------
;Allocation info for local variables in function 'obsluga_timera'
;------------------------------------------------------------
;------------------------------------------------------------
;main.c:67: void obsluga_timera(void) interrupt 3
;	-----------------------------------------
;	 function obsluga_timera
;	-----------------------------------------
_obsluga_timera:
	push	acc
	push	b
	push	dpl
	push	dph
	push	ar2
	push	ar3
	push	psw
	mov	psw,#0x00
;main.c:72: if ((U12 & 0x0f) == 0x0e)
;     genAssign
	mov	dptr,#_U12
	movx	a,@dptr
	mov	r2,a
;     genAnd
	anl	ar2,#0x0F
;     genCmpEq
;       Peephole 132   changed ljmp to sjmp
;       Peephole 199   optimized misc jump sequence
	cjne r2,#0x0E,00110$
;00130$:
;       Peephole 200   removed redundant sjmp
00131$:
;main.c:74: U10 = 0;
;     genAssign
	mov	dptr,#_U10
;       Peephole 180   changed mov to clr
	clr  a
	movx	@dptr,a
;main.c:75: u15 = ((u15 & 0x0f) | 0xd0) & 0xdf;
;     genAnd
	mov	a,#0x0F
	anl	a,_u15
;     genOr
	orl	a,#0xD0
;     genAnd
	anl	a,#0xDF
;main.c:76: U15 = u15;
;     genAssign
;       Peephole 100   removed redundant mov
	mov  _u15,a
	mov  dptr,#_U15
	movx @dptr,a
;main.c:77: U10 = cyfra_kropka;
;     genAssign
	mov	dptr,#_U10
	mov	a,#0x80
	movx	@dptr,a
	ljmp	00111$
00110$:
;main.c:79: else if ((U12 & 0x0f) == 0x0b)
;     genAssign
	mov	dptr,#_U12
	movx	a,@dptr
	mov	r2,a
;     genAnd
	anl	ar2,#0x0F
;     genCmpEq
;       Peephole 132   changed ljmp to sjmp
;       Peephole 199   optimized misc jump sequence
	cjne r2,#0x0B,00107$
;00132$:
;       Peephole 200   removed redundant sjmp
00133$:
;main.c:81: U10 = 0;
;     genAssign
	mov	dptr,#_U10
;       Peephole 180   changed mov to clr
	clr  a
	movx	@dptr,a
;main.c:82: u15 = ((u15 & 0x0f) | 0x70) & 0x7f;
;     genAnd
	mov	a,#0x0F
	anl	a,_u15
;     genOr
	orl	a,#0x70
;     genAnd
	anl	a,#0x7F
;main.c:83: U15 = u15;
;     genAssign
;       Peephole 100   removed redundant mov
	mov  _u15,a
	mov  dptr,#_U15
	movx @dptr,a
;main.c:84: U10 = cyfra_kropka;
;     genAssign
	mov	dptr,#_U10
	mov	a,#0x80
	movx	@dptr,a
;       Peephole 132   changed ljmp to sjmp
	sjmp 00111$
00107$:
;main.c:86: else if ((U12 & 0x0f) == 0x0d)
;     genAssign
	mov	dptr,#_U12
	movx	a,@dptr
	mov	r2,a
;     genAnd
	anl	ar2,#0x0F
;     genCmpEq
;       Peephole 132   changed ljmp to sjmp
;       Peephole 199   optimized misc jump sequence
	cjne r2,#0x0D,00104$
;00134$:
;       Peephole 200   removed redundant sjmp
00135$:
;main.c:88: U10 = 0;
;     genAssign
	mov	dptr,#_U10
;       Peephole 180   changed mov to clr
	clr  a
	movx	@dptr,a
;main.c:89: u15 = ((u15 & 0x0f) | 0xe0) & 0xef;
;     genAnd
	mov	a,#0x0F
	anl	a,_u15
;     genOr
	orl	a,#0xE0
;     genAnd
	anl	a,#0xEF
;main.c:90: U15 = u15;
;     genAssign
;       Peephole 100   removed redundant mov
	mov  _u15,a
	mov  dptr,#_U15
	movx @dptr,a
;main.c:91: U10 = cyfra_kropka;
;     genAssign
	mov	dptr,#_U10
	mov	a,#0x80
	movx	@dptr,a
;       Peephole 132   changed ljmp to sjmp
	sjmp 00111$
00104$:
;main.c:93: else if ((U12 & 0x0f) == 0x07)
;     genAssign
	mov	dptr,#_U12
	movx	a,@dptr
	mov	r2,a
;     genAnd
	anl	ar2,#0x0F
;     genCmpEq
;       Peephole 132   changed ljmp to sjmp
;       Peephole 199   optimized misc jump sequence
	cjne r2,#0x07,00111$
;00136$:
;       Peephole 200   removed redundant sjmp
00137$:
;main.c:95: U10 = 0;
;     genAssign
	mov	dptr,#_U10
;       Peephole 180   changed mov to clr
	clr  a
	movx	@dptr,a
;main.c:96: u15 = ((u15 & 0x0f) | 0xb0) & 0xbf;
;     genAnd
	mov	a,#0x0F
	anl	a,_u15
;     genOr
	orl	a,#0xB0
;     genAnd
	anl	a,#0xBF
;main.c:97: U15 = u15;
;     genAssign
;       Peephole 100   removed redundant mov
	mov  _u15,a
	mov  dptr,#_U15
	movx @dptr,a
;main.c:98: U10 = cyfra_kropka;
;     genAssign
	mov	dptr,#_U10
	mov	a,#0x80
	movx	@dptr,a
00111$:
;main.c:113: if ((U12 & 0xf0) == klawiszZKolumny[0])
;     genAssign
	mov	dptr,#_U12
	movx	a,@dptr
	mov	r2,a
;     genAnd
	anl	ar2,#0xF0
;     genPointerGet
;     genCodePointerGet
	mov	dptr,#_klawiszZKolumny
	clr	a
	movc	a,@a+dptr
	mov	r3,a
;     genCmpEq
	mov	a,r2
;       Peephole 132   changed ljmp to sjmp
;       Peephole 199   optimized misc jump sequence
	cjne a,ar3,00113$
;00138$:
;       Peephole 200   removed redundant sjmp
00139$:
;main.c:115: U10 = cyfra_0;
;     genAssign
	mov	dptr,#_U10
	mov	a,#0x5F
	movx	@dptr,a
00113$:
;main.c:117: if ((U12 & 0xf0) == klawiszZKolumny[1])
;     genAssign
	mov	dptr,#_U12
	movx	a,@dptr
	mov	r2,a
;     genAnd
	anl	ar2,#0xF0
;     genPointerGet
;     genCodePointerGet
	mov	dptr,#(_klawiszZKolumny + 0x0001)
	clr	a
	movc	a,@a+dptr
	mov	r3,a
;     genCmpEq
	mov	a,r2
;       Peephole 132   changed ljmp to sjmp
;       Peephole 199   optimized misc jump sequence
	cjne a,ar3,00115$
;00140$:
;       Peephole 200   removed redundant sjmp
00141$:
;main.c:119: U10 = cyfra_1;
;     genAssign
	mov	dptr,#_U10
	mov	a,#0x44
	movx	@dptr,a
00115$:
;main.c:121: if ((U12 & 0xf0) == klawiszZKolumny[2])
;     genAssign
	mov	dptr,#_U12
	movx	a,@dptr
	mov	r2,a
;     genAnd
	anl	ar2,#0xF0
;     genPointerGet
;     genCodePointerGet
	mov	dptr,#(_klawiszZKolumny + 0x0002)
	clr	a
	movc	a,@a+dptr
	mov	r3,a
;     genCmpEq
	mov	a,r2
;       Peephole 132   changed ljmp to sjmp
;       Peephole 199   optimized misc jump sequence
	cjne a,ar3,00117$
;00142$:
;       Peephole 200   removed redundant sjmp
00143$:
;main.c:123: U10 = cyfra_2;
;     genAssign
	mov	dptr,#_U10
	mov	a,#0x3E
	movx	@dptr,a
00117$:
;main.c:125: if ((U12 & 0xf0) == klawiszZKolumny[3])
;     genAssign
	mov	dptr,#_U12
	movx	a,@dptr
	mov	r2,a
;     genAnd
	anl	ar2,#0xF0
;     genPointerGet
;     genCodePointerGet
	mov	dptr,#(_klawiszZKolumny + 0x0003)
	clr	a
	movc	a,@a+dptr
	mov	r3,a
;     genCmpEq
	mov	a,r2
;       Peephole 132   changed ljmp to sjmp
;       Peephole 199   optimized misc jump sequence
	cjne a,ar3,00119$
;00144$:
;       Peephole 200   removed redundant sjmp
00145$:
;main.c:127: U10 = cyfra_3;
;     genAssign
	mov	dptr,#_U10
	mov	a,#0x76
	movx	@dptr,a
00119$:
;main.c:151: k = (k + 1) % 4;
;     genPlus
;     genPlusIncr
	mov	a,#0x01
	add	a,_k
	mov	r2,a
;       Peephole 180   changed mov to clr
	clr  a
	addc	a,(_k + 1)
	mov	r3,a
;     genAssign
	clr	a
	mov	(__modsint_PARM_2 + 1),a
	mov	__modsint_PARM_2,#0x04
;     genCall
	mov	dpl,r2
	mov	dph,r3
	lcall	__modsint
	mov	a,dpl
	mov	b,dph
;     genAssign
	mov	_k,a
	mov	(_k + 1),b
00120$:
	pop	psw
	pop	ar3
	pop	ar2
	pop	dph
	pop	dpl
	pop	b
	pop	acc
	reti
;------------------------------------------------------------
;Allocation info for local variables in function 'main'
;------------------------------------------------------------
;------------------------------------------------------------
;main.c:162: void main(void)
;	-----------------------------------------
;	 function main
;	-----------------------------------------
_main:
;main.c:164: init();
;     genCall
	lcall	_init
;main.c:165: SCON=0x50;
;     genAssign
	mov	_SCON,#0x50
;main.c:166: PCON=0x80;
;     genAssign
	mov	_PCON,#0x80
;main.c:167: TI = 0;
;     genAssign
	clr	_TI
00102$:
;       Peephole 132   changed ljmp to sjmp
	sjmp 00102$
00104$:
	ret
	.area CSEG    (CODE)
_cyfra:
	.db #0x5F
	.db #0x44
	.db #0x3E
	.db #0x76
	.db #0x65
	.db #0x73
	.db #0x7B
	.db #0x46
	.db #0x7F
	.db #0x77
_wysw:
	.db #0xD0
	.db #0xE0
	.db #0x70
	.db #0xB0
_klawiszZKolumny:
	.db #0xD0
	.db #0xE0
	.db #0x70
	.db #0xB0
_kolumna:
	.db #0xFD
	.db #0xFE
	.db #0xF7
	.db #0xFB
	.area XINIT   (CODE)
