;--------------------------------------------------------
; 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:05:37 2016
;--------------------------------------------------------
; chipon port for the 16-bit core
;--------------------------------------------------------
;	.file	"../W_BEE.c"
	.list	p=KF8TS2408
	.radix dec
	.include "KF8TS2408.inc"
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	.extern	_init_mcu
	.extern	_delay_ms
	.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	_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 I0R1
	.extern I0PCH
	.extern I1R1
	.extern I1PCH
	.extern STK11
	.extern STK10
	.extern STK09
	.extern STK08
	.extern STK07
	.extern STK06
	.extern STK05
	.extern STK04
	.extern STK03
	.extern STK02
	.extern STK01
	.extern STK00
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
	.global	_BEE_WRITE_ONE
	.global	_BEE_WRITE_FUN
	.global	_BEE_READ_FUN
	.global	_BEE_READ_ONE
	.global	_BEE_BUFFER
	.global	_BEE_READ_BUF

;--------------------------------------------------------
; global definitions
;--------------------------------------------------------
UD_W_BEE_0	.udata
_BEE_BUFFER	.res	32

UD_W_BEE_1	.udata
_BEE_READ_BUF	.res	2

;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
UDL_W_BEE_0	.udata
r0x1030	.res	1
UDL_W_BEE_1	.udata
r0x1031	.res	1
UDL_W_BEE_2	.udata
r0x1023	.res	1
UDL_W_BEE_3	.udata
r0x1022	.res	1
UDL_W_BEE_4	.udata
r0x1024	.res	1
UDL_W_BEE_5	.udata
r0x1028	.res	1
UDL_W_BEE_6	.udata
r0x1027	.res	1
UDL_W_BEE_7	.udata
r0x102A	.res	1
UDL_W_BEE_8	.udata
r0x1029	.res	1
UDL_W_BEE_9	.udata
r0x102B	.res	1
UDL_W_BEE_10	.udata
r0x102C	.res	1
UDL_W_BEE_11	.udata
r0x102D	.res	1
;--------------------------------------------------------
; initialized data
;--------------------------------------------------------
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
;	.udata_ovr


func._BEE_WRITE_ONE	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _BEE_WRITE_ONE	;Function start
; 2 exit points
;has an exit
;functions called:
;   _BEE_READ_FUN
;   _BEE_WRITE_FUN
;   _BEE_READ_FUN
;   _BEE_WRITE_FUN
;11 compiler assigned registers:
;   r0x1027
;   STK00
;   r0x1028
;   STK01
;   r0x1029
;   STK02
;   r0x102A
;   r0x102B
;   r0x102C
;   r0x102D
;   r0x102E
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_BEE_WRITE_ONE	;Function start
; 2 exit points
;	op : RECEIVE
	BANKSEL	r0x102C
	MOV	r0x102C, R0
;	.line	399; "../W_BEE.c"	void BEE_WRITE_ONE(unsigned int address,unsigned int value)
	BANKSEL	r0x1027
	MOV	r0x1027, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1028
	MOV	r0x1028, R0
;	op : RECEIVE
	BANKSEL	STK01
	MOVZ	R0, STK01
	BANKSEL	r0x1029
	MOV	r0x1029, R0
	BANKSEL	STK02
	MOVZ	R0, STK02
	BANKSEL	r0x102A
	MOV	r0x102A, R0
;	op : BITWISEAND
;	.line	402; "../W_BEE.c"	BEE_READ_FUN(address&0xFFF0,BEE_BUFFER_MAX);
	MOV	R0,# 0xf0
	BANKSEL	r0x1028
	AND	R0, r0x1028
	BANKSEL	r0x102B
	MOV	r0x102B, R0
;;106	MOVZ	R0, r0x1027
;	op : SEND
;	op : SEND
;	op : CALL
	MOV	R0,# 0x10
	BANKSEL	STK01
	MOV	STK01, R0
	BANKSEL	r0x102B
	MOVZ	R0, r0x102B
	BANKSEL	STK00
	MOV	STK00, R0
	BANKSEL	r0x102C
	MOVZ	R0, r0x102C
	PAGESEL	_BEE_READ_FUN
	CALL	_BEE_READ_FUN
	PAGESEL	$
;	op : BITWISEAND
;	.line	404; "../W_BEE.c"	BEE_BUFFER[address&0xF] = value;
	MOV	R0,# 0x0f
	BANKSEL	r0x1028
	AND	R0, r0x1028
	BANKSEL	r0x102B
	MOV	r0x102B, R0
	BANKSEL	r0x102C
	CLR	r0x102C
;	op : LEFT_OP
	CLR	PSW, 0
	BANKSEL	r0x102B
	RLCR	r0x102B
	BANKSEL	r0x102D
	MOV	r0x102D, R0
	BANKSEL	r0x102C
	RLCR	r0x102C
;;1	MOV	r0x102E, R0
;	op : +
	BANKSEL	r0x102D
	MOV	R0, r0x102D
	ADD	R0,# (_BEE_BUFFER + 0)
	BANKSEL	r0x102B
	MOV	r0x102B, R0
;	op : =
	BANKSEL	r0x102A
	MOVZ	R0, r0x102A
	BANKSEL	r0x102B
	MOV	R1, r0x102B
	BANKSEL	_BEE_BUFFER
	ST	[R1], R0
	INC	R1
	BANKSEL	r0x1029
	MOVZ	R0, r0x1029
	BANKSEL	_BEE_BUFFER
	ST	[R1], R0
;	op : BITWISEAND
;	.line	406; "../W_BEE.c"	BEE_WRITE_FUN(address&0xFFF0,BEE_BUFFER_MAX);
	MOV	R0,# 0xf0
	BANKSEL	r0x1028
	AND	r0x1028, R0
;	op : SEND
;	op : SEND
;	op : CALL
	MOV	R0,# 0x10
	BANKSEL	STK01
	MOV	STK01, R0
	BANKSEL	r0x1028
	MOVZ	R0, r0x1028
	BANKSEL	STK00
	MOV	STK00, R0
	BANKSEL	r0x1027
	MOVZ	R0, r0x1027
	PAGESEL	_BEE_WRITE_FUN
	CALL	_BEE_WRITE_FUN
	PAGESEL	$
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _BEE_WRITE_ONE



func._BEE_WRITE_FUN	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _BEE_WRITE_FUN	;Function start
; 2 exit points
;has an exit
;7 compiler assigned registers:
;   r0x1022
;   STK00
;   r0x1023
;   STK01
;   r0x1024
;   r0x1025
;   r0x1026
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_BEE_WRITE_FUN	;Function start
; 2 exit points
;	op : RECEIVE
;	.line	254; "../W_BEE.c"	void BEE_WRITE_FUN(unsigned int address,unsigned char length)
	BANKSEL	r0x1022
	MOV	r0x1022, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1023
	MOV	r0x1023, R0
;	op : RECEIVE
	BANKSEL	STK01
	MOVZ	R0, STK01
	BANKSEL	r0x1024
	MOV	r0x1024, R0
;	op : RIGHT_OP
;;105	MOVZ	R0, r0x1022
;;103	MOV	r0x1025, R0
;;1	CLR	r0x1026
;	op : CAST
;;104	MOVZ	R0, r0x1025
;	.line	258; "../W_BEE.c"	BADDRH=(unsigned char) (address>>8);
	BANKSEL	r0x1022
	MOVZ	R0, r0x1022
	MOV	_BADDRH, R0
;	op : CAST
;	.line	259; "../W_BEE.c"	BADDRL=address;
	BANKSEL	r0x1023
	MOVZ	R0, r0x1023
	MOV	_BADDRL, R0
;	op : INLINEASM
	;
	BANKSEL _INTCTL
	MOV R1,_INTCTL
	;
	CLR _INTCTL,_AIE
	JNB _INTCTL,_AIE
	JMP $-2
	;
	MOV R0,#0x30
	MOV R2,_OSCCTL
	MOV _OSCCTL,R0
	;
	MOV R3,#_BEE_BUFFER
	
;	op : =
;	.line	277; "../W_BEE.c"	while(length--)		// 仅使用R0，不改变R1
	BANKSEL	r0x1024
	MOVZ	R0, r0x1024
	BANKSEL	r0x1023
	MOV	r0x1023, R0
;	op : LABEL
;	op : =
_00011_DS_
	BANKSEL	r0x1023
	MOVZ	R0, r0x1023
	BANKSEL	r0x1022
	MOV	r0x1022, R0
;	op : -
	BANKSEL	r0x1023
	DEC	r0x1023
;	op : IFX
	MOV	R0,# 0x00
	BANKSEL	r0x1022
	ORL	R0, r0x1022
	JNB	PSW, 2
	JMP	_00013_DS_
;	op : INLINEASM
	;
	BANKSEL _BEE_BUFFER
	LD R0,[R3]
	MOV BDATAL,R0
	INC R3
	LD R0,[R3]
	MOV BDATAH,R0
	INC R3
	;
	MOV R5 ,#0x84
	MOV _EECTL1,R5
	MOV R5,#0x69
	MOV _EECTL2,R5
	MOV R5,#0x96
	MOV _EECTL2,R5
	SET _EECTL1 , 1 ;
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ ;
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	MOV R5,#0X80
	MOV EECTL1,R5
	;
	BANKSEL _BADDRL
	INC _BADDRL
	
;	op : GOTO
	JMP	_00011_DS_
;	op : LABEL
;	op : INLINEASM
_00013_DS_
	;
	MOV _OSCCTL,R2
	AND R1,#0xC0 ;
	ORL _INTCTL,R1
	
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _BEE_WRITE_FUN



func._BEE_READ_FUN	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _BEE_READ_FUN	;Function start
; 2 exit points
;has an exit
;7 compiler assigned registers:
;   r0x1022
;   STK00
;   r0x1023
;   STK01
;   r0x1024
;   r0x1025
;   r0x1026
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_BEE_READ_FUN	;Function start
; 2 exit points
;	op : RECEIVE
;	.line	120; "../W_BEE.c"	void BEE_READ_FUN(unsigned int address,unsigned char length)
	BANKSEL	r0x1022
	MOV	r0x1022, R0
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1023
	MOV	r0x1023, R0
;	op : RECEIVE
	BANKSEL	STK01
	MOVZ	R0, STK01
	BANKSEL	r0x1024
	MOV	r0x1024, R0
;	op : RIGHT_OP
;;102	MOVZ	R0, r0x1022
;;100	MOV	r0x1025, R0
;;1	CLR	r0x1026
;	op : CAST
;;101	MOVZ	R0, r0x1025
;	.line	124; "../W_BEE.c"	BADDRH=(unsigned char) (address>>8);
	BANKSEL	r0x1022
	MOVZ	R0, r0x1022
	MOV	_BADDRH, R0
;	op : CAST
;	.line	125; "../W_BEE.c"	BADDRL=address;
	BANKSEL	r0x1023
	MOVZ	R0, r0x1023
	MOV	_BADDRL, R0
;	op : INLINEASM
	;
	BANKSEL _INTCTL
	MOV R1,_INTCTL
	;
	CLR _INTCTL,_AIE
	JNB _INTCTL,_AIE
	JMP $-2
	;
	MOV R0,#0x30
	MOV R2,_OSCCTL
	MOV _OSCCTL,R0
	;
	MOV R3,#_BEE_BUFFER
	
;	op : =
;	.line	143; "../W_BEE.c"	while(length--)	// 仅使用R0，不改变R1
	BANKSEL	r0x1024
	MOVZ	R0, r0x1024
	BANKSEL	r0x1023
	MOV	r0x1023, R0
;	op : LABEL
;	op : =
_00003_DS_
	BANKSEL	r0x1023
	MOVZ	R0, r0x1023
	BANKSEL	r0x1022
	MOV	r0x1022, R0
;	op : -
	BANKSEL	r0x1023
	DEC	r0x1023
;	op : IFX
	MOV	R0,# 0x00
	BANKSEL	r0x1022
	ORL	R0, r0x1022
	JNB	PSW, 2
	JMP	_00005_DS_
;	op : INLINEASM
	;
	BANKSEL _EECTL1
	MOV R5,#0x81
	MOV _EECTL1,R5
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	;
	BANKSEL _BEE_BUFFER
	MOV R0,BDATAL
	ST [R3],R0
	INC R3
	MOV R0,BDATAH
	ST [R3],R0
	INC R3
	;
	BANKSEL _BADDRL
	INC _BADDRL
	JNB _PSW,_Z
	INC _BADDRH
	
;	op : GOTO
	JMP	_00003_DS_
;	op : LABEL
;	op : INLINEASM
_00005_DS_
	;
	MOV _OSCCTL,R2
	AND R1,#0xC0 ;
	ORL _INTCTL,R1
	
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _BEE_READ_FUN



func._BEE_READ_ONE	.code
;***
;  PostBlock Stats: dbName = C
;***
;entry:  _BEE_READ_ONE	;Function start
; 2 exit points
;has an exit
;5 compiler assigned registers:
;   r0x102F
;   STK00
;   r0x1030
;   r0x1031
;   r0x1032
;; Starting PostCode block
;	op : LABEL
;	op : FUNCTION
_BEE_READ_ONE	;Function start
; 2 exit points
;	op : RECEIVE
	BANKSEL	r0x1031
	MOV	r0x1031, R0
;;1	MOV	r0x102F, R0
;	.line	20; "../W_BEE.c"	unsigned int BEE_READ_ONE(unsigned int address)
	BANKSEL	STK00
	MOVZ	R0, STK00
	BANKSEL	r0x1030
	MOV	r0x1030, R0
;	op : RIGHT_OP
;;99	MOVZ	R0, r0x102F
;;1	CLR	r0x1032
;	op : CAST
;	.line	26; "../W_BEE.c"	BADDRH=(unsigned char)(address>>8);
	BANKSEL	r0x1031
	MOVZ	R0, r0x1031
	MOV	_BADDRH, R0
;	op : CAST
;	.line	27; "../W_BEE.c"	BADDRL=(unsigned char)address;
	BANKSEL	r0x1030
	MOVZ	R0, r0x1030
	MOV	_BADDRL, R0
;	op : INLINEASM
	;
	BANKSEL _INTCTL
	MOV R1,_INTCTL
	;
	CLR _INTCTL,_AIE
	JNB _INTCTL,_AIE
	JMP $-2
	;
	MOV R0,#0x30
	MOV R2,_OSCCTL
	MOV _OSCCTL,R0
	BANKSEL _EECTL1
	MOV R5,#0x81
	MOV _EECTL1,R5
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	NOPZ
	MOV _OSCCTL,R2
	AND R1,#0xC0 ;
	ORL INTCTL,R1
	BANKSEL _BEE_READ_BUF
	MOV R0,BDATAL
	MOV (_BEE_READ_BUF),R0
	MOV R0,BDATAH
	MOV (_BEE_READ_BUF+1),R0
	
;	op : RETURN
;	.line	65; "../W_BEE.c"	return 	BEE_READ_BUF;
	BANKSEL	_BEE_READ_BUF
	MOVZ	R0, _BEE_READ_BUF
	BANKSEL	STK00
	MOV	STK00, R0
	BANKSEL	_BEE_READ_BUF
	MOVZ	R0, (_BEE_READ_BUF + 1)
;	op : LABEL
;	op : ENDFUNCTION
	CRET	
; exit point of _BEE_READ_ONE


;	code size estimation:
;	   98+   66 =   164 instructions (  460 byte)


	.end
