;--------------------------------------------------------
; File Created by ChiponCC : aolisn inc.
; Version 3.0.4#6752 (Jun  6 2016 11:07:59) (MSVC)
; This file was generated Mon Jul 04 11:21:24 2016
;--------------------------------------------------------
; chipon port for the 16-bit core
;--------------------------------------------------------
;	.file	"../main.c"
	.radix dec
	.include "KF8TS2408.inc"
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	.extern	_init_mcu
	.extern	__KF8TS24_Get_Ver_Waterproof_
	.extern	__KF8TS24_Init_Touch_Waterproof_
	.extern	__KF8TS24_Touch_Process_Waterproof_
	.extern	__KF8TS24_Touch_TEST_Waterproof_
	.extern	__R2PCL
	.extern	_TOUCH_DEBUG_TRS_DEAL
	.extern	_TOUCH_DEBUG_SEND_OUT
	.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	__KF8_LIBi_channel_flag_
	.extern	__KF8_LIBc_channel_
	.extern	__KF8_LIBc_channel_Buf
	.extern	__KF8_LIBi_Date_Change_
	.extern	__KF8_LIBc_baseline_count_
	.extern	__KF8_LIBi_buff_hit_
	.extern	__KF8_LIBi_buff_baseline_
	.extern	__KF8_LIBc_touch_count_
	.extern	_CHS_AMOUNT
	.extern	_TCS_AMOUNT
	.extern	__KF8_Disturb_Protect_Circle_
	.extern	__KF8_DoubleKey_Compages_Limitable_Circle_
	.extern	__KF8_Key_Max_Pressed_Limitable_Circle_
	.extern	__KF8_BaseLine_Update_Circle_Count_For_UP_
	.extern	__KF8_BaseLine_Update_Circle_Count_For_Down_
	.extern	__KF8_Define_Disturb_Channels_Amount_
	.extern	__KF8_BasicLine_UP_Noise_Threshold_
	.extern	__KF8_BasicLine_Down_Noise_Threshold_
	.extern	__KF8_Data_Steady_Threshold_Set_
	.extern	__KF8_Inside_Reference_Channel_Disturb_Threshold_Set_
	.extern	__KF8_Inside_Reference_Channel_Declare_
	.extern	__KF8_Config_Finger_Threshold
	.extern	__KF8_Water_Monitor_
	.extern	__KF8_CONFIG_FINGER_THRESHOLD_IN_WATER_
	.extern	_Double_Key_SET_EN_1
	.extern	_Double_Key_SET_EN_2
	.extern	_Double_Key_SET_EN_3
	.extern	__KF8_TOUCH_CH_EN
	.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_us
	.global	_delay_ms
	.global	_KeyBCDSendFuc
	.global	_INT_FUN
	.global	_main
	.global	_temp

	.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
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
;--------------------------------------------------------
UD_main_0	.udata
_temp	.res	1

;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
UDL_main_0	.udata
r0x1003	.res	1
UDL_main_1	.udata
r0x1002	.res	1
UDL_main_2	.udata
r0x1004	.res	1
UDL_main_3	.udata
r0x1005	.res	1
UDL_main_4	.udata
r0x1006	.res	1
UDL_main_5	.udata
r0x1007	.res	1
UDL_main_6	.udata
r0x1009	.res	1
UDL_main_7	.udata
r0x1008	.res	1
UDL_main_8	.udata
r0x100A	.res	1
UDL_main_9	.udata
r0x100B	.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
;--------------------------------------------------------
interrupt_0x04	.code	0x4
	MOV		R2,R0
	MOV		R3,PSW
	MOV		R0,PCH
	BANKSEL	I0PCH
	MOV		I0PCH,R0
	MOV		I0R1,R1
	PAGESEL	interrupt_service_routine_0x04
	JMP		interrupt_service_routine_0x04



func._INT_FUN	.code
;***
;  PostBlock Stats: dbName = I
;***
;entry:  _INT_FUN	;Function start
; 0 exit points
;functions called:
;   __KF8TS24_Touch_Process_Waterproof_
;   __KF8TS24_Touch_Process_Waterproof_
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_INT_FUN	;Function start
; 0 exit points
;	op : GET_VALUE_AT_ADDRESS
; R3 resprent for wsave,R4 resprent for ssave, R5 resprent for psave
interrupt_service_routine_0x04
;	.line	119; "../main.c"	if(CTIF)
	JB	_EIF2_bits, 7
	JMP	_00047_DS_
;	op : =
;	.line	121; "../main.c"	CTIF=0;
	CLR	_EIF2_bits, 7
;	op : INLINEASM
	CWDT 
;	op : CALL
;	.line	125; "../main.c"	_KF8TS24_Touch_Process_Waterproof_(); //更新按键标志
	PAGESEL	__KF8TS24_Touch_Process_Waterproof_
	CALL	__KF8TS24_Touch_Process_Waterproof_
	PAGESEL	$
;	op : LABEL
;	op : ENDFUNCTION
_00047_DS_
	BANKSEL	I0R1
	MOV	R1, I0R1
	BANKSEL	I0PCH
	MOV	R0, I0PCH
	MOV	PCH, R0
	MOV	PSW, R3
	MOV	R0, R2
	IRET	



func._main	.code
;***
;  PostBlock Stats: dbName = M
;***
;entry:  _main	;Function start
; 2 exit points
;has an exit
;functions called:
;   _init_mcu
;   _delay_ms
;   __KF8TS24_Init_Touch_Waterproof_
;   _KeyBCDSendFuc
;   _init_mcu
;   _delay_ms
;   __KF8TS24_Init_Touch_Waterproof_
;   _KeyBCDSendFuc
;1 compiler assigned register :
;   STK00
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_main	;Function start
; 2 exit points
;	op : CALL
;	.line	139; "../main.c"	init_mcu();						//初始化MCU寄存器
	PAGESEL	_init_mcu
	CALL	_init_mcu
	PAGESEL	$
;	op : SEND
;	op : CALL
;	.line	140; "../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	141; "../main.c"	CTCTL1 = 0x50;    //设置触摸分频和基准电压
	MOV	R0,# 0x50
	MOV	_CTCTL1, R0
;	op : INLINEASM
	CWDT 
;	op : CALL
;	.line	143; "../main.c"	_KF8TS24_Init_Touch_Waterproof_();		//调用电容触摸库函数的初始化
	PAGESEL	__KF8TS24_Init_Touch_Waterproof_
	CALL	__KF8TS24_Init_Touch_Waterproof_
	PAGESEL	$
;	op : INLINEASM
	CWDT 
;	op : LABEL
;	op : CALL
_00051_DS_
;	.line	147; "../main.c"	KeyBCDSendFuc();
	PAGESEL	_KeyBCDSendFuc
	CALL	_KeyBCDSendFuc
	PAGESEL	$
;	op : GOTO
	JMP	_00051_DS_
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _main



func._delay_us	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _delay_us	;Function start
; 2 exit points
;has an exit
;5 compiler assigned registers:
;   r0x1008
;   STK00
;   r0x1009
;   r0x100A
;   r0x100B
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_delay_us	;Function start
; 2 exit points
;	op : RECEIVE
;	.line	106; "../main.c"	void delay_us(uint us_data)
	BANKSEL	r0x1008
	MOV	r0x1008, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1009
	MOV	r0x1009, R0
;	op : =
;	op : LABEL
;	op : =
_00038_DS_
;	.line	108; "../main.c"	while(us_data--);
	BANKSEL	r0x1009
	MOVZ	R0, r0x1009
	BANKSEL	r0x100A
	MOV	r0x100A, R0
	BANKSEL	r0x1008
	MOVZ	R0, r0x1008
	BANKSEL	r0x100B
	MOV	r0x100B, R0
;	op : -
	MOV	R0,# 0xff
	BANKSEL	r0x1009
	ADD	r0x1009, R0
	JNB	PSW, 0
	JMP	_00056_DS_
	BANKSEL	r0x1008
	DEC	r0x1008
;	op : IFX
_00056_DS_
	BANKSEL	r0x100A
	MOVZ	R0, r0x100A
	BANKSEL	r0x100B
	ORL	R0, r0x100B
	JB	PSW, 2
	JMP	_00038_DS_
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _delay_us



func._delay_ms	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _delay_ms	;Function start
; 2 exit points
;has an exit
;7 compiler assigned registers:
;   r0x1002
;   STK00
;   r0x1003
;   r0x1004
;   r0x1005
;   r0x1006
;   r0x1007
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_delay_ms	;Function start
; 2 exit points
;	op : RECEIVE
;	.line	87; "../main.c"	void delay_ms(uint ms_data)
	BANKSEL	r0x1002
	MOV	r0x1002, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1003
	MOV	r0x1003, R0
;	op : =
;	op : LABEL
;	op : =
_00028_DS_
;	.line	90; "../main.c"	while(ms_data--)
	BANKSEL	r0x1003
	MOVZ	R0, r0x1003
	BANKSEL	r0x1004
	MOV	r0x1004, R0
	BANKSEL	r0x1002
	MOVZ	R0, r0x1002
	BANKSEL	r0x1005
	MOV	r0x1005, R0
;	op : -
	MOV	R0,# 0xff
	BANKSEL	r0x1003
	ADD	r0x1003, R0
	JNB	PSW, 0
	JMP	_00057_DS_
	BANKSEL	r0x1002
	DEC	r0x1002
;	op : IFX
_00057_DS_
	BANKSEL	r0x1004
	MOVZ	R0, r0x1004
	BANKSEL	r0x1005
	ORL	R0, r0x1005
	JNB	PSW, 2
	JMP	_00031_DS_
;	op : INLINEASM
	CWDT 
;	op : =
;	.line	94; "../main.c"	while(j--)
	MOV	R0,# 0xc8
	BANKSEL	r0x1004
	MOV	r0x1004, R0
	BANKSEL	r0x1005
	CLR	r0x1005
;	op : LABEL
;	op : =
_00025_DS_
	BANKSEL	r0x1004
	MOVZ	R0, r0x1004
	BANKSEL	r0x1006
	MOV	r0x1006, R0
	BANKSEL	r0x1005
	MOVZ	R0, r0x1005
	BANKSEL	r0x1007
	MOV	r0x1007, R0
;	op : -
	MOV	R0,# 0xff
	BANKSEL	r0x1004
	ADD	r0x1004, R0
	JNB	PSW, 0
	JMP	_00058_DS_
	BANKSEL	r0x1005
	DEC	r0x1005
;	op : IFX
_00058_DS_
	BANKSEL	r0x1006
	MOVZ	R0, r0x1006
	BANKSEL	r0x1007
	ORL	R0, r0x1007
	JNB	PSW, 2
	JMP	_00028_DS_
;	op : INLINEASM
	CWDT 
;	op : GOTO
	JMP	_00025_DS_
;	op : LABEL
;	op : ENDFUNCTION
_00031_DS_
	CRET	
; exit point of _delay_ms



func._KeyBCDSendFuc	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _KeyBCDSendFuc	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_KeyBCDSendFuc	;Function start
; 2 exit points
;	op : EQ_OP
;	.line	35; "../main.c"	switch(_KF8_LIBi_channel_flag_)
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, __KF8_LIBi_channel_flag_
	BANKSEL	__KF8_LIBi_channel_flag_
	ORL	R0, (__KF8_LIBi_channel_flag_ + 1)
	JNB	PSW, 2
	JMP	_00001_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, __KF8_LIBi_channel_flag_
	XOR	R0,# 0x01
	JB	PSW, 2
	JMP	_00019_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, (__KF8_LIBi_channel_flag_ + 1)
	XOR	R0,# 0x00
	JNB	PSW, 2
	JMP	_00002_DS_
_00019_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, __KF8_LIBi_channel_flag_
	XOR	R0,# 0x02
	JB	PSW, 2
	JMP	_00020_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, (__KF8_LIBi_channel_flag_ + 1)
	XOR	R0,# 0x00
	JNB	PSW, 2
	JMP	_00003_DS_
_00020_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, __KF8_LIBi_channel_flag_
	XOR	R0,# 0x04
	JB	PSW, 2
	JMP	_00021_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, (__KF8_LIBi_channel_flag_ + 1)
	XOR	R0,# 0x00
	JNB	PSW, 2
	JMP	_00004_DS_
_00021_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, __KF8_LIBi_channel_flag_
	XOR	R0,# 0x08
	JB	PSW, 2
	JMP	_00022_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, (__KF8_LIBi_channel_flag_ + 1)
	XOR	R0,# 0x00
	JNB	PSW, 2
	JMP	_00005_DS_
_00022_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, __KF8_LIBi_channel_flag_
	XOR	R0,# 0x00
	JB	PSW, 2
	JMP	_00023_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, (__KF8_LIBi_channel_flag_ + 1)
	XOR	R0,# 0x04
	JNB	PSW, 2
	JMP	_00006_DS_
_00023_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, __KF8_LIBi_channel_flag_
	XOR	R0,# 0x00
	JB	PSW, 2
	JMP	_00024_DS_
	BANKSEL	__KF8_LIBi_channel_flag_
	MOVZ	R0, (__KF8_LIBi_channel_flag_ + 1)
	XOR	R0,# 0x08
	JNB	PSW, 2
	JMP	_00007_DS_
_00024_DS_
	JMP	_00009_DS_
_00001_DS_
;	.line	39; "../main.c"	OUT3=0;
	CLR	_P0LR_bits, 2
;	op : =
;	.line	40; "../main.c"	OUT2=0;
	CLR	_P0LR_bits, 1
;	op : =
;	.line	41; "../main.c"	OUT1=0;
	CLR	_P0LR_bits, 0
;	op : GOTO
;	.line	42; "../main.c"	}break;
	JMP	_00009_DS_
;	op : LABEL
;	op : =
_00002_DS_
;	.line	45; "../main.c"	OUT3=0;
	CLR	_P0LR_bits, 2
;	op : =
;	.line	46; "../main.c"	OUT2=0;
	CLR	_P0LR_bits, 1
;	op : =
;	.line	47; "../main.c"	OUT1=1;
	SET	_P0LR_bits, 0
;	op : GOTO
;	.line	48; "../main.c"	}break;
	JMP	_00009_DS_
;	op : LABEL
;	op : =
_00003_DS_
;	.line	51; "../main.c"	OUT3=0;
	CLR	_P0LR_bits, 2
;	op : =
;	.line	52; "../main.c"	OUT2=1;
	SET	_P0LR_bits, 1
;	op : =
;	.line	53; "../main.c"	OUT1=0;
	CLR	_P0LR_bits, 0
;	op : GOTO
;	.line	54; "../main.c"	}break;
	JMP	_00009_DS_
;	op : LABEL
;	op : =
_00004_DS_
;	.line	57; "../main.c"	OUT3=0;
	CLR	_P0LR_bits, 2
;	op : =
;	.line	58; "../main.c"	OUT2=1;
	SET	_P0LR_bits, 1
;	op : =
;	.line	59; "../main.c"	OUT1=1;
	SET	_P0LR_bits, 0
;	op : GOTO
;	.line	60; "../main.c"	}break;
	JMP	_00009_DS_
;	op : LABEL
;	op : =
_00005_DS_
;	.line	63; "../main.c"	OUT3=1;
	SET	_P0LR_bits, 2
;	op : =
;	.line	64; "../main.c"	OUT2=0;
	CLR	_P0LR_bits, 1
;	op : =
;	.line	65; "../main.c"	OUT1=0;
	CLR	_P0LR_bits, 0
;	op : GOTO
;	.line	66; "../main.c"	}break;
	JMP	_00009_DS_
;	op : LABEL
;	op : =
_00006_DS_
;	.line	69; "../main.c"	OUT3=1;
	SET	_P0LR_bits, 2
;	op : =
;	.line	70; "../main.c"	OUT2=0;
	CLR	_P0LR_bits, 1
;	op : =
;	.line	71; "../main.c"	OUT1=1;
	SET	_P0LR_bits, 0
;	op : GOTO
;	.line	72; "../main.c"	}break;
	JMP	_00009_DS_
;	op : LABEL
;	op : =
_00007_DS_
;	.line	75; "../main.c"	OUT3=1;
	SET	_P0LR_bits, 2
;	op : =
;	.line	76; "../main.c"	OUT2=1;
	SET	_P0LR_bits, 1
;	op : =
;	.line	77; "../main.c"	OUT1=0;
	CLR	_P0LR_bits, 0
;	op : LABEL
;	op : ENDFUNCTION
_00009_DS_
;	.line	79; "../main.c"	}
	CRET	
; exit point of _KeyBCDSendFuc


;	code size estimation:
;	  163+   49 =   212 instructions (  522 byte)


	.end
