;--------------------------------------------------------
; File Created by ChiponCC : aolisn inc.
; Version 3.0.4#6752 (Nov 19 2015 16:48:50) (MSVC)
; This file was generated Mon Jun 06 10:08:43 2016
;--------------------------------------------------------
; chipon port for the 16-bit core
;--------------------------------------------------------
;	.file	"../main.c"
	.list	p=KF8TS2408
	.radix dec
	.include "KF8TS2408.inc"
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	.extern	_init_mcu
	.extern	_BEE_READ_ONE
	.extern	_BEE_READ_FUN
	.extern	_BEE_WRITE_ONE
	.extern	_BEE_WRITE_FUN
	.extern	_delay_us
	.extern	_PSW_bits
	.extern	_P0_bits
	.extern	_P2_bits
	.extern	_P1_bits
	.extern	_INTCTL_bits
	.extern	_EIF1_bits
	.extern	_EIF2_bits
	.extern	_T1CTL_bits
	.extern	_PWMCTL_bits
	.extern	_CTCTL1_bits
	.extern	_CM1CTL_bits
	.extern	_ANSEH_bits
	.extern	_ADCCTL0_bits
	.extern	_OPTR_bits
	.extern	_IP0_bits
	.extern	_IP1_bits
	.extern	_IP2_bits
	.extern	_TR0_bits
	.extern	_TR2_bits
	.extern	_TR1_bits
	.extern	_EIE1_bits
	.extern	_EIE2_bits
	.extern	_PCTL_bits
	.extern	_OSCCTL_bits
	.extern	_ANSEL_bits
	.extern	_PUR_bits
	.extern	_IOCL_bits
	.extern	_ADCCTL1_bits
	.extern	_P0LR_bits
	.extern	_P2LR_bits
	.extern	_P1LR_bits
	.extern	_CTCTL_bits
	.extern	_BEE_BUFFER
	.extern	_BEE_READ_BUF
	.extern	_KF8_BIT_VALUE1
	.extern	_KF8_BIT_VALUE2
	.extern	_IDLR
	.extern	_T0
	.extern	_PCL
	.extern	_PSW
	.extern	_IR
	.extern	_P0
	.extern	_P2
	.extern	_P1
	.extern	_PCH
	.extern	_INTCTL
	.extern	_EIF1
	.extern	_EIF2
	.extern	_T1L
	.extern	_T1H
	.extern	_T1CTL
	.extern	_PWM1L
	.extern	_PWM1H
	.extern	_PWMCTL
	.extern	_PP1
	.extern	_CTCTL1
	.extern	_CM1CTL
	.extern	_VRECAL1
	.extern	_ANSEH
	.extern	_ADCDATAH
	.extern	_ADCCTL0
	.extern	_OPTR
	.extern	_IP0
	.extern	_IP1
	.extern	_IP2
	.extern	_TR0
	.extern	_TR2
	.extern	_TR1
	.extern	_VRECAL2
	.extern	_EIE1
	.extern	_EIE2
	.extern	_PCTL
	.extern	_OSCCTL
	.extern	_OSCCAL0
	.extern	_ANSEL
	.extern	_PP2
	.extern	_PWM2L
	.extern	_PWM2H
	.extern	_PUR
	.extern	_IOCL
	.extern	_OSCCAL1
	.extern	_BDATAH
	.extern	_BDATAL
	.extern	_BADDRH
	.extern	_BADDRL
	.extern	_EECTL1
	.extern	_EECTL2
	.extern	_ADCDATAL
	.extern	_ADCCTL1
	.extern	_P0LR
	.extern	_P2LR
	.extern	_P1LR
	.extern	_OSCCAL2
	.extern	_OSCCAL3
	.extern	_T3L
	.extern	_CTCTL
	.extern	_T3H
	.extern	_startup
	.extern	__sdcc_gsinit_startup
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
	.global	_delay_ms
	.global	_INT_FUN
	.global	_main

	.global I0R1
	.global I0PCH
	.global I1R1
	.global I1PCH
	.global STK11
	.global STK10
	.global STK09
	.global STK08
	.global STK07
	.global STK06
	.global STK05
	.global STK04
	.global STK03
	.global STK02
	.global STK01
	.global STK00

sharebank .udata 0x0080
I0R1		.res 1
I0PCH		.res 1
I1R1		.res 1
I1PCH		.res 1
STK11	.res 1
	.type STK11, 108
STK10	.res 1
	.type STK10, 108
STK09	.res 1
	.type STK09, 108
STK08	.res 1
	.type STK08, 108
STK07	.res 1
	.type STK07, 108
STK06	.res 1
	.type STK06, 108
STK05	.res 1
	.type STK05, 108
STK04	.res 1
	.type STK04, 108
STK03	.res 1
	.type STK03, 108
STK02	.res 1
	.type STK02, 108
STK01	.res 1
	.type STK01, 108
STK00	.res 1
	.type STK00, 108

;--------------------------------------------------------
; global definitions
;--------------------------------------------------------
;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
UDL_main_0	.udata
r0x1021	.res	1
UDL_main_1	.udata
r0x1020	.res	1
UDL_main_2	.udata
r0x1022	.res	1
UDL_main_3	.udata
r0x1023	.res	1
UDL_main_4	.udata
r0x1024	.res	1
UDL_main_5	.udata
r0x1025	.res	1
UDL_main_6	.udata
r0x1026	.res	1
UDL_main_7	.udata
r0x1027	.res	1
UDL_main_8	.udata
r0x1028	.res	1
UDL_main_9	.udata
r0x1029	.res	1
;--------------------------------------------------------
; initialized data
;--------------------------------------------------------
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
;	.udata_ovr
;--------------------------------------------------------
; reset vector 
;--------------------------------------------------------
STARTUP	.code 0x0000
	NOP
	PAGESEL	init_imp
	JMP		init_imp

	.global	init_imp
INIT_IMP	.code
init_imp
	PAGESEL	_startup
	CALL	_startup
	PAGESEL	__sdcc_gsinit_startup
	CALL	__sdcc_gsinit_startup
	PAGESEL	_main
	JMP		_main
;--------------------------------------------------------
; interrupt and initialization code
;--------------------------------------------------------



func._INT_FUN	.code
;***
;  PostBlock Stats: dbName = I
;***
;entry:  _INT_FUN	;Function start
; 0 exit points
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_INT_FUN	;Function start
; 0 exit points
;	op : LABEL
;	op : ENDFUNCTION
; R3 resprent for wsave,R4 resprent for ssave, R5 resprent for psave
interrupt_service_routine_0x04
_00014_DS_
;	.line	39; "../main.c"	}
	IRET	



func._main	.code
;***
;  PostBlock Stats: dbName = M
;***
;entry:  _main	;Function start
; 2 exit points
;has an exit
;functions called:
;   _init_mcu
;   _delay_ms
;   _BEE_WRITE_FUN
;   _BEE_WRITE_FUN
;   _BEE_READ_ONE
;   _BEE_WRITE_FUN
;   _BEE_WRITE_FUN
;   _BEE_WRITE_ONE
;   _init_mcu
;   _delay_ms
;   _BEE_WRITE_FUN
;   _BEE_WRITE_FUN
;   _BEE_READ_ONE
;   _BEE_WRITE_FUN
;   _BEE_WRITE_FUN
;   _BEE_WRITE_ONE
;7 compiler assigned registers:
;   STK00
;   r0x1026
;   r0x1027
;   r0x1028
;   r0x1029
;   STK01
;   STK02
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_main	;Function start
; 2 exit points
;	op : CALL
;	.line	52; "../main.c"	init_mcu();						//初始化MCU寄存器
	PAGESEL	_init_mcu
	CALL	_init_mcu
	PAGESEL	$
;	op : SEND
;	op : CALL
;	.line	53; "../main.c"	delay_ms(200);					//延时一会，防止上电误触发触摸通道
	MOV	R0,# 0xc8
	BANKSEL	STK00
	MOV	STK00, R0
	MOV	R0,# 0x00
	PAGESEL	_delay_ms
	CALL	_delay_ms
	PAGESEL	$
;	op : =
;	.line	56; "../main.c"	for (i = 0; i < BEE_BUFFER_MAX; i++)
	BANKSEL	r0x1026
	CLR	r0x1026
	BANKSEL	r0x1027
	CLR	r0x1027
;	op : =
	BANKSEL	r0x1028
	CLR	r0x1028
;	op : LABEL
;	op : <
;unsigned compare: left < lit(0x10=16), size=1
_00019_DS_
	MOV	R0,# 0x10
	BANKSEL	r0x1028
	SUB	R0, r0x1028
;comparing bytes at offset 0
	JNB	PSW, 0
	JMP	_00022_DS_
;	op : LEFT_OP
;	.line	58; "../main.c"	BEE_BUFFER[i] = temp;
	CLR	PSW, 0
	BANKSEL	r0x1028
	RLCR	r0x1028
	BANKSEL	r0x1029
	MOV	r0x1029, R0
;	op : +
	MOV	R0,# (_BEE_BUFFER + 0)
	BANKSEL	r0x1029
	ADD	r0x1029, R0
;	op : =
	BANKSEL	r0x1026
	MOVZ	R0, r0x1026
	BANKSEL	r0x1029
	MOV	R1, r0x1029
	BANKSEL	_BEE_BUFFER
	ST	[R1], R0
	INC	R1
	BANKSEL	r0x1027
	MOVZ	R0, r0x1027
	BANKSEL	_BEE_BUFFER
	ST	[R1], R0
;	op : +
;	.line	59; "../main.c"	temp += 0x1111;
	MOV	R0,# 0x11
	BANKSEL	r0x1026
	ADD	r0x1026, R0
	MOV	R0,# 0x11
	JNB	PSW, 0
	MOV	R0,# 0x12
	BANKSEL	r0x1027
	ADD	r0x1027, R0
;	op : +
;	.line	56; "../main.c"	for (i = 0; i < BEE_BUFFER_MAX; i++)
	BANKSEL	r0x1028
	INC	r0x1028
;	op : GOTO
	JMP	_00019_DS_
;	op : LABEL
;	op : SEND
;	op : SEND
;	op : CALL
_00022_DS_
;	.line	62; "../main.c"	BEE_WRITE_FUN(0x0800,BEE_BUFFER_MAX);
	MOV	R0,# 0x10
	BANKSEL	STK01
	MOV	STK01, R0
	MOV	R0,# 0x00
	MOV	STK00, R0
	MOV	R0,# 0x08
	PAGESEL	_BEE_WRITE_FUN
	CALL	_BEE_WRITE_FUN
	PAGESEL	$
;	op : SEND
;	op : SEND
;	op : CALL
;	.line	63; "../main.c"	BEE_WRITE_FUN(0x0810,BEE_BUFFER_MAX);
	MOV	R0,# 0x10
	BANKSEL	STK01
	MOV	STK01, R0
	MOV	R0,# 0x10
	MOV	STK00, R0
	MOV	R0,# 0x08
	PAGESEL	_BEE_WRITE_FUN
	CALL	_BEE_WRITE_FUN
	PAGESEL	$
;	op : SEND
;	op : CALL
;	.line	65; "../main.c"	temp=BEE_READ_ONE(0x0809);
	MOV	R0,# 0x09
	BANKSEL	STK00
	MOV	STK00, R0
	MOV	R0,# 0x08
	PAGESEL	_BEE_READ_ONE
	CALL	_BEE_READ_ONE
	PAGESEL	$
	BANKSEL	r0x1027
	MOV	r0x1027, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1026
	MOV	r0x1026, R0
;	op : =
;	.line	67; "../main.c"	for (i = 0; i < 4; i++)
	BANKSEL	r0x1028
	CLR	r0x1028
;	op : LABEL
;	op : <
;unsigned compare: left < lit(0x4=4), size=1
_00023_DS_
	MOV	R0,# 0x04
	BANKSEL	r0x1028
	SUB	R0, r0x1028
;comparing bytes at offset 0
	JNB	PSW, 0
	JMP	_00026_DS_
;	op : LEFT_OP
;	.line	69; "../main.c"	BEE_BUFFER[i] = 0xFFF1;
	CLR	PSW, 0
	BANKSEL	r0x1028
	RLCR	r0x1028
	BANKSEL	r0x1029
	MOV	r0x1029, R0
;	op : +
	MOV	R0,# (_BEE_BUFFER + 0)
	BANKSEL	r0x1029
	ADD	r0x1029, R0
;	op : =
	MOV	R0,# 0xf1
	BANKSEL	r0x1029
	MOV	R1, r0x1029
	BANKSEL	_BEE_BUFFER
	ST	[R1], R0
	INC	R1
	MOV	R0,# 0xff
	BANKSEL	_BEE_BUFFER
	ST	[R1], R0
;	op : +
;	.line	67; "../main.c"	for (i = 0; i < 4; i++)
	BANKSEL	r0x1028
	INC	r0x1028
;	op : GOTO
	JMP	_00023_DS_
;	op : LABEL
;	op : SEND
;	op : SEND
;	op : CALL
_00026_DS_
;	.line	72; "../main.c"	BEE_WRITE_FUN(0x0820,4);
	MOV	R0,# 0x04
	BANKSEL	STK01
	MOV	STK01, R0
	MOV	R0,# 0x20
	MOV	STK00, R0
	MOV	R0,# 0x08
	PAGESEL	_BEE_WRITE_FUN
	CALL	_BEE_WRITE_FUN
	PAGESEL	$
;	op : =
;d:\svn\workspace\compiler\chipon16target\gen.c:8828: size=0/2, offset=0, AOP_TYPE(res)=7
;	.line	74; "../main.c"	BEE_BUFFER[1]=temp;
	BANKSEL	r0x1026
	MOVZ	R0, r0x1026
	BANKSEL	_BEE_BUFFER
	MOV	 (_BEE_BUFFER + 2), R0
;d:\svn\workspace\compiler\chipon16target\gen.c:8828: size=1/2, offset=1, AOP_TYPE(res)=7
	BANKSEL	r0x1027
	MOVZ	R0, r0x1027
	BANKSEL	_BEE_BUFFER
	MOV	 (_BEE_BUFFER + 3), R0
;	op : =
;d:\svn\workspace\compiler\chipon16target\gen.c:8828: size=0/2, offset=0, AOP_TYPE(res)=7
;	.line	75; "../main.c"	BEE_BUFFER[3]=0xFF33; //验证 用 0x0F9C
	MOV	R0,# 0x33
	BANKSEL	_BEE_BUFFER
	MOV	 (_BEE_BUFFER + 6), R0
;d:\svn\workspace\compiler\chipon16target\gen.c:8828: size=1/2, offset=1, AOP_TYPE(res)=7
	MOV	R0,# 0xff
	BANKSEL	_BEE_BUFFER
	MOV	 (_BEE_BUFFER + 7), R0
;	op : SEND
;	op : SEND
;	op : CALL
;	.line	77; "../main.c"	BEE_WRITE_FUN(0x0828,4);
	MOV	R0,# 0x04
	BANKSEL	STK01
	MOV	STK01, R0
	MOV	R0,# 0x28
	MOV	STK00, R0
	MOV	R0,# 0x08
	PAGESEL	_BEE_WRITE_FUN
	CALL	_BEE_WRITE_FUN
	PAGESEL	$
;	op : SEND
;	op : SEND
;	op : CALL
;	.line	79; "../main.c"	BEE_WRITE_ONE(0x0830,0x55AA);
	MOV	R0,# 0xaa
	BANKSEL	STK02
	MOV	STK02, R0
	MOV	R0,# 0x55
	MOV	STK01, R0
	MOV	R0,# 0x30
	MOV	STK00, R0
	MOV	R0,# 0x08
	PAGESEL	_BEE_WRITE_ONE
	CALL	_BEE_WRITE_ONE
	PAGESEL	$
;	op : LABEL
;	op : GOTO
_00017_DS_
;	.line	81; "../main.c"	while (1);
	JMP	_00017_DS_
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _main



func._delay_ms	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _delay_ms	;Function start
; 2 exit points
;has an exit
;7 compiler assigned registers:
;   r0x1020
;   STK00
;   r0x1021
;   r0x1022
;   r0x1023
;   r0x1024
;   r0x1025
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_delay_ms	;Function start
; 2 exit points
;	op : RECEIVE
;	.line	16; "../main.c"	void delay_ms(uint ms_data)
	BANKSEL	r0x1020
	MOV	r0x1020, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1021
	MOV	r0x1021, R0
;	op : =
;	op : LABEL
;	op : =
_00004_DS_
;	.line	19; "../main.c"	while(ms_data--)
	BANKSEL	r0x1021
	MOVZ	R0, r0x1021
	BANKSEL	r0x1022
	MOV	r0x1022, R0
	BANKSEL	r0x1020
	MOVZ	R0, r0x1020
	BANKSEL	r0x1023
	MOV	r0x1023, R0
;	op : -
	MOV	R0,# 0xff
	BANKSEL	r0x1021
	ADD	r0x1021, R0
	JNB	PSW, 0
	JMP	_00038_DS_
	BANKSEL	r0x1020
	DEC	r0x1020
;	op : IFX
_00038_DS_
	BANKSEL	r0x1022
	MOVZ	R0, r0x1022
	BANKSEL	r0x1023
	ORL	R0, r0x1023
	JNB	PSW, 2
	JMP	_00007_DS_
;	op : INLINEASM
	CWDT 
;	op : =
;	.line	23; "../main.c"	while(j--)
	MOV	R0,# 0xc8
	BANKSEL	r0x1022
	MOV	r0x1022, R0
	BANKSEL	r0x1023
	CLR	r0x1023
;	op : LABEL
;	op : =
_00001_DS_
	BANKSEL	r0x1022
	MOVZ	R0, r0x1022
	BANKSEL	r0x1024
	MOV	r0x1024, R0
	BANKSEL	r0x1023
	MOVZ	R0, r0x1023
	BANKSEL	r0x1025
	MOV	r0x1025, R0
;	op : -
	MOV	R0,# 0xff
	BANKSEL	r0x1022
	ADD	r0x1022, R0
	JNB	PSW, 0
	JMP	_00039_DS_
	BANKSEL	r0x1023
	DEC	r0x1023
;	op : IFX
_00039_DS_
	BANKSEL	r0x1024
	MOVZ	R0, r0x1024
	BANKSEL	r0x1025
	ORL	R0, r0x1025
	JNB	PSW, 2
	JMP	_00004_DS_
;	op : INLINEASM
	CWDT 
;	op : GOTO
	JMP	_00001_DS_
;	op : LABEL
;	op : ENDFUNCTION
_00007_DS_
	CRET	
; exit point of _delay_ms


;	code size estimation:
;	  149+   61 =   210 instructions (  542 byte)


	.end
