
;------------------------------------------------------------------------------
;  CHIP: SN8F22E88B
;  Revision History
;  
;  V01   2014/11/13	
;  V02   2015/03/09	
;------------------------------------------------------------------------------
.ASSEMBLY RedWrt_FORMAT    1
.Assembly	INC_VER		1
.Assembly	ASM_FORMAT	1
.Assembly	RAM_Size	384	;256;1024

.Assembly	INSTRUMENT	SN8F22E88B
.Assembly	BIT_FILE	SN8F22E88B

.Assembly	OTP_BODY_SIZE	0x2000
.Assembly	USER_ROM_SIZE	0x1f00
.Assembly	MASK_TEST_CODE	0x0000, 0x0000, 0x0000, 0x0000

.Assembly	PGM_TYPE	6
.Assembly	CHIP_ID		0x2840
.Assembly	command		Enable_ORG4_7, RBANK_LIMIT, Enable_ISP,  PCL_READ_LIMIT, EB_ICE, INFOR_PAGE_256WORD

.Assembly	Port_Pins	8, 8, 8, 0, 8, 7

.Assembly	USB_FIFO_Size	256, 256

.Assembly	Infor_Trim1_CP_Adr	0x01DE
.Assembly	Infor_Trim1_FT_Adr	0x01DF
.Assembly	Infor_Trim1_TEMPVal 	0x1234
.Assembly	Infor_Trim1_Bit 	0x0007
.Assembly	CO_Trim1_Adr		0x3FFC
.Assembly	CO_Trim1_Bit		0, 2


.Assembly	Infor_Trim2_Adr 	0x01EF
.Assembly	Infor_Trim2_Bit 	0x000F
.Assembly	CO_Trim2_Adr		0x3FFC
.Assembly	CO_Trim2_Bit		3, 6


; Code Option 0x3FFF
.Assembly	OPTION		0		Noise_Filter 	Disable	Enable
.Assembly	OPTION		1		Security	Enable	Disable
.Assembly	OPTION		2		Fcpu		Fosc/1 Fosc/2 Fosc/4 Fosc/8
.Help
{
	Fcpu		: 	"Only Effective for HIGH Clock"
}
.Assembly	OPTION		4		High_CLK	IHRC_16M x 12M_X'tal 16M_X'tal 
.Help
{
	IHRC_16M	: "Internal 16M RC Oscillator"
	12M_X'tal	: "Crystal/Resonator: 12Mhz"
	16M_X'tal	: "Crystal/Resonator: 16Mhz"
}

.Assembly	OPTION		6		Fslow	Flosc/1	Flosc/2	Flosc/4	Flosc/8
.Help
{
	Flosc/1		: "Slow mode clock = Flosc/1"
	Flosc/2		: "Slow mode clock = Flosc/2"
	Flosc/4		: "Slow mode clock = Flosc/4"
	Flosc/8		: "Slow mode clock = Flosc/8"
}


.Assembly	OPTION		8		Watch_Dog	Always_On x x x x Enable x x x x Disable x x x x x

.Assembly	OPTION		12		Fix_High
.Assembly	OPTION		13		Fix_High
.Assembly	OPTION		14		Fix_High
.Assembly	OPTION		15		Fix_High

; Code Option 0x3FFE
.Assembly	OPTION		16		Fix_Low
.Assembly	OPTION		17		Fix_High
.Assembly	OPTION		18		Fix_Low
.Assembly	OPTION		19		Fix_High
.Assembly	OPTION		20		Fix_High
.Assembly	OPTION		21		Fix_Low
.Assembly	OPTION		22		Fix_High
.Assembly	OPTION		23		Fix_Low
.Assembly	OPTION		24		Fix_Low
.Assembly	OPTION		25		Fix_High
.Assembly	OPTION		26		Fix_Low
.Assembly	OPTION		27		Fix_High
.Assembly	OPTION		28 : 31		Fix_High

; Code Option 0x3FFD
.Assembly	OPTION		32 		Fix_High
.Assembly	OPTION		33 		Fix_High
.Assembly	OPTION		34 		Fix_High
.Assembly	OPTION		35 		Fix_High
.Assembly	OPTION		36 		Fix_High
.Assembly	OPTION		37 		Fix_High
.Assembly	OPTION		38 		Fix_High
.Assembly	OPTION		39 		Fix_High
.Assembly	OPTION		40 		Fix_High
.Assembly	OPTION		41 		Fix_High


.Assembly	OPTION		42 		LVD		LVD_L	LVD_M	LVD_H	LVD_MAX
.Help
{
	LVD_MAX		: "LVD18 Reset, LVD24 Reset, LVD33 Reset"
	LVD_H		: "LVD18 Reset, LVD24 Reset, LVD33 Flag"
	LVD_M		: "LVD18 Reset, LVD24 Flag, LVD33 OffV"
	LVD_L		: "LVD18 Reset, LVD24 Off, LVD33 Off"
}




.Assembly	OPTION		44		Reset_Pin       P56 	Reset
.Assembly	OPTION		45		Rst_Length  	No 	128*ILRC
.Assembly	OPTION		46		Watchdog_Prescaler	Flosc/4	Flosc/8	Flosc/16 Flosc/32


; Code Option 0x3FFC
.Assembly	OPTION		48 		Fix_High
.Assembly	OPTION		49 		Fix_High
.Assembly	OPTION		50 		Fix_High
.Assembly	OPTION		51 		Fix_High
.Assembly	OPTION		52 		Fix_High
.Assembly	OPTION		53 		Fix_High
.Assembly	OPTION		54 		Fix_High
.Assembly	OPTION		55 		Fix_low
.Assembly	OPTION		56 		Fix_High
.Assembly	OPTION		57 		Fix_low
.Assembly	OPTION		58 		Fix_High
.Assembly	OPTION		59 		Fix_low
.Assembly	OPTION		60 		Fix_low
.Assembly	OPTION		61 		Fix_High
.Assembly	OPTION		62 		Fix_low
.Assembly	OPTION		63 		Fix_low



.Assembly	OPTION		2ffh
;((((((((((((((((((((())))))))))))))))))))))))))))))
	L		EQU		80H
	H		EQU		81H
	R		EQU		82H
	Z		EQU		83H
	Y		EQU		84H
	X		EQU		85H
	
	PFLAG		EQU		86H
		FZ		EQU		PFLAG.0
		FDC		EQU		PFLAG.1
		FC		EQU		PFLAG.2
		FSBANKS1		EQU		PFLAG.6
		FSBANKS2		EQU		PFLAG.7

	
	RBANK 		EQU		87H
		FRFANKS		EQU		RBANK.0
		FSBANKS1	EQU		RBANK.6
		FSBANKS2	EQU		RBANK.7
		
	W0		EQU		88H
	W1		EQU		89H
	W2		EQU		8AH
	W3		EQU		8BH
	W4		EQU		8CH
	W5		EQU		8DH
	W6		EQU		8EH
	W7		EQU		8FH
	
	@HL		EQU		90H
	@YZ		EQU		91H
	PCL		EQU		93H
	PCH		EQU		94H
	
	OSCM	EQU		95H
		F8M32KSEL		EQU		OSCM.0
		FSTPHX			EQU		OSCM.1
		FCLKMD			EQU		OSCM.2
		FCPUM0			EQU		OSCM.3
		FCPUM1			EQU		OSCM.4
		FLRCSXT			EQU		OSCM.6
		FLRCS32K		EQU		OSCM.7
		
	WDTR		EQU		96H
	INTRQ0		EQU		97H
		FINT0IF		EQU		INTRQ0.0
		FINT1IF		EQU		INTRQ0.1
		FINT2IF		EQU		INTRQ0.2
		FADCIF		EQU		INTRQ0.3
		FT0IF		EQU		INTRQ0.4
		FTC0IF		EQU		INTRQ0.5
		FT2IF		EQU		INTRQ0.6
		FPBIF		EQU		INTRQ0.7

	INTRQ1		EQU		98H
		FTM1IF		EQU		INTRQ1.0
		FTM2IF		EQU		INTRQ1.1
		FTM3IF		EQU		INTRQ1.3
		FCMPIF		EQU		INTRQ1.4
		FI2CIF		EQU		INTRQ1.6
		FSPIIF		EQU		INTRQ1.7
		
	INTEN0		EQU		99H
		FINT0IE		EQU		INTEN0.0
		FINT1IE		EQU		INTEN0.1
		FINT2IE		EQU		INTEN0.2
		FADCIE		EQU		INTEN0.3
		FT0IE		EQU		INTEN0.4
		FTC0IE		EQU		INTEN0.5
		FT2IE		EQU		INTEN0.6
		FPBIE		EQU		INTEN0.7
		
	INTEN1		EQU		9AH
		FTM1IE		EQU		INTEN1.0
		FTM2IE		EQU		INTEN1.1
		FTM3IE		EQU		INTEN1.3
		FCMPIE		EQU		INTEN1.4
		FI2CIE		EQU		INTEN1.6
		FSPIIE		EQU		INTEN1.7	

	P0W			EQU		9BH
		FP00W		EQU		P0W.0
		FP01W		EQU		P0W.1
		FP02W		EQU		P0W.2
		FP03W		EQU		P0W.3
		FP04W		EQU		P0W.4
		FP05W		EQU		P0W.5
		FP06W		EQU		P0W.6
		FP07W		EQU		P0W.7

	P1W			EQU		9CH
		FP10W		EQU		P1W.0
		FP11W		EQU		P1W.1
		FP12W		EQU		P1W.2
		FP13W		EQU		P1W.3
		FP14W		EQU		P1W.4
		FP15W		EQU		P1W.5
		FP16W		EQU		P1W.6

	P2W			EQU		9DH
		FP20W		EQU		P2W.0
		FP21W		EQU		P2W.1
		FP22W		EQU		P2W.2
		FP23W		EQU		P2W.3
		FP24W		EQU		P2W.4
		FP25W		EQU		P2W.5
		FP26W		EQU		P2W.6	
		
	P4W			EQU		9EH
		FP40W		EQU		P4W.0
		FP41W		EQU		P4W.1
		FP42W		EQU		P4W.2
		FP43W		EQU		P4W.3
		FP44W		EQU		P4W.4
		FP45W		EQU		P4W.5
		FP46W		EQU		P4W.6
		FP47W		EQU		P4W.7		
		
	PEDGE		EQU		9FH
		FPG0		EQU		PEDGE.0
		FPG1		EQU		PEDGE.1
		
	P0M			EQU		0A0H
		FP00M		EQU		P0M.0
		FP01M		EQU		P0M.1
		FP02M		EQU		P0M.2
		FP03M		EQU		P0M.3
		FP04M		EQU		P0M.4
		FP05M		EQU		P0M.5
		FP06M		EQU		P0M.6
		FP07M		EQU		P0M.7
		
	P1M			EQU		0A1H
		FP10M		EQU		P1M.0
		FP11M		EQU		P1M.1
		FP12M		EQU		P1M.2
		FP13M		EQU		P1M.3
		FP14M		EQU		P1M.4
		FP15M		EQU		P1M.5
		FP16M		EQU		P1M.6
	
	P2M			EQU		0A2H
		FP20M		EQU		P2M.0
		FP21M		EQU		P2M.1
		FP22M		EQU		P2M.2
		FP23M		EQU		P2M.3
		FP24M		EQU		P2M.4
		FP25M		EQU		P2M.5
		FP26M		EQU		P2M.6

	P4M			EQU		0A3H
		FP40M		EQU		P4M.0
		FP41M		EQU		P4M.1
		FP42M		EQU		P4M.2
		FP43M		EQU		P4M.3
		FP44M		EQU		P4M.4
		FP45M		EQU		P4M.5
		FP46M		EQU		P4M.6
		FP47M		EQU		P4M.7

	P0			EQU		0A5H
		FP00		EQU		P0.0
		FP01		EQU		P0.1
		FP02		EQU		P0.2
		FP03		EQU		P0.3
		FP04		EQU		P0.4
		FP05		EQU		P0.5
		FP06		EQU		P0.6
		FP07		EQU		P0.7

	P1			EQU		0A6H
		FP10		EQU		P1.0
		FP11		EQU		P1.1
		FP12		EQU		P1.2
		FP13		EQU		P1.3
		FP14		EQU		P1.4
		FP15		EQU		P1.5
		FP16		EQU		P1.6

	P2			EQU		0A7H
		FP20		EQU		P2.0
		FP21		EQU		P2.1
		FP22		EQU		P2.2
		FP23		EQU		P2.3
		FP24		EQU		P2.4
		FP25		EQU		P2.5
		FP26		EQU		P2.6
		
		
	P4			EQU		0A8H
		FP40		EQU		P4.0
		FP41		EQU		P4.1
		FP42		EQU		P4.2
		FP43		EQU		P4.3
		FP44		EQU		P4.4
		FP45		EQU		P4.5
		FP46		EQU		P4.6
		FP47		EQU		P4.7		
		
	P0UR		EQU		0AAH
		FP00UR		EQU		P0UR.0
		FP01UR		EQU		P0UR.1
		FP02UR		EQU		P0UR.2
		FP03UR		EQU		P0UR.3
		FP04UR		EQU		P0UR.4
		FP05UR		EQU		P0UR.5
		FP06UR		EQU		P0UR.6
		FP07UR		EQU		P0UR.7
		
	P1UR		EQU		0ABH
		FP10UR		EQU		P1UR.0
		FP11UR		EQU		P1UR.1
		FP12UR		EQU		P1UR.2
		FP13UR		EQU		P1UR.3
		FP14UR		EQU		P1UR.4
		FP15UR		EQU		P1UR.5
		FP16UR		EQU		P1UR.6
	
	P2UR		EQU		0ACH
		FP20UR		EQU		P2UR.0
		FP21UR		EQU		P2UR.1
		FP22UR		EQU		P2UR.2
		FP23UR		EQU		P2UR.3
		FP24UR		EQU		P2UR.4
		FP25UR		EQU		P2UR.5
		FP26UR		EQU		P2UR.6

	P4UR		EQU		0ADH
		FP40UR		EQU		P4UR.0
		FP41UR		EQU		P4UR.1
		FP42UR		EQU		P4UR.2
		FP43UR		EQU		P4UR.3
		FP44UR		EQU		P4UR.4
		FP45UR		EQU		P4UR.5
		FP46UR		EQU		P4UR.6
		FP47UR		EQU		P4UR.7

	REMC		EQU		0AFH
		FREM_SEL0		EQU		REMC.0
		FREM_SEL1		EQU		REMC.1
		FREM_SEL2		EQU		REMC.2
		FREM_SEL3		EQU		REMC.3
		FREM_SEL4		EQU		REMC.4
		FELE_EN			EQU		REMC.5
		FD_SEL 			EQU		REMC.6
		FIE_SEL			EQU		REMC.7
		
	LCDCT0		EQU		0B0H	
		FSCANSEL		EQU		LCDCT0.0
		FDUTY0			EQU		LCDCT0.4
		FDUTY1			EQU		LCDCT0.5
		FLCDEN			EQU		LCDCT0.7


	LCDDB		EQU		0B1H
	LCDADR		EQU		0B2H
	LCDCT1		EQU		0B3H
		FLCDCLKS0		EQU		LCDCT1.0
		FLCDCLKS1		EQU		LCDCT1.1
		FVLO0			EQU		LCDCT1.3
		FVLO1			EQU		LCDCT1.4
		FLEDEN			EQU		LCDCT1.7

	
	LCDCT2		EQU		0B4H
		FCOMS4		EQU		LCDCT2.4
		FCOMS5		EQU		LCDCT2.5
		FCOMS6		EQU		LCDCT2.6
		
	PWM0DL		EQU		0B5H
	PWM0DH		EQU		0B6H
	PWM0PL		EQU		0B7H
	PWM0PH		EQU		0B8H
	
	PWM0EN		EQU		0B9H
		FPWM0_EN	EUQ		PWM0EN.0
		FPWM0_OEN	EUQ		PWM0EN.1
		FPWM01_OEN	EUQ		PWM0EN.2
		FPWM0_M		EUQ		PWM0EN.3
		FPWM1_OEN	EUQ		PWM0EN.4
		FTM1SEL8	EUQ		PWM0EN.5
		FTM1EN		EUQ		PWM0EN.7

	PWM0C		EQU		0BAH
		FCK00		EQU		PWM0C.0
		FCK01		EQU		PWM0C.1
		FPWM0SL0	EQU		PWM0C.2
		FPWM0SL1	EQU		PWM0C.3
		FCK02		EQU		PWM0C.6
		FCK03		EQU		PWM0C.7
		
	PWM0TL		EQU		0BBH
	PWM0TH		EQU		0BCH
	PWM0DTL		EQU		0BDH
	PWM0DTH		EQU		0BEH	

	PWMPSC		EQU		0BFH	
		FPWM0S0		EQU		PWMPSC.0
		FPWM01S0	EQU		PWMPSC.1
		FPWM1S0		EQU		PWMPSC.2
		FPWM0S1		EQU		PWMPSC.3
		FPWM01S1	EQU		PWMPSC.4
		FPWM1S1		EQU		PWMPSC.5
		
	P0SS		EQU		0C0H
		FP0SS0		EQU		P0SS.0
		FP0SS1		EQU		P0SS.1
		FP0SS2		EQU		P0SS.2
		FP0SS3		EQU		P0SS.3
		FP0SS4		EQU		P0SS.4
		FP0SS5		EQU		P0SS.5
		FP0SS6		EQU		P0SS.6
		FP0SS7		EQU		P0SS.7
		
	P1SS		EQU		0C1H
		FP1SS0		EQU		P1SS.0
		FP1SS1		EQU		P1SS.1
		FP1SS2		EQU		P1SS.2
		FP1SS3		EQU		P1SS.3
		FP1SS4		EQU		P1SS.4
		FP1SS5		EQU		P1SS.5
		FP1SS6		EQU		P1SS.6
	
	P2SS		EQU		0C2H
		FP2SS0		EQU		P2SS.0
		FP2SS1		EQU		P2SS.1
		FP2SS2		EQU		P2SS.2
		FP2SS3		EQU		P2SS.3
		FP2SS4		EQU		P2SS.4
		FP2SS5		EQU		P2SS.5
		FP2SS6		EQU		P2SS.6
	

	P4SS		EQU		0C3H
		FP4SS0		EQU		P4SS.0
		FP4SS1		EQU		P4SS.1
		FP4SS2		EQU		P4SS.2
		FP4SS3		EQU		P4SS.3
		FP4SS4		EQU		P4SS.4
		FP4SS5		EQU		P4SS.5
		FP4SS6		EQU		P4SS.6
		FP4SS7		EQU		P4SS.7

	ADPCON1		EQU		0C5H
	ADPCON		EQU		0C7H

	ADM			EQU		0C8H
		FCHS0		EUQ		ADM.0
		FCHS1		EUQ		ADM.1
		FCHS2		EUQ		ADM.2
		FCHS3		EUQ		ADM.3
		FGCHS		EUQ		ADM.4
		FEOC		EUQ		ADM.5
		FADS		EUQ		ADM.6
		FADENB		EUQ		ADM.7
		
	ADB			EQU		0C9H
	ADR			EQU		0CAH
		FADB0		EQU		ADR.0
		FADB1		EQU		ADR.1
		FADB2		EQU		ADR.2
		FADB3		EQU		ADR.3
		FADCKS0		EQU		ADR.4
		FADCKS1		EQU		ADR.6

	ADT			EQU		0CBH
		FADT0		EQU		ADT.0
		FADT1		EQU		ADT.1
		FADT2		EQU		ADT.2
		FADT3		EQU		ADT.3
		FADTS0		EQU		ADT.4
		
	WDTC		EQU		0CCH
		FWDTC2			EQU		WDTC.2
		FWDTC3			EQU		WDTC.3
		FWDT_PRE0		EQU		WDTC.4
		FWDT_PRE1		EQU		WDTC.5
		FWDT_PRE2		EQU		WDTC.6
		FWDT_EN			EQU		WDTC.7
		
	SBANK		EQU		0CDH
		FSBANK0			EQU		SBANK.0
		FSBANK1			EQU		SBANK.1
		FSBANK7			EQU		SBANK.7


	VREFH		EQU		0CEH
		FVHS0			EQU		VREFH.0
		FVHS1			EQU		VREFH.1
		FEVHENB			EQU		VREFH.7
		
	LVDC		EQU		0CFH	
		FLVDTE			EQU		LVDC.7
		
	P0PD		EQU		0D0H
		FP00PD		EQU		P0PD.0
		FP01PD		EQU		P0PD.1
		FP02PD		EQU		P0PD.2
		FP03PD		EQU		P0PD.3
		FP04PD		EQU		P0PD.4
		FP05PD		EQU		P0PD.5
		FP06PD		EQU		P0PD.6
		FP07PD		EQU		P0PD.7
		
	P1PD		EQU		0D1H
		FP10PD		EQU		P1PD.0
		FP11PD		EQU		P1PD.1
		FP12PD		EQU		P1PD.2
		FP13PD		EQU		P1PD.3
		FP14PD		EQU		P1PD.4
		FP15PD		EQU		P1PD.5
		FP16PD		EQU		P1PD.6

	P2PD		EQU		0D2H
		FP20PD		EQU		P2PD.0
		FP21PD		EQU		P2PD.1
		FP22PD		EQU		P2PD.2
		FP23PD		EQU		P2PD.3
		FP24PD		EQU		P2PD.4
		FP25PD		EQU		P2PD.5
		FP26PD		EQU		P2PD.6
		
		
	P4PD		EQU		0D3H
		FP40PD		EQU		P4PD.0
		FP41PD		EQU		P4PD.1
		FP42PD		EQU		P4PD.2
		FP43PD		EQU		P4PD.3
		FP44PD		EQU		P4PD.4
		FP45PD		EQU		P4PD.5
		FP46PD		EQU		P4PD.6
		FP47PD		EQU		P4PD.7


	TKC0		EQU		0D5H
		FTKPS0		EQU		TKC0.0
		FTKPS1		EQU		TKC0.1
		FTKPS2		EQU		TKC0.2
		FTKPS3		EQU		TKC0.3
		FCHRVS		EQU		TKC0.4
		FTKGCHS		EQU		TKC0.5
		FTKST		EQU		TKC0.6
		FTKEN		EQU		TKC0.7

	TK16DH		EQU		0D6H
	TK16DL		EQU		0D7H
	TKC1		EQU		0D8H
		FDCTS0		EQU		TKC1.0
		FDCTS1		EQU		TKC1.1
		FCCFLT0		EQU		TKC1.4
		FCCFLT1		EQU		TKC1.5
		FCCFLT2		EQU		TKC1.6


	TKC2		EQU		0D9H
		FCTS0		EQU		TKC2.0
		FCTS1		EQU		TKC2.1
		FCTS2		EQU		TKC2.2
		FCTS3		EQU		TKC2.3

	TKC3		EQU		0DAH
		FCVREFS0	EQU		TKC3.0
		FCVREFS1	EQU		TKC3.1
		FCPVS0		EQU		TKC3.3
		FCPVS1		EQU		TKC3.4
		
	TKSTA		EQU		0DBH
		FSACMPO		EQU		TKSTA.1
		FACMPO		EQU		TKSTA.2
		FDCMPO		EQU		TKSTA.3
		FTKINTIE	EQU		TKSTA.5
		FTKINTIF	EQU		TKSTA.6
		FMOUT		EQU		TKSTA.7
		
	TKPDH		EQU		0DCH
	TKPDL		EQU		0DDH
	ADF1		EQU		0DEH
		FADF17		EQU		ADF1.7
		
	ADF0		EQU		0DFH
	P0OD		EQU		0E0H
		FP00OD		EQU		P0OD.0
		FP01OD		EQU		P0OD.1
		FP02OD		EQU		P0OD.2
		FP03OD		EQU		P0OD.3
		FP04OD		EQU		P0OD.4
		FP05OD		EQU		P0OD.5
		FP06OD		EQU		P0OD.6
		FP07OD		EQU		P0OD.7
		
	P1OD		EQU		0E1H
		FP10OD		EQU		P1OD.0
		FP11OD		EQU		P1OD.1
		FP12OD		EQU		P1OD.2
		FP13OD		EQU		P1OD.3
		FP14OD		EQU		P1OD.4
		FP15OD		EQU		P1OD.5
		FP16OD		EQU		P1OD.6
		
	P2OD		EQU		0E2H
		FP20OD		EQU		P2OD.0
		FP21OD		EQU		P2OD.1
		FP22OD		EQU		P2OD.2
		FP23OD		EQU		P2OD.3
		FP24OD		EQU		P2OD.4
		FP25OD		EQU		P2OD.5
		FP26OD		EQU		P2OD.6
		
	P4OD		EQU		0E3H
		FP40OD		EQU		P4OD.0
		FP41OD		EQU		P4OD.1
		FP42OD		EQU		P4OD.2
		FP43OD		EQU		P4OD.3
		FP44OD		EQU		P4OD.4
		FP45OD		EQU		P4OD.5
		FP46OD		EQU		P4OD.6
		FP47OD		EQU		P4OD.7

	SMTS		EQU		0E5H
		FSMTS0		EQU		SMTS.0
		FSMTS1		EQU		SMTS.1
		FSMTS2		EQU		SMTS.2
		FSMTS3		EQU		SMTS.3
		
	TC0D2		EQU		0E6
	TC0M1		EQU		0E7
		FPWM1EN		EQU		TC0M1.0
		FPWM2EN		EQU		TC0M1.1
		FPWM0S0		EQU		TC0M1.2
		FPWM1S0		EQU		TC0M1.3
		FPWM2S0		EQU		TC0M1.4
		FPWM0S1		EQU		TC0M1.5
		FPWM1S1		EQU		TC0M1.6
		FPWM2S1		EQU		TC0M1.7
		
	
	PWM1DL		EQU		0E8H
	PWM1DH		EQU		0E9H
	TC0M		EQU		0EAH
		FPWM0		EQU		TC0M.0
		FINT0CK		EQU		TC0M.2
		FTCCKS		EQU		TC0M.3
		FTC0S0		EQU		TC0M.4
		FTC0S1		EQU		TC0M.5
		FTC0S2		EQU		TC0M.6
		FTC0TR		EQU		TC0M.7
		
	TC0R		EQU		0EBH
	TC0CL		EQU		0ECH
	TC0CH		EQU		0EDH
	TC0D1		EQU		0EEH
	STKP		EQU		0EFH
		FSTKPB0		EQU		STKP.0
		FSTKPB1		EQU		STKP.1
		FSTKPB2		EQU		STKP.2
		FGIT		EQU		STKP.7
		
	STKP7L		EQU		0F0H
	STKP7H		EQU		0F1H
	STKP6L		EQU		0F2H
	STKP6H		EQU		0F3H	
	STKP5L		EQU		0F4H
	STKP5H		EQU		0F5H
	STKP4L		EQU		0F6H
	STKP4H		EQU		0F7H
	STKP3L		EQU		0F8H
	STKP3H		EQU		0F9H
	STKP2L		EQU		0FAH
	STKP2H		EQU		0FBH
	STKP1L		EQU		0FCH
	STKP1H		EQU		0FDH
	STKP0L		EQU		0FEH
	STKP0H		EQU		0FFH	
	
	


;============[BANK 1]===============================


	TL0C1		EQU		0B0H
	TL0C2		EQU		0B1H
	TL0C3		EQU		0B2H
	PWM3DL		EQU		0B3H
	PWM3DH		EQU		0B4H
	PWM2DL		EQU		0B5H
	PWM2DH		EQU		0B6H
	PWM2PL		EQU		0B7H
	PWM2PH		EQU		0B8H
	PWM1EN		EQU		0B9H
		FPWM2_EN		EQU		PWM1EN.0
		FPWM2_OEN		EQU		PWM1EN.1
		FPWM21_OEN		EQU		PWM1EN.2
		FPWM1M			EQU		PWM1EN.3
		FPWM3_OEN		EQU		PWM1EN.4
		FTM2SEL8		EQU		PWM1EN.5
		FTM2SEL16		EQU		PWM1EN.6
		FTM2EN			EQU		PWM1EN.7

	PWM2C		EQU		0BAH
		FCK20			EQU		PWM2C.0
		FCK21			EQU		PWM2C.1
		FPWM2SL0		EQU		PWM2C.2
		FPWM2SL1		EQU		PWM2C.3
		FCK22			EQU		PWM2C.6
		FCK23			EQU		PWM2C.7

	PWM2TL		EQU		0BBH
	PWM2TH		EQU		0BCH
	PWM2DTL		EQU		0BDH
	PWM2DTH		EQU		0BEH
	PWM2PSC		EQU		0BFH
		FPWM2S0				EQU		PWM2PSC.0
		FPWM21S0			EQU		PWM2PSC.1
		FPWM3S0				EQU		PWM2PSC.2
		FPWM2S1				EQU		PWM2PSC.3
		FPWM21S1			EQU		PWM2PSC.4
		FPWM3S1				EQU		PWM2PSC.5

	P0SC		EQU		0C0H
		FP00SC		EQU		P0SC.0
		FP01SC		EQU		P0SC.1
		FP02SC		EQU		P0SC.2
		FP03SC		EQU		P0SC.3
		FP04SC		EQU		P0SC.4
		FP05SC		EQU		P0SC.5
		FP06SC		EQU		P0SC.6
		FP07SC		EQU		P0SC.7
		
	P4SC		EQU		0C1H
		FP40SC		EQU		P4SC.0
		FP41SC		EQU		P4SC.1
		FP42SC		EQU		P4SC.2
		FP43SC		EQU		P4SC.3
		FP44SC		EQU		P4SC.4
		FP45SC		EQU		P4SC.5
		FP46SC		EQU		P4SC.6
		FP47SC		EQU		P4SC.7		

	P0IS		EQU		0C2H
		FP00IS		EQU		P0IS.0
		FP01IS		EQU		P0IS.1
		FP02IS		EQU		P0IS.2
		FP03IS		EQU		P0IS.3
	
	P1IS		EQU		0C2H
		FP10IS		EQU		P1IS.0
		FP11IS		EQU		P1IS.1
		FP12IS		EQU		P1IS.2
		FP13IS		EQU		P1IS.3

	P2IS		EQU		0C2H
		FP20IS		EQU		P2IS.0
		FP21IS		EQU		P2IS.1
		FP22IS		EQU		P2IS.2
		FP23IS		EQU		P2IS.3

	P4IS		EQU		0C2H
		FP40IS		EQU		P4IS.0
		FP41IS		EQU		P4IS.1
		FP42IS		EQU		P4IS.2
		FP43IS		EQU		P4IS.3	

	TL0M		EQU		0C7H
		FT2BSEL		EQU		TL0M.2
		FTP2S0		EQU		TL0M.3
		FTP2S1		EQU		TL0M.4
		FTP2S2		EQU		TL0M.5
		FT2WC		EQU		TL0M.6
		FT2TR		EQU		TL0M.7
		
	TL0C		EQU		0C8H
	T0M			EQU		0C9H
		FTC0GN		EQU		T0M.0
		FT0CK		EQU		T0M.2
		FTP0SEL		EQU		T0M.3
		FTP0S0		EQU		T0M.4
		FTP0S1		EQU		T0M.5
		FTP0S2		EQU		T0M.6
		FT0TR		EQU		T0M.7
		
	T0L			EQU		0CAH
	T0H			EQU		0CBH
	T0M1		EQU		0CCH
		FT0GN		EQU		T0M1.0
		FT0OVS		EQU		T0M1.1
		FTPWMW1		EQU		T0M1.3
		FTPWMW2		EQU		T0M1.4
		
	TIRCF		EQU		0CEH
	I2CCON		EQU		0D0H
		FI2CEN		EQU		I2CCON.0
		FI2CPU		EQU		I2CCON.1
		FCKP		EQU		I2CCON.2
		FTXAK		EQU		I2CCON.3
		FSRW		EQU		I2CCON.4
		FHBB		EQU		I2CCON.5
		FHAAS		EQU		I2CCON.6
		FHCF		EQU		I2CCON.7
	
	I2CADR		EQU		0D1H
	I2CBUF		EQU		0D2H
	I2CTOV		EQU		0D3H
		FTOS0		EQU		I2CTOV.0
		FTOS1		EQU		I2CTOV.1
		FTOS2		EQU		I2CTOV.2
		FTOVF		EQU		I2CTOV.6
		FTOVEN		EQU		I2CTOV.7
		
	RCSTA		EQU		0E0H
		FRX9D		EQU		RCSTA.0
		FOERR		EQU		RCSTA.1
		FFERR		EQU		RCSTA.2
		FCREN		EQU		RCSTA.4
		FSREN		EQU		RCSTA.5
		FRX9		EQU		RCSTA.6
		FSPEN		EQU		RCSTA.7
	
	TXREG		EQU		0E1H
	RCREG		EQU		0E2H
	TXSTA		EQU		0E3H
		FTX9D		EQU		TXSTA.0
		FTRMT		EQU		TXSTA.1
		FBRGH		EQU		TXSTA.2
		FSYNC		EQU		TXSTA.4
		FTXEN		EQU		TXSTA.5
		FTX9		EQU		TXSTA.6

	SPBRG		EQU		0E4H
	SPBRGH		EQU		0E5H
	BAUDCTL		EQU		0E6H
		FIFTX		EQU		BAUDCTL.0
		FIFRX		EQU		BAUDCTL.1
		FITXEN		EQU		BAUDCTL.4
		FIRXEN		EQU		BAUDCTL.5
	
	SIMC0		EQU		0E7H
		FSPIEN		EQU		SIMC0.1
		FSIMM0		EQU		SIMC0.5
		FSIMM1		EQU		SIMC0.6
		FSIMM2		EQU		SIMC0.7
	
	SIMC1		EQU		0E8H
		FTRF		EQU		SIMC1.0
		FSSEN		EQU		SIMC1.2
		FMLS		EQU		SIMC1.3
		FCKP		EQU		SIMC1.4
		FCKEG		EQU		SIMC1.5
	
	SIMD		EQU		0EAH
	ITFACES		EQU		0EDH
		FRXIN		EQU		ITFACES.0
		FTXOUT		EQU		ITFACES.1
		FI2CSCL		EQU		ITFACES.2
		FI2CSDA		EQU		ITFACES.3
		FSPICLK		EQU		ITFACES.4
		FSCS		EQU		ITFACES.5
		FRXIN		EQU		ITFACES.6
		FRXIN		EQU		ITFACES.7
		
	ITFACES1		EQU		0EEH
		FUARTPTS0		EQU		ITFACES1.0
		FUARTPTS1		EQU		ITFACES1.1
		FUARTPTS2		EQU		ITFACES1.2

	
;====================[BANK 2]===============================

	
	CMPC1		EQU		0B1H
	LFSEL		EQU		0B2H
	PWM4DL		EQU		0B5H
	PWM4DH		EQU		0B6H
	PWM4PL		EQU		0B7H
	PWM4PH		EQU		0B8H
	PWM2EN		EQU		0B9H
		FPWM4_EN		EQU		PWM2EN.0
		FPWM4_OEN		EQU		PWM2EN.1
		FPWM41_OEN		EQU		PWM2EN.2
		FPWM2M			EQU		PWM2EN.3
		FTM3SEL8		EQU		PWM2EN.5
		FTM3EN			EQU		PWM2EN.7
		
	PWM4C		EQU		0BAH
		FCK40		EQU		PWM4C.0
		FCK41		EQU		PWM4C.1
		FPWM4SL0		EQU		PWM4C.2
		FPWM4SL1		EQU		PWM4C.3
		FCK42		EQU		PWM4C.6
		FCK43		EQU		PWM4C.7
		
	PWM4TL		EQU		0BBH
	PWM4TH		EQU		0BCH
	PWM4DTL		EQU		0BDH
	PWM4DTH		EQU		0BEH
	LOAD		EQU		0CFH
		FLOADEN0		EQU		LOAD.0
		FLOADEN1		EQU		LOAD.1
		FLOADEN2		EQU		LOAD.2
		
	FDATL		EQU		0DFH
;	EADRL		EQU		0E0H
;	EECON1		EQU		0E1H
;		FREADEE		EQU		EECON1.0
;		FPROGEE		EQU		EECON1.1
;		FERASEEE	EQU		EECON1.2
;		ERSALLEE	EQU		EECON1.3
;		FTIMEE0		EQU		EECON1.5
;		FTIMEE1		EQU		EECON1.6
;		
;	EDATL		EQU		0E2H
	CMPCON		EQU		0E3H
		FCOPOL		EQU		CMPCON.1
		FCVEN		EQU		CMPCON.2
		FCPEN		EQU		CMPCON.3
		FCODEB		EQU		CMPCON.4
		FFTCKS		EQU		CMPCON.5
		FCMPIF		EQU		CMPCON.6
		FCMPEN		EQU		CMPCON.7
		
		
	CMPM		EQU		0E4H
		FVRS0		EQU		CMPM.0
		FVRS1		EQU		CMPM.1
		FVRS2		EQU		CMPM.2
		FVRS3		EQU		CMPM.3
		FXRVSEL		EQU		CMPM.4
		FCPINS0		EQU		CMPM.5
		FCPINS1		EQU		CMPM.6
		FCOMSEL		EQU		CMPM.7
		
	OPAM		EQU		0E5H
		FOPAM0		EQU		OPAM.0
		FOPAM1		EQU		OPAM.1
		FOPAM2		EQU		OPAM.2
		FOPAM3		EQU		OPAM.3
		FOPAM4		EQU		OPAM.4
		FOPAM5		EQU		OPAM.5
		FOPAM6		EQU		OPAM.6
		FOPAM7		EQU		OPAM.7
		
	OPAM1		EQU		0E6H
		FOPAM10		EQU		OPAM1.0
		FOPAM11		EQU		OPAM1.1
		FOPAM12		EQU		OPAM1.2
		FOPAM13		EQU		OPAM1.3
		FOPAM17		EQU		OPAM1.7		
	
	OPAMC		EQU		0E7H
		FAP1NS		EQU		OPAMC.0
		FAP1NS0		EQU		OPAMC.1
		FAP1OS		EQU		OPAMC.2
		FAP1OSP		EQU		OPAMC.3
		FAP1PS0		EQU		OPAMC.4
		FAP1PS		EQU		OPAMC.5
		FLVHSEN		EQU		OPAMC.6
		FOPAMC7		EQU		OPAMC.7
		
	OPAMC1		EQU		0E8H
		FAP2NS			EQU		OPAMC1.0
		FAP2NS0			EQU		OPAMC1.1
		FAP2OS			EQU		OPAMC1.2
		FAP2OSP			EQU		OPAMC1.3
		FAP2PS0			EQU		OPAMC1.4
		FAP2PS			EQU		OPAMC1.5
		FLVHSEN1		EQU		OPAMC1.6
		FOPAMC17		EQU		OPAMC1.7	

	FLER		EQU		0E9H
		FFOV		EQU		FLER.0
		
	FADRH		EQU		0EAH
	FADRL		EQU		0EBH
	FCON1		EQU		0ECH
		FREADL		EQU		FCON1.0
		FPROGL		EQU		FCON1.1
		FERASEL		EQU		FCON1.2
		FTIMEL0		EQU		FCON1.5
		FTIMEL1		EQU		FCON1.6
		FCEFL		EQU		FCON1.7
		
	FCON2		EQU		0EDH
	FDATH		EQU		0EEH
	
;((((((((((((((((((((())))))))))))))))))))))))))))))

; -----------------------------------------------------
; Clear watchdog macro. 
;  
; Total Cycle: 2

	@RST_WDT	macro
		   MOV  A, #0x5A
		   B0MOV  WDTR, A
	endm
; -----------------------------------------------------
; Sleep Mode control macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 1

	SleepMode	macro	
		B0BSET	FCPUM0
	endm
; -----------------------------------------------------
; Green Mode control macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 3

	GreenMode	macro	
		B0BSET	FCPUM1
		NOP
		NOP
	endm
; -----------------------------------------------------
; Slow Mode control macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 2

	SlowMode	macro	
		B0BSET	FCLKMD
		B0BSET	FSTPHX
	endm
; -----------------------------------------------------
;  Slow mode to Normal Mode control macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 5

	Slow2Normal	macro	
		B0BCLR	FSTPHX
		NOP
		NOP
		NOP
		B0BCLR	FCLKMD
	endm
; -----------------------------------------------------
;  Slow mode to Normal Mode control macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 5

	Set_P3_Input_Pullup	macro	
    DW	0x2D00 		;mov	a, #0x00	; Port 3: Input pull-up high
    DW 	0x2FC3 		;b0mov	P3M,a
    DW	0x2DFF 		;mov	a, #0xFF
    DW	0x2FD3 		;b0mov	P3,a
    DW	0x2FE3 		;b0mov	P3UR,a
	endm
; -----------------------------------------------------
	
.TEXT
{
	//{{SONIX_OPTION_RULE
        
	ENDP
	//}}SONIX_OPTION_RULE
}