;--------------------------------------------------------
; File Created by ChiponCC : aolisn inc.
; Version 3.0.4#6752 (Mar  1 2016 15:13:08) (MSVC)
; This file was generated Wed Jun 01 10:26:46 2016
;--------------------------------------------------------
; chipon port for the 16-bit core
;--------------------------------------------------------
;	.file	"../main.c"
	.radix dec
	.include "KF8S1011.inc"
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	.extern	_PSW_bits
	.extern	_P0_bits
	.extern	_P2_bits
	.extern	_P1_bits
	.extern	_P3_bits
	.extern	_P4_bits
	.extern	_INTCTL_bits
	.extern	_EIF1_bits
	.extern	_EIF2_bits
	.extern	_T1CTL_bits
	.extern	_PWMCTL_bits
	.extern	_CMCTL1_bits
	.extern	_ANSEH_bits
	.extern	_ADCCTL0_bits
	.extern	_OPTR_bits
	.extern	_TR0_bits
	.extern	_TR2_bits
	.extern	_TR1_bits
	.extern	_TR3_bits
	.extern	_TR4_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	_T3L_bits
	.extern	_CTCTL_bits
	.extern	_RSCTL_bits
	.extern	_OSCLDOCAL_bits
	.extern	_BRCTL_bits
	.extern	_TSCTL_bits
	.extern	_EUBRGL_bits
	.extern	_EUBRGH_bits
	.extern	_T0
	.extern	_PCL
	.extern	_PSW
	.extern	_P0
	.extern	_P2
	.extern	_P1
	.extern	_P3
	.extern	_P4
	.extern	_PCH
	.extern	_INTCTL
	.extern	_EIF1
	.extern	_EIF2
	.extern	_T1L
	.extern	_T1H
	.extern	_T1CTL
	.extern	_PWMCTL
	.extern	_CMCTL1
	.extern	_VRECAL
	.extern	_ANSEH
	.extern	_ADCDATAH
	.extern	_ADCCTL0
	.extern	_OPTR
	.extern	_TR0
	.extern	_TR2
	.extern	_TR1
	.extern	_TR3
	.extern	_TR4
	.extern	_EIE1
	.extern	_EIE2
	.extern	_PCTL
	.extern	_OSCCTL
	.extern	_OSCCAL0
	.extern	_ANSEL
	.extern	_PUR
	.extern	_IOCL
	.extern	_OSCCAL1
	.extern	_BADDRH
	.extern	_BADDRL
	.extern	_EECTL1
	.extern	_EECTL2
	.extern	_ADCDATAL
	.extern	_ADCCTL1
	.extern	_T3L
	.extern	_CTCTL
	.extern	_RSCTL
	.extern	_TXSDR
	.extern	_RXSDR
	.extern	_OSCLDOCAL
	.extern	_T1U
	.extern	_BRCTL
	.extern	_TSCTL
	.extern	_EUBRGL
	.extern	_EUBRGH
	.extern	_startup
	.extern	__sdcc_gsinit_startup
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
	.global	_init_mcu
	.global	_init_IOCL
	.global	_main
	.global	_int_fun

	.global STK12
	.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
STK12	.res 1
	.type STK12, 108
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
;--------------------------------------------------------
;--------------------------------------------------------
; 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
;--------------------------------------------------------
c_interrupt	.code	0x4
	MOV		R3,R0
	MOV		R4,PSW
	MOV		R5,PCH
	MOV		R2,R1
	PAGESEL	__sdcc_interrupt
	JMP		__sdcc_interrupt



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 : GET_VALUE_AT_ADDRESS
; R3 resprent for wsave,R4 resprent for ssave, R5 resprent for psave
__sdcc_interrupt
;	.line	60; "../main.c"	if(P0IF)
	JB	_INTCTL_bits, 0
	JMP	_00013_DS_
;	op : =
;	.line	62; "../main.c"	P0IF=0;
	CLR	_INTCTL_bits, 0
;	op : GET_VALUE_AT_ADDRESS
;	op : !
;	op : =
;	.line	63; "../main.c"	P13=!P13;
	JB	_P1_bits, 3
	JMP	_00016_DS_
	CLR	_P1_bits, 3
	JMP	_00013_DS_
_00016_DS_
	SET	_P1_bits, 3
;	op : LABEL
;	op : ENDFUNCTION
_00013_DS_
	MOV	R1, R2
	MOV	PCH, R5
	MOV	PSW, R4
	MOV	R0, R3
	IRET	



func._main	.code
;***
;  PostBlock Stats: dbName = M
;***
;entry:  _main	;Function start
; 2 exit points
;has an exit
;functions called:
;   _init_mcu
;   _init_IOCL
;   _init_mcu
;   _init_IOCL
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_main	;Function start
; 2 exit points
;	op : CALL
;	.line	50; "../main.c"	init_mcu();
	PAGESEL	_init_mcu
	CALL	_init_mcu
	PAGESEL	$
;	op : CALL
;	.line	51; "../main.c"	init_IOCL();
	PAGESEL	_init_IOCL
	CALL	_init_IOCL
	PAGESEL	$
;	op : LABEL
;	op : INLINEASM
_00006_DS_
	CWDT 
;	op : GOTO
	JMP	_00006_DS_
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _main



func._init_IOCL	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _init_IOCL	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_init_IOCL	;Function start
; 2 exit points
;	op : =
;	.line	43; "../main.c"	IOCL = 0x10;      //使能P04口电平变化中断
	MOV	R0,# 0x10
	MOV	_IOCL, R0
;	op : =
;	.line	44; "../main.c"	P0IE = 1;         //电平变化中断使能
	SET	_INTCTL_bits, 3
;	op : =
;	.line	45; "../main.c"	AIE  = 1;         //使能全局变化中断
	SET	_INTCTL_bits, 7
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _init_IOCL



func._init_mcu	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _init_mcu	;Function start
; 2 exit points
;has an exit
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_init_mcu	;Function start
; 2 exit points
;	op : =
;	.line	22; "../main.c"	OSCCTL = 0x70;          //设置为16M
	MOV	R0,# 0x70
	MOV	_OSCCTL, R0
;	op : =
;	.line	24; "../main.c"	TR0 = 0x18;				//设置VPP P03端口为输入，P04设置为输入用于电平变化中断，P0其他I/O口为输出
	MOV	R0,# 0x18
	MOV	_TR0, R0
;	op : =
;	.line	25; "../main.c"	TR1 = 0x00;				//设置P1端口为输出
	CLR	_TR1
;	op : =
;	.line	26; "../main.c"	TR2 = 0x00;				//设置P2端口为输出
	CLR	_TR2
;	op : =
;	.line	27; "../main.c"	TR3 = 0x00;				//设置P3端口为输出
	CLR	_TR3
;	op : =
;	.line	28; "../main.c"	TR4 = 0x00;
	CLR	_TR4
;	op : =
;	.line	29; "../main.c"	P0 = 0;
	CLR	_P0
;	op : =
;	.line	30; "../main.c"	P1 = 0;
	CLR	_P1
;	op : =
;	.line	31; "../main.c"	P2 = 0;
	CLR	_P2
;	op : =
;	.line	32; "../main.c"	P3 = 0;
	CLR	_P3
;	op : =
;	.line	33; "../main.c"	P4 = 0;
	CLR	_P4
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _init_mcu


;	code size estimation:
;	   40+    0 =    40 instructions (   80 byte)


	.end
