;--------------------------------------------------------
; File Created by ChiponCC : aolisn inc.
; Version 3.0.4#6752 (Nov 19 2015 16:48:50) (MSVC)
; This file was generated Wed May 25 15:32:45 2016
;--------------------------------------------------------
; chipon port for the 16-bit core
;--------------------------------------------------------
;	.file	"../main.c"
	.list	p=KF8F4156
	.radix dec
	.include "KF8F4156.inc"
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	.extern	_ComTempSetFun
	.extern	_ComScanFun
	.extern	_PSW_bits
	.extern	_P0_bits
	.extern	_P2_bits
	.extern	_P1_bits
	.extern	_P3_bits
	.extern	_INTCTL_bits
	.extern	_EIF1_bits
	.extern	_EIF2_bits
	.extern	_T1CTL_bits
	.extern	_T2CTL0_bits
	.extern	_PWMCTL_bits
	.extern	_BANK_bits
	.extern	_ADSCANCTL_bits
	.extern	_C1CTL_bits
	.extern	_VDACS_bits
	.extern	_AMPCTL_bits
	.extern	_ANSEH_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	_VRECTL_bits
	.extern	_EIE1_bits
	.extern	_EIE2_bits
	.extern	_PCTL_bits
	.extern	_OSCCTL_bits
	.extern	_ANSEL_bits
	.extern	_PUR0_bits
	.extern	_IOCL_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	_PWM5CTL0_bits
	.extern	_ADCINTCTL_bits
	.extern	_PWM5CTL1_bits
	.extern	_P5ASCTL_bits
	.extern	_PSTRCTL_bits
	.extern	_PUR1_bits
	.extern	_PUR2_bits
	.extern	_INTEDGCTL_bits
	.extern	_VBIASCTL_bits
	.extern	_VBIAS1EN_bits
	.extern	_VBIAS2EN_bits
	.extern	_PWM5OC_bits
	.extern	_T2CTL1_bits
	.extern	_VDAC_bits
	.extern	_PWM5CTL2_bits
	.extern	_PWMPC_bits
	.extern	_RSCTL_bits
	.extern	_BRCTL_bits
	.extern	_TSCTL_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	_C1FILTCTL_bits
	.extern	_C1FILTPRE_bits
	.extern	_LEDOMS1_bits
	.extern	_LEDODS0_bits
	.extern	_LEDOMS0_bits
	.extern	_LEDODS1_bits
	.extern	_LEDLUM_bits
	.extern	_PWM5FC_bits
	.extern	_T4CTL_bits
	.extern	_Com1Temp
	.extern	_Com2Temp
	.extern	_Com3Temp
	.extern	_Com4Temp
	.extern	_LcdSfr
	.extern	_LcdNumQian
	.extern	_LcdNumBai
	.extern	_LcdNumTen
	.extern	_LcdNumGe
	.extern	_BCD
	.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	_PWM1L
	.extern	_PWM1H
	.extern	_PWMCTL
	.extern	_PP1
	.extern	_BANK
	.extern	_ADSCANCTL
	.extern	_C1CTL
	.extern	_VDACS
	.extern	_AMPCTL
	.extern	_ANSEH
	.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	_VRECAL1
	.extern	_VRECTL
	.extern	_EIE1
	.extern	_EIE2
	.extern	_PCTL
	.extern	_OSCCTL
	.extern	_OSCCAL0
	.extern	_ANSEL
	.extern	_PP2
	.extern	_PWM2L
	.extern	_PWM2H
	.extern	_PUR0
	.extern	_IOCL
	.extern	_OSCCAL1
	.extern	_NVMDATAH
	.extern	_NVMDATAL
	.extern	_NVMADDRH
	.extern	_NVMADDRL
	.extern	_NVMCTL0
	.extern	_NVMCTL1
	.extern	_ADCDATA0L
	.extern	_ADCCTL1
	.extern	_T2CCRH
	.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	_ADCDATA1H
	.extern	_ADCDATA1L
	.extern	_PP5L
	.extern	_T2CCRL
	.extern	_PWM5L0
	.extern	_PWM5L1
	.extern	_PWM5CTL0
	.extern	_ADCINTCTL
	.extern	_ADCDATA2H
	.extern	_ADCDATA2L
	.extern	_PWM5CTL1
	.extern	_P5ASCTL
	.extern	_PSTRCTL
	.extern	_ADCDATA3H
	.extern	_PUR1
	.extern	_PUR2
	.extern	_INTEDGCTL
	.extern	_ADCDATA3L
	.extern	_VBIASCTL
	.extern	_VBIAS1EN
	.extern	_VBIAS2EN
	.extern	_PWM5OC
	.extern	_T2CTL1
	.extern	_VDAC
	.extern	_PWM5CTL2
	.extern	_PWMPC
	.extern	_RSCTL
	.extern	_TXSDR
	.extern	_RXSDR
	.extern	_BRCTL
	.extern	_TSCTL
	.extern	_EUBRGL
	.extern	_EUBRGH
	.extern	_SSCICTL0
	.extern	_SSCICTL1
	.extern	_SSCISTA
	.extern	_SSCIBUFR
	.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	_DIVB
	.extern	_DIVQH
	.extern	_DIVQL
	.extern	_DIVR
	.extern	_LEDCTL
	.extern	_LEDPRE
	.extern	_LEDDATA0
	.extern	_LEDDATA1
	.extern	_LEDDATA2
	.extern	_LEDDATA3
	.extern	_LEDDATA4
	.extern	_LEDDATA5
	.extern	_LEDDATA6
	.extern	_LEDDATA7
	.extern	_C1FILTCTL
	.extern	_C1FILTPRE
	.extern	_LEDOMS1
	.extern	_LEDODS0
	.extern	_LEDOMS0
	.extern	_LEDODS1
	.extern	_VRECAL2
	.extern	_VRECAL3
	.extern	_LEDLUM
	.extern	_PWM5FC
	.extern	_T4L
	.extern	_T4H
	.extern	_T4REL
	.extern	_T4REH
	.extern	_T4CTL
	.extern	_RC32KCAL
	.extern	__R2PCL
	.extern	_startup
	.extern	__sdcc_gsinit_startup
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
	.global	_RamClear
	.global	_T0TimeTurnOnFun
	.global	_initFun
	.global	_main
	.global	_int_fun0
	.global	_int_fun1
	.global	_Time0Cnt
	.global	_LcdModeCnt

	.global I0R1
	.global I0PSW
	.global I0PCH
	.global I1R1
	.global I1PSW
	.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
I0PSW		.res 1
I0PCH		.res 1
I1R1		.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
_Time0Cnt	.res	1

UD_main_1	.udata
_LcdModeCnt	.res	1

;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
UDL_main_0	.udata
r0x1007	.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,BANK
	MOV		R0,PSW
	BANKSEL	I0PSW
	MOV		I0PSW,R0
	MOV		R0,PCH
	BANKSEL	I0PCH
	MOV		I0PCH,R0
	MOV		I0R1,R1
	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
;functions called:
;   _ComTempSetFun
;   _ComScanFun
;   _ComTempSetFun
;   _ComScanFun
;1 compiler assigned register :
;   r0x1007
;; Starting PostCode block
;	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	119; "../main.c"	if(T0IF)				//定时中断   1ms
	BANKSEL	_INTCTL_bits
	JB	_INTCTL_bits, 2
	JMP	_00028_DS_
;	op : =
;	.line	121; "../main.c"	T0IF = 0;
	BANKSEL	_INTCTL_bits
	CLR	_INTCTL_bits, 2
;	op : =
;	.line	122; "../main.c"	T0=	240;
	MOV	R0,# 0xf0
	BANKSEL	_T0
	MOV	_T0, R0
;	op : =
;	.line	123; "../main.c"	if(Time0Cnt++>=2)	//3MS
	BANKSEL	_Time0Cnt
	MOVZ	R0, _Time0Cnt
	BANKSEL	r0x1007
	MOV	r0x1007, R0
;	op : +
	BANKSEL	_Time0Cnt
	INC	_Time0Cnt
;	op : <
;unsigned compare: left < lit(0x2=2), size=1
	MOV	R0,# 0x02
	BANKSEL	r0x1007
	SUB	R0, r0x1007
;comparing bytes at offset 0
	JB	PSW, 0
	JMP	_00028_DS_
;	op : =
;	.line	125; "../main.c"	Time0Cnt=0;
	BANKSEL	_Time0Cnt
	CLR	_Time0Cnt
;	op : CALL
;	.line	129; "../main.c"	ComTempSetFun();
	PAGESEL	_ComTempSetFun
	CALL	_ComTempSetFun
	PAGESEL	$
;	op : SEND
;	op : CALL
;	.line	130; "../main.c"	ComScanFun(LcdModeCnt);
	BANKSEL	_LcdModeCnt
	MOVZ	R0, _LcdModeCnt
	PAGESEL	_ComScanFun
	CALL	_ComScanFun
	PAGESEL	$
;	op : +
;	.line	131; "../main.c"	if(++LcdModeCnt>COM4_MODE_H)		//LCD循环扫描
	BANKSEL	_LcdModeCnt
	INC	_LcdModeCnt
;	op : >
;swapping arguments (AOP_TYPEs 1/3)
;unsigned compare: left >= lit(0x8=8), size=1
	MOV	R0,# 0x08
;	.line	133; "../main.c"	LcdModeCnt = COM1_MODE_L;
	BANKSEL	_LcdModeCnt
	SUB	R0, _LcdModeCnt
	JB	PSW, 0
	JMP	_00028_DS_
	BANKSEL	_LcdModeCnt
	CLR	_LcdModeCnt
_00028_DS_
	BANKSEL	I0R1
	MOV	R1, I0R1
	BANKSEL	I0PCH
	MOV	R0, I0PCH
	MOV	PCH, R0
	BANKSEL	I0PSW
	MOV	R0, I0PSW
	MOV	PSW, R0
	MOV	BANK, R3
	MOV	R0, R2
	IRET	



func._int_fun1	.code
;***
;  PostBlock Stats: dbName = I
;***
;entry:  _int_fun1	;Function start
; 0 exit points
;; Starting PostCode block
;	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
_00026_DS_
;	.line	145; "../main.c"	}
	IRET	



func._main	.code
;***
;  PostBlock Stats: dbName = M
;***
;entry:  _main	;Function start
; 2 exit points
;has an exit
;functions called:
;   _initFun
;   _RamClear
;   __R2PCL
;   __R2PCL
;   __R2PCL
;   __R2PCL
;   _T0TimeTurnOnFun
;   _initFun
;   _RamClear
;   __R2PCL
;   __R2PCL
;   __R2PCL
;   __R2PCL
;   _T0TimeTurnOnFun
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_main	;Function start
; 2 exit points
;	op : CALL
;	.line	97; "../main.c"	initFun();
	PAGESEL	_initFun
	CALL	_initFun
	PAGESEL	$
;	op : CALL
;	.line	98; "../main.c"	RamClear();
	PAGESEL	_RamClear
	CALL	_RamClear
	PAGESEL	$
;	op : GET_VALUE_AT_ADDRESS
;	.line	100; "../main.c"	LcdNumQian=BCD[1];		//给千位赋笔形码
	MOV	R1,# high (_BCD + 1)
	MOV	R0,# (_BCD + 1)
	PAGESEL	__R2PCL
	CALL	__R2PCL
	PAGESEL	$
	BANKSEL	_LcdNumQian
	MOV	_LcdNumQian, R0
;	op : GET_VALUE_AT_ADDRESS
;	.line	101; "../main.c"	LcdNumBai =BCD[2];		//给百位赋笔形码
	MOV	R1,# high (_BCD + 2)
	MOV	R0,# (_BCD + 2)
	PAGESEL	__R2PCL
	CALL	__R2PCL
	PAGESEL	$
	BANKSEL	_LcdNumBai
	MOV	_LcdNumBai, R0
;	op : GET_VALUE_AT_ADDRESS
;	.line	102; "../main.c"	LcdNumTen =BCD[3];		//给十位赋笔形码
	MOV	R1,# high (_BCD + 3)
	MOV	R0,# (_BCD + 3)
	PAGESEL	__R2PCL
	CALL	__R2PCL
	PAGESEL	$
	BANKSEL	_LcdNumTen
	MOV	_LcdNumTen, R0
;	op : GET_VALUE_AT_ADDRESS
;	.line	103; "../main.c"	LcdNumGe  =BCD[4];		//给个位赋笔形码
	MOV	R1,# high (_BCD + 4)
	MOV	R0,# (_BCD + 4)
	PAGESEL	__R2PCL
	CALL	__R2PCL
	PAGESEL	$
	BANKSEL	_LcdNumGe
	MOV	_LcdNumGe, R0
;	op : =
;	.line	105; "../main.c"	SHOW_TN_SEG_P1=0;
	BANKSEL	_LcdSfr
	CLR	_LcdSfr, 0
;	op : =
;	.line	106; "../main.c"	SHOW_TN_SEG_2P=0;
	BANKSEL	_LcdSfr
	CLR	_LcdSfr, 1
;	op : =
;	.line	107; "../main.c"	SHOW_TN_SEG_3P=0;
	BANKSEL	_LcdSfr
	CLR	_LcdSfr, 2
;	op : =
;	.line	108; "../main.c"	SHOW_TN_SEG_4P=0;
	BANKSEL	_LcdSfr
	CLR	_LcdSfr, 3
;	op : =
;	.line	110; "../main.c"	CHANGE_SHOW_NUM_FLAG = 1;  //完成一次数据改变//每次修改为数据后，将数据改变标志设置为1,数据显示函数获取后改变显示，并且清零该位
	BANKSEL	_LcdSfr
	SET	_LcdSfr, 4
;	op : CALL
;	.line	112; "../main.c"	T0TimeTurnOnFun();
	PAGESEL	_T0TimeTurnOnFun
	CALL	_T0TimeTurnOnFun
	PAGESEL	$
;	op : LABEL
;	op : GOTO
_00008_DS_
;	.line	113; "../main.c"	while(1);
	JMP	_00008_DS_
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _main



func._initFun	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _initFun	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_initFun	;Function start
; 2 exit points
;	op : =
;	.line	78; "../main.c"	OSCCTL	= OSCCTL_16M;
	MOV	R0,# 0x70
	BANKSEL	_OSCCTL
	MOV	_OSCCTL, R0
;	op : =
;	.line	80; "../main.c"	TR0		= TR0_INIT;				//P0.2 mode引脚只能为输入状态
	MOV	R0,# 0x04
	BANKSEL	_TR0
	MOV	_TR0, R0
;	op : =
;	.line	81; "../main.c"	TR1		= TR1_INIT;
	MOV	R0,# 0x08
	BANKSEL	_TR1
	MOV	_TR1, R0
;	op : =
;	.line	82; "../main.c"	TR2		= TR2_INIT;			//其他口都设置为了输出状态
	MOV	R0,# 0x40
	BANKSEL	_TR2
	MOV	_TR2, R0
;	op : =
;	.line	83; "../main.c"	TR3		= TR3_INIT;
	BANKSEL	_TR3
	CLR	_TR3
;	op : =
;	.line	85; "../main.c"	P0LR	= P0LR_INIT;
	BANKSEL	_P0LR
	CLR	_P0LR
;	op : =
;	.line	86; "../main.c"	P1LR	= P1LR_INIT;			//初始输出状态
	BANKSEL	_P1LR
	CLR	_P1LR
;	op : =
;	.line	87; "../main.c"	P2LR	= P2LR_INIT;
	BANKSEL	_P2LR
	CLR	_P2LR
;	op : =
;	.line	88; "../main.c"	P3LR	= P3LR_INIT;
	BANKSEL	_P3LR
	CLR	_P3LR
;	op : =
;	.line	90; "../main.c"	VBIASCTL = 0b10000011;		//允许半电平输出
	MOV	R0,# 0x83
	BANKSEL	_VBIASCTL
	MOV	_VBIASCTL, R0
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _initFun



func._T0TimeTurnOnFun	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _T0TimeTurnOnFun	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_T0TimeTurnOnFun	;Function start
; 2 exit points
;	op : =
;	.line	57; "../main.c"	T0CS = 0;
	BANKSEL	_OPTR_bits
	CLR	_OPTR_bits, 5
;	op : =
;	.line	58; "../main.c"	PSA = 0;
	BANKSEL	_OPTR_bits
	CLR	_OPTR_bits, 3
;	op : =
;	.line	59; "../main.c"	PS2 = 1;
	BANKSEL	_OPTR_bits
	SET	_OPTR_bits, 2
;	op : =
;	.line	60; "../main.c"	PS1 = 1;
	BANKSEL	_OPTR_bits
	SET	_OPTR_bits, 1
;	op : =
;	.line	61; "../main.c"	PS0 = 1;
	BANKSEL	_OPTR_bits
	SET	_OPTR_bits, 0
;	op : =
;	.line	62; "../main.c"	T0=	240;
	MOV	R0,# 0xf0
	BANKSEL	_T0
	MOV	_T0, R0
;	op : =
;	.line	63; "../main.c"	T0IE = 1;
	BANKSEL	_INTCTL_bits
	SET	_INTCTL_bits, 5
;	op : =
;	.line	64; "../main.c"	AIE = 1;
	BANKSEL	_INTCTL_bits
	SET	_INTCTL_bits, 7
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _T0TimeTurnOnFun



func._RamClear	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _RamClear	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_RamClear	;Function start
; 2 exit points
;	op : INLINEASM
	MOV R1,#0X80
	MOV R2,#0X00
	ST [R1],R2
	INC R1
	MOV R0,R1
	XOR R0,#0XFF
	JB PSW,2
	JMP $-5
	
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _RamClear


;	code size estimation:
;	  102+   42 =   144 instructions (  372 byte)


	.end
