
;------------------------------------------------------------------------------
;  CHIP: SN8F22E88B
;  Revision History
;  
;  V01   2014/11/13	
;------------------------------------------------------------------------------
.ASSEMBLY RedWrt_FORMAT    1
.Assembly	INC_VER		1
.Assembly	ASM_FORMAT	1
.Assembly	RAM_Size	1024

.Assembly	INSTRUMENT	SN8F22E88B
.Assembly	BIT_FILE	SN8F22E88B

.Assembly	OTP_BODY_SIZE	0x4000
.Assembly	USER_ROM_SIZE	0x3FF8
.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
		FSTKOV		EQU_R		PFLAG.4
		FRST		EQU_R		PFLAG.5
		FWDT		EQU_R		PFLAG.6
		FPOR		EQU_R		PFLAG.7

	RBANK		EQU		87H
		FRBNKS0		EQU		RBANK.0
		FRBNKS1		EQU		RBANK.1
		FRBNKS2		EQU		RBANK.2


	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

	UPLL		EQU		92H
		FUPLLEN		EQU		UPLL.0
		FUPLLSRC0	EQU		UPLL.1
		FUPLLSRC1	EQU		UPLL.2
		FUPLLRDY 	EQU_R		UPLL.3
		FEHSRDY		EQU_R		UPLL.4
		FIHRC_EN	EQU		UPLL.5
		FEHS_EN		EQU		UPLL.6


	PCL		EQU		93H
	PCH		EQU		94H
	OSCM		EQU		95H
		FCPUM1		EQU		OSCM.4
		FCPUM0		EQU		OSCM.3
		FCLKMD		EQU		OSCM.2
		FSTPHX		EQU		OSCM.1

	WDTR		EQU_W		96H


	INTRQ0		EQU		97H
		FWAKEIRQ  	EQU		INTRQ0.0
		FP16IRQ		EQU		INTRQ0.1
		FP50IRQ		EQU		INTRQ0.2
		FUPDETIRQ 	EQU		INTRQ0.3
		FUSBIRQ 	EQU		INTRQ0.4
		FP0IRQ		EQU		INTRQ0.5
		FP1IRQ		EQU		INTRQ0.6
		FT0IRQ		EQU		INTRQ0.7

	INTRQ1		EQU		98H
		FT1IRQ		EQU		INTRQ1.0
		FTC0IRQ		EQU		INTRQ1.1
		FTC1IRQ		EQU		INTRQ1.2
		FTC2IRQ 	EQU		INTRQ1.3
		FNDTIRQ		EQU		INTRQ1.4
		FADCIRQ		EQU		INTRQ1.5
		FSIOIRQ		EQU		INTRQ1.6

	INTEN0		EQU		99H
		FWAKEIEN  	EQU		INTEN0.0
		FP16IEN		EQU		INTEN0.1
		FP50IEN		EQU		INTEN0.2
		FUPDETIEN 	EQU		INTEN0.3
		FUSBIEN 	EQU		INTEN0.4
		FP0IEN		EQU		INTEN0.5
		FP1IEN		EQU		INTEN0.6
		FT0IEN		EQU		INTEN0.7

	INTEN1 		EQU		9AH
		FT1IEN		EQU		INTEN1.0
		FTC0IEN		EQU		INTEN1.1
		FTC1IEN		EQU		INTEN1.2
		FTC2IEN 	EQU		INTEN1.3
		FNDTIEN		EQU		INTEN1.4
		FADCIEN		EQU		INTEN1.5
		FSIOIEN		EQU		INTEN1.6


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

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

	P0IE		EQU		9DH
		FP07IE		EQU		P0IE.7
		FP06IE		EQU		P0IE.6
		FP05IE		EQU		P0IE.5
		FP04IE		EQU		P0IE.4
		FP03IE		EQU		P0IE.3
		FP02IE		EQU		P0IE.2
		FP01IE		EQU		P0IE.1
		FP00IE		EQU		P0IE.0

	P1IE		EQU		9EH
		FP17IE		EQU		P1IE.7
		FP15IE		EQU		P1IE.5
		FP14IE		EQU		P1IE.4
		FP13IE		EQU		P1IE.3
		FP12IE		EQU		P1IE.2
		FP11IE		EQU		P1IE.1
		FP10IE		EQU		P1IE.0

	PEDGE		EQU		9FH
		FP16G0		EQU		PEDGE.0
		FP16G1		EQU		PEDGE.1
		FP50G0 		EQU		PEDGE.2
		FP50G1	 	EQU		PEDGE.3
		FP20VSS_EN	EQU		PEDGE.5
		FUPDET_EN  	EQU		PEDGE.6
		FUPDETS 	EQU_R		PEDGE.7
	
	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
		FP17M		EQU		P1M.7

	P2M		EQU		0A2H
		FP21M		EQU		P2M.1
		FP22M		EQU		P2M.2
		FP23M		EQU		P2M.3
		FP24M		EQU		P2M.4
		FP25M		EQU		P2M.5
		FP26M		EQU		P2M.6
		FP27M		EQU		P2M.7

	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

	P5M		EQU		0A4H
  		FP50M		EQU		P5M.0
  		FP51M		EQU		P5M.1
  		FP52M		EQU		P5M.2
  		FP53M		EQU		P5M.3
  		FP54M		EQU		P5M.4
  		FP55M		EQU		P5M.5
  		FP56M		EQU		P5M.6

	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
		FP17		EQU 		P1.7

	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
		FP27		EQU 		P2.7

	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

	P5		EQU		0A9H
		FP50		EQU		P5.0
		FP51		EQU		P5.1
		FP52		EQU		P5.2
		FP53		EQU		P5.3
		FP54		EQU		P5.4
		FP55		EQU		P5.5
		FP56		EQU		P5.6

	P0UR        		EQU     	0AAH
	P1UR        		EQU     	0ABH
	P2UR        		EQU     	0ACH
	P4UR       		EQU    		0ADH
	P5UR       		EQU     	0AEH

	PECMD			EQU_W		0AFH

	SIOM		EQU		0B0H
		FSENB		EQU		SIOM.7
		FSTART		EQU		SIOM.6
		FSRATE1		EQU		SIOM.5
		FSRATE0		EQU		SIOM.4
		FMLSB		EQU		SIOM.3
		FSCKMD		EQU		SIOM.2
		FCPOL		EQU		SIOM.1
		FCPHA		EQU		SIOM.0

	SIOR		EQU_W		0B1H
	
	SIOB		EQU		0B2H
		FSIOB7		EQU		SIOB.7
		FSIOB6		EQU		SIOB.6
		FSIOB5		EQU		SIOB.5
		FSIOB4		EQU		SIOB.4
		FSIOB3		EQU		SIOB.3
		FSIOB2		EQU		SIOB.2
		FSIOB1		EQU		SIOB.1
		FSIOB0		EQU		SIOB.0
		

	T0M		EQU		0B3H
		FT0ENB     	EQU		T0M.7
		FT0RATE2   	EQU		T0M.6
		FT0RATE1   	EQU		T0M.5
		FT0RATE0   	EQU		T0M.4

	T0C		EQU		0B4H
		FT0C7		EQU		T0C.7
		FT0C6		EQU		T0C.6
		FT0C5		EQU		T0C.5	
		FT0C4		EQU		T0C.4
		FT0C3		EQU 		T0C.3
		FT0C2		EQU 		T0C.2
		FT0C1		EQU 		T0C.1
		FT0C0		EQU 		T0C.0
		
	T1M		EQU		0B5H
		FT1ENB		EQU		T1M.7
		FT1RATE2	EQU		T1M.6
		FT1RATE1	EQU		T1M.5
		FT1RATE0	EQU		T1M.4		
		FT1CKS		EQU		T1M.3
		FT1ARC 		EQU		T1M.2
		FT1G1		EQU		T1M.1
		FT1G0  		EQU		T1M.0	

	T1C_L		EQU		0B6H
		FT1C7		EQU		T1C_L.7
		FT1C6		EQU		T1C_L.6
		FT1C5		EQU		T1C_L.5
		FT1C4		EQU		T1C_L.4
		FT1C3		EQU		T1C_L.3
		FT1C2		EQU		T1C_L.2
		FT1C1		EQU		T1C_L.1
		FT1C0		EQU		T1C_L.0

	T1C_H		EQU		0B7H
		FT1C15		EQU		T1C_H.7
		FT1C14		EQU		T1C_H.6
		FT1C13		EQU		T1C_H.5
		FT1C12		EQU		T1C_H.4
		FT1C11		EQU		T1C_H.3
		FT1C10		EQU		T1C_H.2
		FT1C9		EQU		T1C_H.1
		FT1C8		EQU		T1C_H.0

	TC0M		EQU		0B8H
		FTC0ENB		EQU		TC0M.7
		FTC0RATE2	EQU		TC0M.6
		FTC0RATE1	EQU		TC0M.5
		FTC0RATE0	EQU		TC0M.4
		FTC0CKS1	EQU		TC0M.3
    		FTC0CKS0	EQU 		TC0M.2
    		FTC0PO   	EQU 		TC0M.1
    		FPWM0OUT  	EQU 		TC0M.0 
    
	TC0C		EQU		0B9H	
	TC0R		EQU_W		0BAH
	TC0D		EQU		0BBH

	TC1M		EQU		0BCH
		FTC1ENB		EQU		TC1M.7
		FTC1RATE2	EQU		TC1M.6
		FTC1RATE1	EQU		TC1M.5
		FTC1RATE0	EQU		TC1M.4
    		FTC1CKS0   	EQU 		TC1M.2
    		FTC1PO   	EQU 		TC1M.1
    		FPWM1OUT  	EQU 		TC1M.0 
    
	TC1C		EQU		0BDH	
	TC1R		EQU_W		0BEH
	TC1D		EQU		0BFH

	TC2M		EQU		0C0H
		FTC2ENB		EQU		TC2M.7
		FTC2RATE2	EQU		TC2M.6
		FTC2RATE1	EQU		TC2M.5
		FTC2RATE0	EQU		TC2M.4
    		FTC2CKS0   	EQU 		TC2M.2
    		FTC2PO    	EQU 		TC2M.1
    		FPWM2OUT  	EQU 		TC2M.0 

	TC2C		EQU		0C1H
	TC2R		EQU_W		0C2H
	TC2D		EQU		0C3H

	PWCH		EQU		0C4H
		FPWCH20  	EQU		PWCH.5
		FPWCH21		EQU		PWCH.4
		FPWCH11 	EQU		PWCH.3
		FPWCH10		EQU		PWCH.2
		FPWCH01		EQU		PWCH.1
		FPWCH00		EQU		PWCH.0

	PWES		EQU		0C5H
		FPW2ES1  	EQU		PWES.3
		FPW2ES0		EQU		PWES.2
		FPW1ES1		EQU		PWES.1
		FPW1ES0		EQU		PWES.0


	P2CON		EQU		0C6H
		FP2CON7		EQU		P2CON.7
		FP2CON6		EQU		P2CON.6
		FP2CON5		EQU		P2CON.5
		FP2CON4		EQU		P2CON.4
		FP2CON3		EQU		P2CON.3
		FP2CON2		EQU		P2CON.2
		FP2CON1		EQU		P2CON.1
		FP2CON0		EQU		P2CON.0

	P4CON		EQU		0C7H
		FP4CON7		EQU		P4CON.7
		FP4CON6		EQU		P4CON.6
		FP4CON5		EQU		P4CON.5
		FP4CON4		EQU		P4CON.4
		FP4CON3		EQU		P4CON.3
		FP4CON2		EQU		P4CON.2
		FP4CON1		EQU		P4CON.1
		FP4CON0		EQU		P4CON.0


	ADM		EQU		0C8H
		FADENB		EQU		ADM.7
		FADS		EQU		ADM.6
		FEOC		EQU		ADM.5
		FGCHS		EQU		ADM.4
		FCHS3		EQU		ADM.3
		FCHS2		EQU		ADM.2
		FCHS1		EQU		ADM.1
		FCHS0		EQU		ADM.0

	ADB		EQU_R		0C9H
		FADB11		EQU_R		ADB.7
		FADB10		EQU_R		ADB.6
		FADB9		EQU_R		ADB.5
		FADB8		EQU_R		ADB.4
		FADB7		EQU_R		ADB.3
		FADB6		EQU_R		ADB.2
		FADB5		EQU_R		ADB.1
		FADB4		EQU_R		ADB.0

	ADR		EQU		0CAH
		FAIN0IG_EN 	EQU		ADR.7
		FADCKS1		EQU		ADR.6
		FADLEN		EQU		ADR.5
		FADCKS0		EQU		ADR.4
		FADB3		EQU_R		ADR.3
		FADB2		EQU_R		ADR.2
		FADB1		EQU_R		ADR.1
		FADB0		EQU_R		ADR.0


	ADT		EQU		0CBH
		FADTS1   	EQU		ADT.7
		FADTS0  	EQU		ADT.6
		FEVHENB  	EQU		ADT.5
		FADT4		EQU		ADT.4
		FADT3		EQU		ADT.3
		FADT2		EQU		ADT.2
		FADT1		EQU		ADT.1
		FADT0		EQU		ADT.0

	UDA		EQU		0CCH
		FUDE		EQU		UDA.7
		FUDA6		EQU		UDA.6
		FUDA5		EQU		UDA.5
		FUDA4		EQU		UDA.4
		FUDA3		EQU		UDA.3
		FUDA2		EQU		UDA.2
		FUDA1		EQU		UDA.1
		FUDA0		EQU		UDA.0

	USTATUS		EQU		0CDH
		FERR_TIMEOUT	EQU		USTATUS.7
		FERR_SETUP	EQU		USTATUS.6
		FEP0_PRESETUP	EQU		USTATUS.5				
		FEP0_OUT_STALL	EQU		USTATUS.4
		FEP0_IN_STALL	EQU		USTATUS.3
		FEP0SETUP	EQU		USTATUS.2
		FEP0IN		EQU		USTATUS.1
		FEP0OUT		EQU		USTATUS.0
	

	USTATUS1		EQU	0CEH
		FNDT2		EQU		USTATUS1.7	
		FNDT1		EQU		USTATUS1.6
		FSOF		EQU		USTATUS1.4
		FBUS_RESUME	EQU		USTATUS1.3
		FBUS_WAKEUP	EQU		USTATUS1.2				
		FBUS_RST	EQU		USTATUS1.1
		FSUSPEND	EQU		USTATUS1.0


	USB_INT_EN	EQU		0CFH
		FSOF_IE  	EQU		USB_INT_EN.5
		FEPN_ACK_IE 	EQU		USB_INT_EN.4
		FEPN_NAK_IE	EQU		USB_INT_EN.3
		FBUS_IE		EQU		USB_INT_EN.2
		FBUSWK_IE	EQU		USB_INT_EN.1
		FUSB_IE		EQU		USB_INT_EN.0

	EP_ACK		EQU		0D0H
		FEP6_ACK	EQU		EP_ACK.5
		FEP5_ACK	EQU		EP_ACK.4
		FEP4_ACK	EQU		EP_ACK.3
		FEP3_ACK	EQU		EP_ACK.2
		FEP2_ACK	EQU		EP_ACK.1
		FEP1_ACK	EQU		EP_ACK.0
	
	EP_NAK		EQU		0D1H
		FEP6_NAK	EQU		EP_NAK.5
		FEP5_NAK	EQU		EP_NAK.4
		FEP4_NAK	EQU		EP_NAK.3
		FEP3_NAK	EQU		EP_NAK.2
		FEP2_NAK	EQU		EP_NAK.1
		FEP1_NAK	EQU		EP_NAK.0

	UCFG		EQU		0D2H
		FULVD36_EN  	EQU		UCFG.7
		FVREG33_EN  	EQU		UCFG.6
		FPHY_EN  	EQU		UCFG.5
		FDPPU_EN  	EQU		UCFG.4
		FESD_EN  	EQU		UCFG.3
		FUSGIG_EN	EQU		UCFG.2
		FVREG33DIS_EN	EQU		UCFG.1
		FUSBRAM_EN	EQU		UCFG.0

	UEPDIR		EQU		0D3H
		FUE6D		EQU		UEPDIR.5
		FUE5D		EQU		UEPDIR.4
		FUE4D		EQU		UEPDIR.3
		FUE3D		EQU		UEPDIR.2
		FUE2D		EQU		UEPDIR.1
		FUE1D		EQU		UEPDIR.0

	UEPISO		EQU		0D4H
		FUE6ISO		EQU		UEPISO.5
		FUE5ISO		EQU		UEPISO.4
		FUE4ISO		EQU		UEPISO.3
		FUE3ISO		EQU		UEPISO.2
		FUE2ISO		EQU		UEPISO.1
		FUE1ISO		EQU		UEPISO.0

	UE0R		EQU		0D5H
		FUE0E		EQU		UE0R.7
		FUE0M1		EQU		UE0R.6
		FUE0M0		EQU		UE0R.5
		FOUT_STALL_EN	EQU		UE0R.4
		FIN_STALL_EN	EQU		UE0R.3

	UE0R_C		EQU		0D6H
		FUE0C6		EQU		UE0R_C.6
		FUE0C5		EQU		UE0R_C.5
		FUE0C4		EQU		UE0R_C.4
		FUE0C3		EQU		UE0R_C.3
		FUE0C2		EQU		UE0R_C.2
		FUE0C1		EQU		UE0R_C.1
		FUE0C0		EQU		UE0R_C.0

	UE1R		EQU		0D7H
		FUE1E		EQU		UE1R.7
		FUE1M1		EQU		UE1R.6
		FUE1M0		EQU		UE1R.5

	UE1R_C		EQU		0D8H
		FUE1C7		EQU		UE1R_C.7
		FUE1C6		EQU		UE1R_C.6
		FUE1C5		EQU		UE1R_C.5
		FUE1C4		EQU		UE1R_C.4
		FUE1C3		EQU		UE1R_C.3
		FUE1C2		EQU		UE1R_C.2
		FUE1C1		EQU		UE1R_C.1
		FUE1C0		EQU		UE1R_C.0

	UE2R		EQU		0D9H
		FUE2E		EQU		UE2R.7
		FUE2M1		EQU		UE2R.6
		FUE2M0		EQU		UE2R.5

	UE2R_C		EQU		0DAH
		FUE2C7		EQU		UE2R_C.7
		FUE2C6		EQU		UE2R_C.6
		FUE2C5		EQU		UE2R_C.5
		FUE2C4		EQU		UE2R_C.4
		FUE2C3		EQU		UE2R_C.3
		FUE2C2		EQU		UE2R_C.2
		FUE2C1		EQU		UE2R_C.1
		FUE2C0		EQU		UE2R_C.0
	
	UE3R		EQU		0DBH
		FUE3E		EQU		UE3R.7
		FUE3M1		EQU		UE3R.6
		FUE3M0		EQU		UE3R.5

	UE3R_C		EQU		0DCH
		FUE3C7		EQU		UE3R_C.7
		FUE3C6		EQU		UE3R_C.6
		FUE3C5		EQU		UE3R_C.5
		FUE3C4		EQU		UE3R_C.4
		FUE3C3		EQU		UE3R_C.3
		FUE3C2		EQU		UE3R_C.2
		FUE3C1		EQU		UE3R_C.1
		FUE3C0		EQU		UE3R_C.0
	
	UE4R		EQU		0DDH
		FUE4E		EQU		UE4R.7
		FUE4M1		EQU		UE4R.6
		FUE4M0		EQU		UE4R.5

	UE4R_C		EQU		0DEH
		FUE4C7		EQU		UE4R_C.7
		FUE4C6		EQU		UE4R_C.6
		FUE4C5		EQU		UE4R_C.5
		FUE4C4		EQU		UE4R_C.4
		FUE4C3		EQU		UE4R_C.3
		FUE4C2		EQU		UE4R_C.2
		FUE4C1		EQU		UE4R_C.1
		FUE4C0		EQU		UE4R_C.0


	UE5R		EQU		0DFH
		FUE5E		EQU		UE5R.7
		FUE5M1		EQU		UE5R.6
		FUE5M0		EQU		UE5R.5

	UE5R_C		EQU		0E0H
		FUE5C7		EQU		UE5R_C.7
		FUE5C6		EQU		UE5R_C.6
		FUE5C5		EQU		UE5R_C.5
		FUE5C4		EQU		UE5R_C.4
		FUE5C3		EQU		UE5R_C.3
		FUE5C2		EQU		UE5R_C.2
		FUE5C1		EQU		UE5R_C.1
		FUE5C0		EQU		UE5R_C.0

	UE6R		EQU		0E1H
		FUE6E		EQU		UE6R.7
		FUE6M1		EQU		UE6R.6
		FUE6M0		EQU		UE6R.5

	UE6R_C		EQU		0E2H
		FUE6C7		EQU		UE6R_C.7
		FUE6C6		EQU		UE6R_C.6
		FUE6C5		EQU		UE6R_C.5
		FUE6C4		EQU		UE6R_C.4
		FUE6C3		EQU		UE6R_C.3
		FUE6C2		EQU		UE6R_C.2
		FUE6C1		EQU		UE6R_C.1
		FUE6C0		EQU		UE6R_C.0

	UPID		EQU		0E3H
	 	FUBDE		EQU		UPID.2
		FDDP		EQU		UPID.1
		FDDN		EQU		UPID.0	

	UFRMNO_L	EQU_R		0E4H
	UFRMNO_H	EQU_R		0E5H

	PHYPRM		EQU		0E6H
		PHYPRM_EN	EQU		PHYPRM.7

	UTOGGLE		EQU		0E8H
		FEP6_DATA01	EQU		UTOGGLE.5
		FEP5_DATA01	EQU		UTOGGLE.4
		FEP4_DATA01	EQU		UTOGGLE.3
		FEP3_DATA01	EQU		UTOGGLE.2
		FEP2_DATA01	EQU		UTOGGLE.1
		FEP1_DATA01	EQU		UTOGGLE.0

	EP2FIFO_ADDR	EQU		0E9H
		FEP2FIFO7	EQU		EP2FIFO_ADDR.7
		FEP2FIFO6	EQU		EP2FIFO_ADDR.6
		FEP2FIFO5	EQU		EP2FIFO_ADDR.5
		FEP2FIFO4	EQU		EP2FIFO_ADDR.4
		FEP2FIFO3	EQU		EP2FIFO_ADDR.3
		FEP2FIFO2	EQU		EP2FIFO_ADDR.2
		FEP2FIFO1	EQU		EP2FIFO_ADDR.1
		FEP2FIFO0	EQU		EP2FIFO_ADDR.0

	EP3FIFO_ADDR	EQU		0EAH
		FEP3FIFO7	EQU		EP3FIFO_ADDR.7
		FEP3FIFO6	EQU		EP3FIFO_ADDR.6
		FEP3FIFO5	EQU		EP3FIFO_ADDR.5
		FEP3FIFO4	EQU		EP3FIFO_ADDR.4
		FEP3FIFO3	EQU		EP3FIFO_ADDR.3
		FEP3FIFO2	EQU		EP3FIFO_ADDR.2
		FEP3FIFO1	EQU		EP3FIFO_ADDR.1
		FEP3FIFO0	EQU		EP3FIFO_ADDR.0

	EP4FIFO_ADDR	EQU		0EBH
		FEP4FIFO7	EQU		EP4FIFO_ADDR.7
		FEP4FIFO6	EQU		EP4FIFO_ADDR.6
		FEP4FIFO5	EQU		EP4FIFO_ADDR.5
		FEP4FIFO4	EQU		EP4FIFO_ADDR.4
		FEP4FIFO3	EQU		EP4FIFO_ADDR.3
		FEP4FIFO2	EQU		EP4FIFO_ADDR.2
		FEP4FIFO1	EQU		EP4FIFO_ADDR.1
		FEP4FIFO0	EQU		EP4FIFO_ADDR.0

	EP5FIFO_ADDR	EQU		0ECH
		FEP5FIFO7	EQU		EP5FIFO_ADDR.7
		FEP5FIFO6	EQU		EP5FIFO_ADDR.6
		FEP5FIFO5	EQU		EP5FIFO_ADDR.5
		FEP5FIFO4	EQU		EP5FIFO_ADDR.4
		FEP5FIFO3	EQU		EP5FIFO_ADDR.3
		FEP5FIFO2	EQU		EP5FIFO_ADDR.2
		FEP5FIFO1	EQU		EP5FIFO_ADDR.1
		FEP5FIFO0	EQU		EP5FIFO_ADDR.0

	EP6FIFO_ADDR	EQU		0EDH
		FEP6FIFO7	EQU		EP6FIFO_ADDR.7
		FEP6FIFO6	EQU		EP6FIFO_ADDR.6
		FEP6FIFO5	EQU		EP6FIFO_ADDR.5
		FEP6FIFO4	EQU		EP6FIFO_ADDR.4
		FEP6FIFO3	EQU		EP6FIFO_ADDR.3
		FEP6FIFO2	EQU		EP6FIFO_ADDR.2
		FEP6FIFO1	EQU		EP6FIFO_ADDR.1
		FEP6FIFO0	EQU		EP6FIFO_ADDR.0

	PS2M		EQU		0EEH
		FPS2ENB		EQU		PS2M.7
		FSDA		EQU		PS2M.3
		FSCK 		EQU		PS2M.2
		FSDAM		EQU		PS2M.1
		FSCKM		EQU		PS2M.0

	STKP		EQU		0EFH
		FGIE		EQU		STKP.7
		FLVD24		EQU_R		STKP.6
		FLVD33		EQU_R		STKP.5
		FULVD36		EQU_R		STKP.4
		FSTKPB2		EQU		STKP.2
		FSTKPB1		EQU		STKP.1
		FSTKPB0		EQU		STKP.0


	STK7L		EQU		0F0h
	STK7H		EQU		0F1h
	STK6L		EQU		0F2h
	STK6H		EQU		0F3h
	STK5L		EQU		0F4h
	STK5H		EQU		0F5h
	STK4L		EQU		0F6h
	STK4H		EQU		0F7h
	STK3L		EQU		0F8h
	STK3H		EQU		0F9h
	STK2L		EQU		0FAh
	STK2H		EQU		0FBh
	STK1L		EQU		0FCh
	STK1H		EQU		0FDh
	STK0L		EQU		0FEh
	STK0H		EQU		0FFh
	

; -----------------------------------------------------
; 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
}