ifndef __SN8F2283__INC__H
SN8F2283__INC__H equ 1
	H	EQU	0x80
	L	EQU	0x81
	R	EQU	0x82
	Z	EQU	0x83
	Y	EQU	0x84
	PFLAG	EQU	0x86
		FZ	EQU	PFLAG.0
		FDC	EQU	PFLAG.1
		FC	EQU	PFLAG.2
		FNPD	EQU	PFLAG.6
		FNT0	EQU	PFLAG.7
	RBANK	EQU	0x87
		FRBNKS0	EQU	RBANK.0
		FRBNKS1	EQU	RBANK.1
	@HL	EQU	0x90
	@YZ	EQU	0x91
	CTRL	EQU	0x92
		FP0CTRL	EQU	CTRL.0
		FP1CTRL	EQU	CTRL.1
		FP5CTRL	EQU	CTRL.2
		FRSEL0	EQU	CTRL.3
		FRSEL1	EQU	CTRL.4
		FLVDS0	EQU	CTRL.5
		FLVDS1	EQU	CTRL.6
	PCL	EQU	0x93
	PCH	EQU	0x94
	OSCM	EQU	0x95
		FSTPHX	EQU	OSCM.1
		FCLKMD	EQU	OSCM.2
		FCPUM0	EQU	OSCM.3
		FCPUM1	EQU	OSCM.4
	WDTR	EQU	0x96
	INTRQ	EQU	0x97
		FINT0IF	EQU	INTRQ.0
		FP50IF	EQU	INTRQ.1
		FP54IF	EQU	INTRQ.2
		FP0P1IF	EQU	INTRQ.3
		FT1IF	EQU	INTRQ.4
		FTC0IF	EQU	INTRQ.5
		FTM1IF	EQU	INTRQ.6
	INTEN	EQU	0x99
		FINT0IE	EQU	INTEN.0
		FP50IE	EQU	INTEN.1
		FP54IE	EQU	INTEN.2
		FP0P1IE	EQU	INTEN.3
		FT1IE	EQU	INTEN.4
		FTC0IE	EQU	INTEN.5
		FTM1IE	EQU	INTEN.6
	REM_REG	EQU	0x9a
		FDRVS0	EQU	REM_REG.0
		FDRVS1	EQU	REM_REG.1
		FDRVS2	EQU	REM_REG.2
		FELEEN	EQU	REM_REG.3
		FDRVS4	EQU	REM_REG.4
		FDRVS5	EQU	REM_REG.5
		FDRVS6	EQU	REM_REG.6
		FDRVS7	EQU	REM_REG.7
	P0W	EQU	0x9b
		FP00W	EQU	P0W.0
		FP01W	EQU	P0W.1
		FP02W	EQU	P0W.2
		FP03W	EQU	P0W.3
		FP04W	EQU	P0W.4
		FP05W	EQU	P0W.5
	P1W	EQU	0x9c
		FP10W	EQU	P1W.0
		FP11W	EQU	P1W.1
		FP12W	EQU	P1W.2
		FP13W	EQU	P1W.3
		FP14W	EQU	P1W.4
		FP15W	EQU	P1W.5
	PEDGE	EQU	0x9f
		FPG0	EQU	PEDGE.0
		FPG1	EQU	PEDGE.1
		FINTS	EQU	PEDGE.3
		FIRXO	EQU	PEDGE.5
		FIRXEN	EQU	PEDGE.6
	P0M0	EQU	0xa0
		FP00M0	EQU	P0M0.0
		FP01M0	EQU	P0M0.1
		FP02M0	EQU	P0M0.2
		FP03M0	EQU	P0M0.3
		FP04M0	EQU	P0M0.4
		FP05M0	EQU	P0M0.5
	P1M0	EQU	0xa1
		FP10M0	EQU	P1M0.0
		FP11M0	EQU	P1M0.1
		FP12M0	EQU	P1M0.2
		FP13M0	EQU	P1M0.3
		FP14M0	EQU	P1M0.4
		FP15M0	EQU	P1M0.5
	P5M0	EQU	0xa4
		FP50M0	EQU	P5M0.0
		FP54M0	EQU	P5M0.4
	P0	EQU	0xa5
		FP00	EQU	P0.0
		FP01	EQU	P0.1
		FP02	EQU	P0.2
		FP03	EQU	P0.3
		FP04	EQU	P0.4
		FP05	EQU	P0.5
	P1	EQU	0xa6
		FP10	EQU	P1.0
		FP11	EQU	P1.1
		FP12	EQU	P1.2
		FP13	EQU	P1.3
		FP14	EQU	P1.4
		FP15	EQU	P1.5
	P5	EQU	0xa9
		FP50	EQU	P5.0
		FP54	EQU	P5.4
	P0M1	EQU	0xaa
		FP00M1	EQU	P0M1.0
		FP01M1	EQU	P0M1.1
		FP02M1	EQU	P0M1.2
		FP03M1	EQU	P0M1.3
		FP04M1	EQU	P0M1.4
		FP05M1	EQU	P0M1.5
	P1M1	EQU	0xab
		FP10M1	EQU	P1M1.0
		FP11M1	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ca
	PWM1DL	EQU	0xd0
	PWM1DH	EQU	0xd1
	OPTION_REG	EQU	0xcc
		FP0SCANW	EQU	OPTION_REG.0
		FP1SCANW	EQU	OPTION_REG.1
		FP5SCANW	EQU	OPTION_REG.2
		FIESEL	EQU	OPTION_REG.3
		FWDTPER0	EQU	OPTION_REG.4
		FWDTPRE1	EQU	OPTION_REG.5
		FWDTPRE2	EQU	OPTION_REG.6
		FWDTEN	EQU	OPTION_REG.7
	MTPQ	EQU	0xd6
		FMTPPROFLAG	EQU	MTPQ.1
		FMTPEARFLAG	EQU	MTPQ.2
		FMTPCERSFLAG	EQU	MTPQ.3
	MTPEN	EQU	0xd8
		FMTPRD	EQU	MTPEN.0
		FMTPPRO	EQU	MTPEN.1
		FMTPERA	EQU	MTPEN.2
		FMTPCERS	EQU	MTPEN.3
		FMTPCPEN	EQU	MTPEN.5
	MTPAH	EQU	0xda
	MTPC	EQU	0xdb
		FPROSEL0	EQU	MTPC.0
		FPROSEL1	EQU	MTPC.1
		FPROSEL2	EQU	MTPC.2
		FPROSEL3	EQU	MTPC.3
		FPROSEL4	EQU	MTPC.4
		FPROCLKS0	EQU	MTPC.5
		FPROCLKS1	EQU	MTPC.6
	MTPAL	EQU	0xdc
	MTPD	EQU	0xde
	T1M1	EQU	0xe9
		FT1OVW	EQU	T1M1.0
		FT1OVS	EQU	T1M1.1
		FINT0W	EQU	T1M1.2
		FPWMW1	EQU	T1M1.3
		FPWMW2	EQU	T1M1.4
	REV0T0L	EQU	0xea
	REV0T0H	EQU	0xeb
	REV1T0L	EQU	0xec
	REV1T0H	EQU	0xed
	STKP	EQU	0xef
		FSTKPB0	EQU	STKP.0
		FSTKPB1	EQU	STKP.1
		FSTKPB2	EQU	STKP.2
		FLVD1D8	EQU	STKP.4
		FLVD2X	EQU	STKP.5
		FGIE	EQU	STKP.7
@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

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

endif
