;--------------------------------------------------------
; File Created by ChiponCC : ChipON  inc.
; Version 3.0.4#6752 (Jul 10 2019 19:07:19) (MSVC)
; This file was generated Tue Sep 24 10:43:42 2019
;--------------------------------------------------------
; chipon port for the 16-bit core
;--------------------------------------------------------
	.file	"../main.c"
	.radix dec
	.include "KF8A100FTN.inc"
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	.extern	_Init_osc
	.extern	_Init_GPIO
	.extern	_Init_intrup
	.extern	_Init_T4
	.extern	_Init_CCP4
	.extern	__hmullong
	.extern	__divulong
	.extern	_STKR0
	.extern	_STK00
	.extern	_STK01
	.extern	_STK02
	.extern	_STK03
	.extern	_STK04
	.extern	_STK05
	.extern	_STK06
	.extern	_STK07
	.extern	_STK08
	.extern	_STK09
	.extern	_STK10
	.extern	_STK11
	.extern	_PSW_bits
	.extern	_P0_bits
	.extern	_P2_bits
	.extern	_P1_bits
	.extern	_P3_bits
	.extern	_PCH_bits
	.extern	_INTCTL_bits
	.extern	_EIF1_bits
	.extern	_EIF2_bits
	.extern	_T1CTL_bits
	.extern	_T2CTL0_bits
	.extern	_CCP3CTL_bits
	.extern	_BANK_bits
	.extern	_ADSCANCTL_bits
	.extern	_AMPCTL_bits
	.extern	_ANS1_bits
	.extern	_ADCCTL0_bits
	.extern	_AMPDT_bits
	.extern	_OPTR_bits
	.extern	_IP0_bits
	.extern	_IP1_bits
	.extern	_IP2_bits
	.extern	_TR0_bits
	.extern	_TR2_bits
	.extern	_TR1_bits
	.extern	_OSCSTA_bits
	.extern	_IP3_bits
	.extern	_VREFCTL_bits
	.extern	_EIE1_bits
	.extern	_EIE2_bits
	.extern	_PCTL_bits
	.extern	_OSCCTL_bits
	.extern	_ANS0_bits
	.extern	_ANS2_bits
	.extern	_ANS3_bits
	.extern	_OSC0CAL2_bits
	.extern	_PUR0_bits
	.extern	_IOCL0_bits
	.extern	_ADCCTL1_bits
	.extern	_P0LR_bits
	.extern	_P2LR_bits
	.extern	_P1LR_bits
	.extern	_P3LR_bits
	.extern	_TR3_bits
	.extern	_EIE3_bits
	.extern	_EIF3_bits
	.extern	_T3CTL_bits
	.extern	_PWM5CTL0_bits
	.extern	_ADCINTCTL_bits
	.extern	_PWM5CTL1_bits
	.extern	_P5ASCTL0_bits
	.extern	_PSTRCTL0_bits
	.extern	_PUR1_bits
	.extern	_PUR2_bits
	.extern	_TMRBUZ_bits
	.extern	_ADCCTL2_bits
	.extern	_INTEDGCTL_bits
	.extern	_IOCL4_bits
	.extern	_PUR3_bits
	.extern	_CCP4CTL_bits
	.extern	_PWM5OC_bits
	.extern	_T2CTL1_bits
	.extern	_PWM5FC_bits
	.extern	_P5ASCTL1_bits
	.extern	_PSTRCTL1_bits
	.extern	_PWM5CTL2_bits
	.extern	_PWM5PC_bits
	.extern	_RSCTL1_bits
	.extern	_BRCTL1_bits
	.extern	_TSCTL1_bits
	.extern	_USLPEN1_bits
	.extern	_SSCICTL0_bits
	.extern	_SSCICTL1_bits
	.extern	_SSCISTA_bits
	.extern	_SSCIMSK_bits
	.extern	_WDTPS_bits
	.extern	_MULCTL_bits
	.extern	_DIVCTL_bits
	.extern	_LEDCTL_bits
	.extern	_LEDPRE_bits
	.extern	_LEDDATA0_bits
	.extern	_LEDDATA1_bits
	.extern	_LEDDATA2_bits
	.extern	_LEDDATA3_bits
	.extern	_LEDDATA4_bits
	.extern	_LEDDATA5_bits
	.extern	_LEDDATA6_bits
	.extern	_LEDDATA7_bits
	.extern	_LEDDATA8_bits
	.extern	_LEDDATA9_bits
	.extern	_LEDDATAA_bits
	.extern	_LEDDATAB_bits
	.extern	_LEDDATAC_bits
	.extern	_LEDDATAD_bits
	.extern	_UPINSET1_bits
	.extern	_LPRCCTL_bits
	.extern	_PCAL_bits
	.extern	_LEDDATAE_bits
	.extern	_LEDDATAF_bits
	.extern	_LEDCTL2_bits
	.extern	_LEDOMS_bits
	.extern	_LEDLUM_bits
	.extern	_T4CTL_bits
	.extern	_ANS4_bits
	.extern	_ANS5_bits
	.extern	_P4_bits
	.extern	_P4LR_bits
	.extern	_TR4_bits
	.extern	_PUR4_bits
	.extern	_P5_bits
	.extern	_P5LR_bits
	.extern	_TR5_bits
	.extern	_PUR5_bits
	.extern	_PWMCTL0_bits
	.extern	_PWMCTL1_bits
	.extern	_PWM3CTL_bits
	.extern	_TEMPSNR_bits
	.extern	_UPINSET2_bits
	.extern	_U7816CTL2_bits
	.extern	_U7816RXCTL2_bits
	.extern	_U7816TXCTL2_bits
	.extern	_CLKDIV2_bits
	.extern	_EGTCTL2_bits
	.extern	_TZBRGH2_bits
	.extern	_TZBRGL2_bits
	.extern	_USLPEN2_bits
	.extern	_BRCTL2_bits
	.extern	_RSCTL2_bits
	.extern	_TSCTL2_bits
	.extern	_BKPCTL_bits
	.extern	_EIE4_bits
	.extern	_EIF4_bits
	.extern	_IP4_bits
	.extern	_CTCHCOMB0_bits
	.extern	_CTCHCOMB1_bits
	.extern	_CTCHCOMB2_bits
	.extern	_APFCTL0_bits
	.extern	_APFCTL1_bits
	.extern	_APFCTL2_bits
	.extern	_APFCTL3_bits
	.extern	_APFCTL4_bits
	.extern	_APFCTL5_bits
	.extern	_APFCTL6_bits
	.extern	_APFCTL7_bits
	.extern	_APFCTL8_bits
	.extern	_APFCTL9_bits
	.extern	_APFCTLA_bits
	.extern	_APFCTLB_bits
	.extern	_T0
	.extern	_PCL
	.extern	_PSW
	.extern	_P0
	.extern	_P2
	.extern	_P1
	.extern	_P3
	.extern	_PCH
	.extern	_INTCTL
	.extern	_EIF1
	.extern	_EIF2
	.extern	_T1L
	.extern	_T1H
	.extern	_T1CTL
	.extern	_T2L
	.extern	_T2CTL0
	.extern	_CCP3CTL
	.extern	_CCP3H
	.extern	_CCP3L
	.extern	_BANK
	.extern	_ADSCANCTL
	.extern	_AMPCTL
	.extern	_ANS1
	.extern	_ADCDATA0H
	.extern	_ADCCTL0
	.extern	_AMPDT
	.extern	_OPTR
	.extern	_IP0
	.extern	_IP1
	.extern	_IP2
	.extern	_TR0
	.extern	_TR2
	.extern	_TR1
	.extern	_OSCSTA
	.extern	_IP3
	.extern	_VREFCTL
	.extern	_EIE1
	.extern	_EIE2
	.extern	_PCTL
	.extern	_OSCCTL
	.extern	_OSCCAL0
	.extern	_ANS0
	.extern	_ANS2
	.extern	_ANS3
	.extern	_OSC0CAL2
	.extern	_PUR0
	.extern	_IOCL0
	.extern	_OSCCAL1
	.extern	_NVMDATAH
	.extern	_NVMDATAL
	.extern	_NVMADDRH
	.extern	_NVMADDRL
	.extern	_NVMCTL0
	.extern	_NVMCTL1
	.extern	_ADCDATA0L
	.extern	_ADCCTL1
	.extern	_T2CCR0H
	.extern	_T2H
	.extern	_PP5H
	.extern	_PWM5H0
	.extern	_PWM5H1
	.extern	_P0LR
	.extern	_P2LR
	.extern	_P1LR
	.extern	_P3LR
	.extern	_TR3
	.extern	_EIE3
	.extern	_EIF3
	.extern	_OSCCAL2
	.extern	_OSCCAL3
	.extern	_T3CTL
	.extern	_T3L
	.extern	_ADCDATA1H
	.extern	_ADCDATA1L
	.extern	_PP5L
	.extern	_T2CCR0L
	.extern	_PWM5L0
	.extern	_PWM5L1
	.extern	_PWM5CTL0
	.extern	_ADCINTCTL
	.extern	_ADCDATA2H
	.extern	_ADCDATA2L
	.extern	_PWM5CTL1
	.extern	_P5ASCTL0
	.extern	_PSTRCTL0
	.extern	_ADCDATA3H
	.extern	_T3H
	.extern	_PUR1
	.extern	_PUR2
	.extern	_TMRBUZ
	.extern	_ADCCTL2
	.extern	_INTEDGCTL
	.extern	_ADCDATA3L
	.extern	_IOCL4
	.extern	_PUR3
	.extern	_CCP4L
	.extern	_CCP4H
	.extern	_DIVRH
	.extern	_CCP4CTL
	.extern	_PWM5L2
	.extern	_PWM5L3
	.extern	_PWM5OC
	.extern	_T2CTL1
	.extern	_DIVBH
	.extern	_T2CCR1L
	.extern	_T2CCR1H
	.extern	_PWM5FC
	.extern	_P5ASCTL1
	.extern	_PSTRCTL1
	.extern	_PWM5CTL2
	.extern	_PWM5PC
	.extern	_PWM5H2
	.extern	_PWM5H3
	.extern	_RSCTL1
	.extern	_TXSDR1
	.extern	_RXSDR1
	.extern	_BRCTL1
	.extern	_TSCTL1
	.extern	_EUBRGL1
	.extern	_EUBRGH1
	.extern	_USLPEN1
	.extern	_SSCICTL0
	.extern	_SSCICTL1
	.extern	_SSCISTA
	.extern	_SSCIBUFR
	.extern	_UARTMTH1
	.extern	_SSCIADD
	.extern	_SSCIMSK
	.extern	_WDTPS
	.extern	_MULAH
	.extern	_MULAL
	.extern	_MULBH
	.extern	_MULBL
	.extern	_MULCTL
	.extern	_MULRES3
	.extern	_MULRES2
	.extern	_MULRES1
	.extern	_MULRES0
	.extern	_DIVCTL
	.extern	_DIVAH
	.extern	_DIVAL
	.extern	_DIVBL
	.extern	_DIVQH
	.extern	_DIVQL
	.extern	_DIVRL
	.extern	_LEDCTL
	.extern	_LEDPRE
	.extern	_LEDDATA0
	.extern	_LEDDATA1
	.extern	_LEDDATA2
	.extern	_LEDDATA3
	.extern	_LEDDATA4
	.extern	_LEDDATA5
	.extern	_LEDDATA6
	.extern	_LEDDATA7
	.extern	_LEDDATA8
	.extern	_LEDDATA9
	.extern	_LEDDATAA
	.extern	_LEDDATAB
	.extern	_LEDDATAC
	.extern	_LEDDATAD
	.extern	_UPINSET1
	.extern	_LPRCCTL
	.extern	_LPRCCAL
	.extern	_XTALCAL
	.extern	_PCAL
	.extern	_LEDDATAE
	.extern	_LEDDATAF
	.extern	_LEDCTL2
	.extern	_LEDOMS
	.extern	_VREFCAL0
	.extern	_VREFCAL1
	.extern	_LEDLUM
	.extern	_T3REL
	.extern	_T3REH
	.extern	_T4L
	.extern	_T4H
	.extern	_T4REL
	.extern	_T4REH
	.extern	_T4CTL
	.extern	_RC32KCAL
	.extern	_ANS4
	.extern	_ANS5
	.extern	_P4
	.extern	_P4LR
	.extern	_TR4
	.extern	_PUR4
	.extern	_P5
	.extern	_P5LR
	.extern	_TR5
	.extern	_PUR5
	.extern	_PWMCTL0
	.extern	_PWMCTL1
	.extern	_PP1
	.extern	_PP2
	.extern	_PWM10L
	.extern	_PWM20H
	.extern	_PWM11L
	.extern	_PWM21H
	.extern	_PWM12L
	.extern	_PWM22H
	.extern	_PWM13L
	.extern	_PWM23H
	.extern	_PWM3CTL
	.extern	_PP3H
	.extern	_PP3L
	.extern	_PWM30H
	.extern	_PWM31H
	.extern	_PWM32H
	.extern	_PWM33H
	.extern	_PWM30L
	.extern	_PWM31L
	.extern	_PWM32L
	.extern	_PWM33L
	.extern	_TEMPSNR
	.extern	_UPINSET2
	.extern	_U7816CTL2
	.extern	_U7816RXCTL2
	.extern	_U7816TXCTL2
	.extern	_CLKDIV2
	.extern	_EGTCTL2
	.extern	_TZBRGH2
	.extern	_TZBRGL2
	.extern	_UARTMTH2
	.extern	_USLPEN2
	.extern	_BRCTL2
	.extern	_RSCTL2
	.extern	_RXSDR2
	.extern	_EUBRGH2
	.extern	_EUBRGL2
	.extern	_TXSDR2
	.extern	_TSCTL2
	.extern	_BKPCTL
	.extern	_EIE4
	.extern	_EIF4
	.extern	_IP4
	.extern	_CTCHCOMB0
	.extern	_CTCHCOMB1
	.extern	_CTCHCOMB2
	.extern	_APFCTL0
	.extern	_APFCTL1
	.extern	_APFCTL2
	.extern	_APFCTL3
	.extern	_APFCTL4
	.extern	_APFCTL5
	.extern	_APFCTL6
	.extern	_APFCTL7
	.extern	_APFCTL8
	.extern	_APFCTL9
	.extern	_APFCTLA
	.extern	_APFCTLB
	.extern	_startup
	.extern	__gsinit_startup
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
	.global	_main
	.global	_int_fun0
	.global	_int_fun1
	.global	_Flag
	.global	_Mode
	.global	_Duty
	.global	_Freg
	.global	_T1_cnt
	.global	_T2_cnt

	.global I0R1
	.global I0R7
	.global I0PSW
	.global I0PCH
	.global I1R1
	.global I1R7
	.global I1PSW
	.global I1PCH
	.define _STK11	STK11
	.global STK11
	.define _STK10	STK10
	.global STK10
	.define _STK09	STK09
	.global STK09
	.define _STK08	STK08
	.global STK08
	.define _STK07	STK07
	.global STK07
	.define _STK06	STK06
	.global STK06
	.define _STK05	STK05
	.global STK05
	.define _STK04	STK04
	.global STK04
	.define _STK03	STK03
	.global STK03
	.define _STK02	STK02
	.global STK02
	.define _STK01	STK01
	.global STK01
	.define _STK00	STK00
	.global STK00

sharebank .udata
I0R1		.res 1
I0R7		.res 1
I0PSW		.res 1
I0PCH		.res 1
I1R1		.res 1
I1R7		.res 1
I1PSW		.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
_Duty	.res	4

UD_main_1	.udata
_Freg	.res	4

;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
UDL_main_0	.udata
r0x1015	.res	1
UDL_main_1	.udata
r0x1014	.res	1
UDL_main_2	.udata
r0x1013	.res	1
UDL_main_3	.udata
r0x1012	.res	1
UDL_main_4	.udata
r0x1016	.res	1
UDL_main_5	.udata
r0x1017	.res	1
UDL_main_6	.udata
r0x1019	.res	1
UDL_main_7	.udata
r0x101A	.res	1
UDL_main_8	.udata
r0x101B	.res	1
UDL_main_9	.udata
r0x101C	.res	1
;--------------------------------------------------------
; initialized data
;--------------------------------------------------------

ID_main_0	.idata
_Flag
	.db	0x00


ID_main_1	.idata
_Mode
	.db	0x00


ID_main_2	.idata
_T1_cnt
	.db	0x00, 0x00, 0x00, 0x00


ID_main_3	.idata
_T2_cnt
	.db	0x00, 0x00, 0x00, 0x00

;--------------------------------------------------------
; 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	__gsinit_startup
	CALL	__gsinit_startup
	PAGESEL	_main
	JMP		_main
;--------------------------------------------------------
; interrupt and initialization code
;--------------------------------------------------------
interrupt_0x04	.code	0x4
	MOV		R2,R0
	MOV		R3,BANK
	MOV		R0,PSW
	BANKSEL	I0PSW
	MOV		I0PSW,R0
	MOV		R0,PCH
	BANKSEL	I0PCH
	MOV		I0PCH,R0
	MOV		I0R1,R1
	MOV		I0R7,R7
	PAGESEL	interrupt_service_routine_0x04
	JMP		interrupt_service_routine_0x04



func._int_fun0	.code
;***
;  PostBlock Stats: dbName = I
;***
;entry:  _int_fun0	;Function start
; 0 exit points
;7 compiler assigned registers:
;   r0x1016
;   r0x1017
;   r0x1018
;   r0x1019
;   r0x101A
;   r0x101B
;   r0x101C
;; Starting PostCode block
	.def _int_fun0_function_begin, debug, value=$

;	::->op : LABEL
;	::->op : FUNCTION
_int_fun0	;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	52; "../main.c"	if(CCP4IF)
	BANKSEL	_EIF3_bits
	JB	_EIF3_bits, 4
	JMP	_00025_DS_
;	::->op :*  =
	.line	54; "../main.c"	CCP4IF =0;
	BANKSEL	_EIF3_bits
	CLR	_EIF3_bits, 4
;	::->op : IFX
	.line	55; "../main.c"	if(Mode)//比较模式
	MOV	R0,# 0x00
	BANKSEL	_Mode
	ORL	R0, _Mode
	JNB	PSW, 2
	JMP	_00021_DS_
;	::->op : GET_VALUE_AT_ADDRESS
	.line	57; "../main.c"	if(P12)//开始输出高电平
	BANKSEL	_P1_bits
	JB	_P1_bits, 2
	JMP	_00015_DS_
;	::->op :*  =
	.line	59; "../main.c"	T4ON =0;
	BANKSEL	_T4CTL_bits
	CLR	_T4CTL_bits, 0
;	::->op : =
	.line	60; "../main.c"	T4H =0;
	BANKSEL	_T4H
	CLR	_T4H
;	::->op : =
	.line	61; "../main.c"	T4L =0;
	BANKSEL	_T4L
	CLR	_T4L
;	::->op :*  =
	.line	62; "../main.c"	T4ON =1;
	BANKSEL	_T4CTL_bits
	SET	_T4CTL_bits, 0
;	::->op : =
	.line	64; "../main.c"	CCP4H =0x01;
	MOV	R0,# 0x01
	BANKSEL	_CCP4H
	MOV	_CCP4H, R0
;	::->op : =
	.line	65; "../main.c"	CCP4L =0xF4;
	MOV	R0,# 0xf4
	BANKSEL	_CCP4L
	MOV	_CCP4L, R0
;	::->op : GOTO
	JMP	_00025_DS_
;	::->op : LABEL
;	::->op : =
_00015_DS_
	.line	69; "../main.c"	CCP4H =0x03;
	MOV	R0,# 0x03
	BANKSEL	_CCP4H
	MOV	_CCP4H, R0
;	::->op : =
	.line	70; "../main.c"	CCP4L =0xE8;
	MOV	R0,# 0xe8
	BANKSEL	_CCP4L
	MOV	_CCP4L, R0
;	::->op : GOTO
	JMP	_00025_DS_
;	::->op : LABEL
;	::->op : GET_VALUE_AT_ADDRESS
_00021_DS_
	.line	75; "../main.c"	if(P12)//刚捕捉到的是上升沿
	BANKSEL	_P1_bits
	JB	_P1_bits, 2
	JMP	_00018_DS_
;	::->op : CAST
	.line	77; "../main.c"	T2_cnt =CCP4H<<8;
	BANKSEL	_CCP4H
	MOVZ	R0, _CCP4H
	BANKSEL	r0x1016
	MOV	r0x1016, R0
	BANKSEL	r0x1017
	CLR	r0x1017
;	::->op : LEFT_OP
;;101	MOVZ	R0, r0x1016
;;99	MOV	r0x1018, R0
	BANKSEL	r0x1019
	CLR	r0x1019
;	::->op : CAST
	MOV	R0,# 0x00
	BANKSEL	_T2_cnt
	MOV	_T2_cnt, R0
;;100	MOVZ	R0, r0x1018
	BANKSEL	r0x1016
	MOVZ	R0, r0x1016
	BANKSEL	_T2_cnt
	MOV	(_T2_cnt + 1), R0
	MOV	R0,# 0x00
	BANKSEL	(_T2_cnt + 1)
	JNB	(_T2_cnt + 1), 7
	MOV	R0,# 0xff
	BANKSEL	_T2_cnt
	MOV	(_T2_cnt + 3), R0
	BANKSEL	_T2_cnt
	MOV	(_T2_cnt + 2), R0
;	::->op : =
	.line	78; "../main.c"	T2_cnt +=CCP4L;
	BANKSEL	_CCP4L
	MOVZ	R0, _CCP4L
	BANKSEL	r0x1019
	MOV	r0x1019, R0
;	::->op : CAST
	BANKSEL	r0x1019
	MOVZ	R0, r0x1019
	BANKSEL	r0x1016
	MOV	r0x1016, R0
	BANKSEL	r0x1017
	CLR	r0x1017
	BANKSEL	r0x101A
	CLR	r0x101A
	BANKSEL	r0x101B
	CLR	r0x101B
;	::->op : +
	BANKSEL	r0x1016
	MOV	R0, r0x1016
	BANKSEL	_T2_cnt
	ADD	_T2_cnt, R0
	MOV	R0,# 0x00
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00033_DS_
	BANKSEL	_T2_cnt
	ADD	(_T2_cnt + 1), R0
_00033_DS_
	BANKSEL	r0x101A
	MOVZ	R0, r0x101A
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00034_DS_
	BANKSEL	_T2_cnt
	ADD	(_T2_cnt + 2), R0
_00034_DS_
	BANKSEL	r0x101B
	MOVZ	R0, r0x101B
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00035_DS_
	BANKSEL	_T2_cnt
	ADD	(_T2_cnt + 3), R0
;	::->op :*  =
_00035_DS_
	.line	80; "../main.c"	T4ON =0;
	BANKSEL	_T4CTL_bits
	CLR	_T4CTL_bits, 0
;	::->op : =
	.line	81; "../main.c"	T4H =0;
	BANKSEL	_T4H
	CLR	_T4H
;	::->op : =
	.line	82; "../main.c"	T4L =0;
	BANKSEL	_T4L
	CLR	_T4L
;	::->op :*  =
	.line	83; "../main.c"	T4ON =1;
	BANKSEL	_T4CTL_bits
	SET	_T4CTL_bits, 0
;	::->op :*  =
	.line	85; "../main.c"	CCP4IE=0;
	BANKSEL	_EIE3_bits
	CLR	_EIE3_bits, 4
;	::->op : =
	.line	86; "../main.c"	CCP4CTL =0x04;//捕捉下降沿
	MOV	R0,# 0x04
	BANKSEL	_CCP4CTL
	MOV	_CCP4CTL, R0
;	::->op :*  =
	.line	87; "../main.c"	CCP4IF =0;
	BANKSEL	_EIF3_bits
	CLR	_EIF3_bits, 4
;	::->op :*  =
	.line	88; "../main.c"	CCP4IE =1;
	BANKSEL	_EIE3_bits
	SET	_EIE3_bits, 4
;	::->op : =
	.line	89; "../main.c"	Flag =1;
	MOV	R0,# 0x01
	BANKSEL	_Flag
	MOV	_Flag, R0
;	::->op : GOTO
	JMP	_00025_DS_
;	::->op : LABEL
;	::->op : CAST
_00018_DS_
	.line	93; "../main.c"	T1_cnt =CCP4H<<8;
	BANKSEL	_CCP4H
	MOVZ	R0, _CCP4H
	BANKSEL	r0x1016
	MOV	r0x1016, R0
	BANKSEL	r0x101A
	MOV	r0x101A, R0
	BANKSEL	r0x1017
	CLR	r0x1017
;	::->op : LEFT_OP
;;102	MOVZ	R0, r0x1016
	BANKSEL	r0x1019
	CLR	r0x1019
;	::->op : CAST
	MOV	R0,# 0x00
	BANKSEL	_T1_cnt
	MOV	_T1_cnt, R0
	BANKSEL	r0x101A
	MOVZ	R0, r0x101A
	BANKSEL	_T1_cnt
	MOV	(_T1_cnt + 1), R0
	MOV	R0,# 0x00
	BANKSEL	(_T1_cnt + 1)
	JNB	(_T1_cnt + 1), 7
	MOV	R0,# 0xff
	BANKSEL	_T1_cnt
	MOV	(_T1_cnt + 3), R0
	BANKSEL	_T1_cnt
	MOV	(_T1_cnt + 2), R0
;	::->op : =
	.line	94; "../main.c"	T1_cnt +=CCP4L;
	BANKSEL	_CCP4L
	MOVZ	R0, _CCP4L
	BANKSEL	r0x1019
	MOV	r0x1019, R0
;	::->op : CAST
	BANKSEL	r0x1019
	MOVZ	R0, r0x1019
	BANKSEL	r0x1016
	MOV	r0x1016, R0
	BANKSEL	r0x1017
	CLR	r0x1017
	BANKSEL	r0x101B
	CLR	r0x101B
	BANKSEL	r0x101C
	CLR	r0x101C
;	::->op : +
	BANKSEL	r0x1016
	MOV	R0, r0x1016
	BANKSEL	_T1_cnt
	ADD	_T1_cnt, R0
	MOV	R0,# 0x00
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00036_DS_
	BANKSEL	_T1_cnt
	ADD	(_T1_cnt + 1), R0
_00036_DS_
	BANKSEL	r0x101B
	MOVZ	R0, r0x101B
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00037_DS_
	BANKSEL	_T1_cnt
	ADD	(_T1_cnt + 2), R0
_00037_DS_
	BANKSEL	r0x101C
	MOVZ	R0, r0x101C
	JNB	PSW, 0
	INC	R0
	JNB	PSW, 2
	JMP	_00038_DS_
	BANKSEL	_T1_cnt
	ADD	(_T1_cnt + 3), R0
;	::->op :*  =
_00038_DS_
	.line	95; "../main.c"	CCP4IE=0;
	BANKSEL	_EIE3_bits
	CLR	_EIE3_bits, 4
;	::->op : =
	.line	96; "../main.c"	CCP4CTL =0x05;//捕捉上升沿
	MOV	R0,# 0x05
	BANKSEL	_CCP4CTL
	MOV	_CCP4CTL, R0
;	::->op :*  =
	.line	97; "../main.c"	CCP4IF =0;
	BANKSEL	_EIF3_bits
	CLR	_EIF3_bits, 4
;	::->op :*  =
	.line	98; "../main.c"	CCP4IE =1;
	BANKSEL	_EIE3_bits
	SET	_EIE3_bits, 4
;	::->op : LABEL
;	::->op : ENDFUNCTION
_00025_DS_
	BANKSEL	I0R1
	MOV	R1, I0R1
	BANKSEL	I0R7
	MOV	R7, I0R7
	BANKSEL	I0PCH
	MOV	R0, I0PCH
	MOV	PCH, R0
	BANKSEL	I0PSW
	MOV	R0, I0PSW
	MOV	PSW, R0
	MOV	BANK, R3
	MOV	R0, R2
	IRET	
	.def _int_fun0_function_end, debug, value=$




func._int_fun1	.code
;***
;  PostBlock Stats: dbName = I
;***
;entry:  _int_fun1	;Function start
; 0 exit points
;; Starting PostCode block
	.def _int_fun1_function_begin, debug, value=$

;	::->op : LABEL
;	::->op : FUNCTION
_int_fun1	;Function start
; 0 exit points
;	::->op : LABEL
;	::->op : ENDFUNCTION
; R3 resprent for wsave,R4 resprent for ssave, R5 resprent for psave
interrupt_service_routine_0x14
_00031_DS_
	.line	110; "../main.c"	}
	IRET	
	.def _int_fun1_function_end, debug, value=$




func._main	.code
;***
;  PostBlock Stats: dbName = M
;***
;entry:  _main	;Function start
; 2 exit points
;has an exit
;functions called:
;   _Init_osc
;   _Init_GPIO
;   _Init_T4
;   _Init_CCP4
;   _Init_CCP4
;   _Init_intrup
;   __hmullong
;   __divulong
;   __divulong
;   _Init_osc
;   _Init_GPIO
;   _Init_T4
;   _Init_CCP4
;   _Init_CCP4
;   _Init_intrup
;   __hmullong
;   __divulong
;   __divulong
;11 compiler assigned registers:
;   STK06
;   STK05
;   STK04
;   STK03
;   STK02
;   STK01
;   STK00
;   r0x1012
;   r0x1013
;   r0x1014
;   r0x1015
;; Starting PostCode block
	.def _main_function_begin, debug, value=$

;	::->op : LABEL
;	::->op : FUNCTION
_main	;Function start
; 2 exit points
;	::->op : CALL
	.line	23; "../main.c"	Init_osc();
	PAGESEL	_Init_osc
	CALL	_Init_osc
	PAGESEL	$
;	::->op : CALL
	.line	24; "../main.c"	Init_GPIO();
	PAGESEL	_Init_GPIO
	CALL	_Init_GPIO
	PAGESEL	$
;	::->op : SEND
;	::->op : CALL
	.line	25; "../main.c"	Init_T4(1);//不用重载模式
	MOV	R0,# 0x01
	PAGESEL	_Init_T4
	CALL	_Init_T4
	PAGESEL	$
;	::->op : GET_VALUE_AT_ADDRESS
	.line	27; "../main.c"	if(S2)//S2按钮松开，CCP5配置为捕捉模式，
	BANKSEL	_P2_bits
	JB	_P2_bits, 6
	JMP	_00002_DS_
;	::->op : SEND
;	::->op : CALL
	.line	29; "../main.c"	Init_CCP4(0);
	MOV	R0,# 0x00
	PAGESEL	_Init_CCP4
	CALL	_Init_CCP4
	PAGESEL	$
;	::->op : GOTO
	JMP	_00003_DS_
;	::->op : LABEL
;	::->op : SEND
;	::->op : CALL
_00002_DS_
	.line	33; "../main.c"	Init_CCP4(1);
	MOV	R0,# 0x01
	PAGESEL	_Init_CCP4
	CALL	_Init_CCP4
	PAGESEL	$
;	::->op : =
	.line	34; "../main.c"	Mode =1;
	MOV	R0,# 0x01
	BANKSEL	_Mode
	MOV	_Mode, R0
;	::->op : LABEL
;	::->op : CALL
_00003_DS_
	.line	37; "../main.c"	Init_intrup();
	PAGESEL	_Init_intrup
	CALL	_Init_intrup
	PAGESEL	$
;	::->op : LABEL
;	::->op : IFX
_00007_DS_
	.line	41; "../main.c"	if(Flag)//比较模式，计算P12脚上输入的PWM的频率、占空比
	MOV	R0,# 0x00
	BANKSEL	_Flag
	ORL	R0, _Flag
	JNB	PSW, 2
	JMP	_00007_DS_
;	::->op : =
	.line	43; "../main.c"	Flag =0;
	BANKSEL	_Flag
	CLR	_Flag
;	::->op : SEND
;	::->op : SEND
;	::->op : CALL
	.line	44; "../main.c"	Duty =T1_cnt*100 /T2_cnt;//计算占空比
	BANKSEL	_T1_cnt
	MOVZ	R0, _T1_cnt
	BANKSEL	STK06
	MOV	STK06, R0
	BANKSEL	_T1_cnt
	MOVZ	R0, (_T1_cnt + 1)
	BANKSEL	STK05
	MOV	STK05, R0
	BANKSEL	_T1_cnt
	MOVZ	R0, (_T1_cnt + 2)
	BANKSEL	STK04
	MOV	STK04, R0
	BANKSEL	_T1_cnt
	MOVZ	R0, (_T1_cnt + 3)
	BANKSEL	STK03
	MOV	STK03, R0
	MOV	R0,# 0x64
	BANKSEL	STK02
	MOV	STK02, R0
	MOV	R0,# 0x00
	BANKSEL	STK01
	MOV	STK01, R0
	MOV	R0,# 0x00
	BANKSEL	STK00
	MOV	STK00, R0
	MOV	R0,# 0x00
	PAGESEL	__hmullong
	CALL	__hmullong
	PAGESEL	$
	BANKSEL	r0x1012
	MOV	r0x1012, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1013
	MOV	r0x1013, R0
	BANKSEL	STK01
	MOVZ	R0, STK01
	BANKSEL	r0x1014
	MOV	r0x1014, R0
	BANKSEL	STK02
	MOVZ	R0, STK02
	BANKSEL	r0x1015
	MOV	r0x1015, R0
;	::->op : SEND
;	::->op : SEND
;	::->op : CALL
	BANKSEL	_T2_cnt
	MOVZ	R0, _T2_cnt
	BANKSEL	STK06
	MOV	STK06, R0
	BANKSEL	_T2_cnt
	MOVZ	R0, (_T2_cnt + 1)
	BANKSEL	STK05
	MOV	STK05, R0
	BANKSEL	_T2_cnt
	MOVZ	R0, (_T2_cnt + 2)
	BANKSEL	STK04
	MOV	STK04, R0
	BANKSEL	_T2_cnt
	MOVZ	R0, (_T2_cnt + 3)
	BANKSEL	STK03
	MOV	STK03, R0
	BANKSEL	r0x1015
	MOVZ	R0, r0x1015
	BANKSEL	STK02
	MOV	STK02, R0
	BANKSEL	r0x1014
	MOVZ	R0, r0x1014
	BANKSEL	STK01
	MOV	STK01, R0
	BANKSEL	r0x1013
	MOVZ	R0, r0x1013
	BANKSEL	STK00
	MOV	STK00, R0
	BANKSEL	r0x1012
	MOVZ	R0, r0x1012
	PAGESEL	__divulong
	CALL	__divulong
	PAGESEL	$
	BANKSEL	_Duty
	MOV	(_Duty + 3), R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	_Duty
	MOV	(_Duty + 2), R0
	BANKSEL	STK01
	MOVZ	R0, STK01
	BANKSEL	_Duty
	MOV	(_Duty + 1), R0
	BANKSEL	STK02
	MOVZ	R0, STK02
	BANKSEL	_Duty
	MOV	_Duty, R0
;	::->op : SEND
;	::->op : SEND
;	::->op : CALL
	.line	45; "../main.c"	Freg =2000000/T2_cnt;//计算频率=1M/T(us)
	BANKSEL	_T2_cnt
	MOVZ	R0, _T2_cnt
	BANKSEL	STK06
	MOV	STK06, R0
	BANKSEL	_T2_cnt
	MOVZ	R0, (_T2_cnt + 1)
	BANKSEL	STK05
	MOV	STK05, R0
	BANKSEL	_T2_cnt
	MOVZ	R0, (_T2_cnt + 2)
	BANKSEL	STK04
	MOV	STK04, R0
	BANKSEL	_T2_cnt
	MOVZ	R0, (_T2_cnt + 3)
	BANKSEL	STK03
	MOV	STK03, R0
	MOV	R0,# 0x80
	BANKSEL	STK02
	MOV	STK02, R0
	MOV	R0,# 0x84
	BANKSEL	STK01
	MOV	STK01, R0
	MOV	R0,# 0x1e
	BANKSEL	STK00
	MOV	STK00, R0
	MOV	R0,# 0x00
	PAGESEL	__divulong
	CALL	__divulong
	PAGESEL	$
	BANKSEL	_Freg
	MOV	(_Freg + 3), R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	_Freg
	MOV	(_Freg + 2), R0
	BANKSEL	STK01
	MOVZ	R0, STK01
	BANKSEL	_Freg
	MOV	(_Freg + 1), R0
	BANKSEL	STK02
	MOVZ	R0, STK02
	BANKSEL	_Freg
	MOV	_Freg, R0
;	::->op : GOTO
	JMP	_00007_DS_
;	::->op : LABEL
;	::->op : ENDFUNCTION
	CRET	
	.def _main_function_end, debug, value=$

; exit point of _main


;	code size estimation:
;	  241+  141 =   382 instructions ( 1046 byte)

	.type _main,  32
	.dim _main, 1, (_main_function_end&0xFF00)>>8, _main_function_end&0xFF,0,21,0,48 , 1, 1
	.type _int_fun0,  32
	.dim _int_fun0, 1, (_int_fun0_function_end&0xFF00)>>8, _int_fun0_function_end&0xFF,0,50,0,103 , 2, 1
	.type _int_fun1,  32
	.dim _int_fun1, 1, (_int_fun1_function_end&0xFF00)>>8, _int_fun1_function_end&0xFF,0,107,0,110 , 2, 1
	.def __00010000, debug, type = 8, class = 10, value = 1
	.def _0, debug, value = 1, type = 26, class = 8
	.def _1, debug, value = 1, type = 26, class = 8
	.def _2, debug, value = 1, type = 26, class = 8
	.def _3, debug, value = 1, type = 26, class = 8
	.def _4, debug, value = 1, type = 26, class = 8
	.def _5, debug, value = 1, type = 26, class = 8
	.def _6, debug, value = 1, type = 26, class = 8
	.def _7, debug, value = 1, type = 26, class = 8

	.end
