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OUT	EQU	TC0M.1
		FPWM0OUT	EQU	TC0M.0
	TC0C	EQU	0xdb
	TC1M	EQU	0xdc
		FTC1ENB	EQU	TC1M.7
		FTC1RATE2	EQU	TC1M.6
		FTC1RATE1	EQU	TC1M.5
		FTC1RATE0	EQU	TC1M.4
		FTC1CKS	EQU	TC1M.3
		FALOAD1	EQU	TC1M.2
		FTC1OUT	EQU	TC1M.1
		FPWM1OUT	EQU	TC1M.0
	TC1C	EQU	0xdd
	TC1R	EQU	0xde
	STKP	EQU	0xdf
		FGIE	EQU	STKP.7
		FSTKPB2	EQU	STKP.2
		FSTKPB1	EQU	STKP.1
		FSTKPB0	EQU	STKP.0
	REG_0E0h	EQU	0xe0
	REG_0E1h	EQU	0xe1
	REG_0E2h	EQU	0xe2
	REG_0E3h	EQU	0xe3
	P4UR	EQU	0xe4
	REG_0E5h	EQU	0xe5
	@HL	EQU	0xe6
	@YZ	EQU	0xe7
	REG_0E8h	EQU	0xe8
	REG_0E9h	EQU	0xe9
	REG_0EAh	EQU	0xea
	REG_0EBh	EQU	0xeb
	REG_0ECh	EQU	0xec
	REG_0EDh	EQU	0xed
	REG_0EEh	EQU	0xee
	REG_0EFh	EQU	0xef
	STK7L	EQU	0xf0
	STK7H	EQU	0xf1
	STK6L	EQU	0xf2
	STK6H	EQU	0xf3
	STK5L	EQU	0xf4
	STK5H	EQU	0xf5
	STK4L	EQU	0xf6
	STK4H	EQU	0xf7
	STK3L	EQU	0xf8
	STK3H	EQU	0xf9
	STK2L	EQU	0xfa
	STK2H	EQU	0xfb
	STK1L	EQU	0xfc
	STK1H	EQU	0xfd
	STK0L	EQU	0xfe
	STK0H	EQU	0xff
@RST_WDT	macro		
		MOV	A, #0x5A
		B0MOV	WDTR, A
	endm

SleepMode	macro	
		B0BSET	FCPUM0
	endm

GreenMode	macro	
		B0BSET	FCPUM1
		NOP
		NOP
	endm

SlowMode	macro	
		B0BSET	FCLKMD
		B0BSET	FSTPHX
	endm

Slow2Normal	macro	
		B0BCLR	FSTPHX
		NOP
		NOP
		NOP
		B0BCLR	FCLKMD
	endm

endif
