#ifndef __SN8P2947__H
#define __SN8P2947__H
struct specialRegister{
	unsigned bit0:1;
	unsigned bit1:1;
	unsigned bit2:1;
	unsigned bit3:1;
	unsigned bit4:1;
	unsigned bit5:1;
	unsigned bit6:1;
	unsigned bit7:1;
};


void _ClearWatchDogTimer(void);
void _ClrRAM(void);

#define NOP(X)  	__asm{	_NOP X }
#define LOG(X)  	__asm{	LOG CNameToAsmLabel(X) }
#define	R	(*((__RAM unsigned int*)0x82))
#define	Z	(*((__RAM unsigned int*)0x83))
#define	Y	(*((__RAM unsigned int*)0x84))
#define	PFLAG	(*((__RAM unsigned int*)0x86))
#define	FC	((*((__RAM struct specialRegister *)0x86)).bit2)
#define	FDC	((*((__RAM struct specialRegister *)0x86)).bit1)
#define	FZ	((*((__RAM struct specialRegister *)0x86)).bit0)
#define	RBANK	(*((__RAM unsigned int*)0x87))
#define	FRBNKS0	((*((__RAM struct specialRegister *)0x87)).bit0)
#define	LCDM1	(*((__RAM unsigned int*)0x89))
#define	FLCDREF	((*((__RAM struct specialRegister *)0x89)).bit7)
#define	FLCDPENB	((*((__RAM struct specialRegister *)0x89)).bit6)
#define	FLCDBNK	((*((__RAM struct specialRegister *)0x89)).bit5)
#define	FLCDTYPE	((*((__RAM struct specialRegister *)0x89)).bit4)
#define	FLCDENB	((*((__RAM struct specialRegister *)0x89)).bit3)
#define	FLCDBIAS	((*((__RAM struct specialRegister *)0x89)).bit2)
#define	FLCDRATE	((*((__RAM struct specialRegister *)0x89)).bit1)
#define	FLCDCLK	((*((__RAM struct specialRegister *)0x89)).bit0)
#define	LCDM2	(*((__RAM unsigned int*)0x8A))
#define	FVPPINTL	((*((__RAM struct specialRegister *)0x8A)).bit4)
#define	FVCP3	((*((__RAM struct specialRegister *)0x8A)).bit3)
#define	FVCP2	((*((__RAM struct specialRegister *)0x8A)).bit2)
#define	FVCP1	((*((__RAM struct specialRegister *)0x8A)).bit1)
#define	FVCP0	((*((__RAM struct specialRegister *)0x8A)).bit0)
#define	VREG	(*((__RAM unsigned int*)0x90))
#define	FBGRENB	((*((__RAM struct specialRegister *)0x90)).bit7)
#define	FACMSEL	((*((__RAM struct specialRegister *)0x90)).bit6)
#define	FACMENB	((*((__RAM struct specialRegister *)0x90)).bit5)
#define	FAVESEL	((*((__RAM struct specialRegister *)0x90)).bit4)
#define	FAVENB	((*((__RAM struct specialRegister *)0x90)).bit3)
#define	FAVDDRENB	((*((__RAM struct specialRegister *)0x90)).bit2)
#define	AMPM1	(*((__RAM unsigned int*)0x91))
#define	FCHS2	((*((__RAM struct specialRegister *)0x91)).bit7)
#define	FCHS1	((*((__RAM struct specialRegister *)0x91)).bit6)
#define	FCHS0	((*((__RAM struct specialRegister *)0x91)).bit5)
#define	FGS2	((*((__RAM struct specialRegister *)0x91)).bit3)
#define	FGS1	((*((__RAM struct specialRegister *)0x91)).bit2)
#define	FGS0	((*((__RAM struct specialRegister *)0x91)).bit1)
#define	FAMPENB	((*((__RAM struct specialRegister *)0x91)).bit0)
#define	AMPM2	(*((__RAM unsigned int*)0x92))
#define	FUGBH	((*((__RAM struct specialRegister *)0x92)).bit7)
#define	FGX	((*((__RAM struct specialRegister *)0x92)).bit6)
#define	FGR	((*((__RAM struct specialRegister *)0x92)).bit5)
#define	FAMPCKS	((*((__RAM struct specialRegister *)0x92)).bit4)
#define	FDTENB	((*((__RAM struct specialRegister *)0x92)).bit1)
#define	FDTSEL	((*((__RAM struct specialRegister *)0x92)).bit0)
#define	ADCM1	(*((__RAM unsigned int*)0x93))
#define	FRVS	((*((__RAM struct specialRegister *)0x93)).bit7)
#define	FIRVS2	((*((__RAM struct specialRegister *)0x93)).bit6)
#define	FIRVS1	((*((__RAM struct specialRegister *)0x93)).bit5)
#define	FIRVS0	((*((__RAM struct specialRegister *)0x93)).bit4)
#define	FADGN2	((*((__RAM struct specialRegister *)0x93)).bit3)
#define	FADGN1	((*((__RAM struct specialRegister *)0x93)).bit2)
#define	FADGN0	((*((__RAM struct specialRegister *)0x93)).bit1)
#define	FADCENB	((*((__RAM struct specialRegister *)0x93)).bit0)
#define	ADCM2	(*((__RAM unsigned int*)0X94))
#define	FADCKS	((*((__RAM struct specialRegister *)0X94)).bit7)
#define	FOSR2	((*((__RAM struct specialRegister *)0X94)).bit6)
#define	FOSR1	((*((__RAM struct specialRegister *)0X94)).bit5)
#define	FOSR0	((*((__RAM struct specialRegister *)0X94)).bit4)
#define	FADCKSDIV	((*((__RAM struct specialRegister *)0X94)).bit3)
#define	FOFSEL1	((*((__RAM struct specialRegister *)0X94)).bit2)
#define	FOFSEL0	((*((__RAM struct specialRegister *)0X94)).bit1)
#define	FDRDY	((*((__RAM struct specialRegister *)0X94)).bit0)
#define	LBTM	(*((__RAM unsigned int*)0x95))
#define	FP11IO	((*((__RAM struct specialRegister *)0x95)).bit5)
#define	FLBTSEL2	((*((__RAM struct specialRegister *)0x95)).bit4)
#define	FLBTSEL1	((*((__RAM struct specialRegister *)0x95)).bit3)
#define	FLBTSEL0	((*((__RAM struct specialRegister *)0x95)).bit2)
#define	FLBTO	((*((__RAM struct specialRegister *)0x95)).bit1)
#define	FLBTENB	((*((__RAM struct specialRegister *)0x95)).bit0)
#define	ADCDH	(*((__RAM unsigned int*)0x96))
#define	ADCDM	(*((__RAM unsigned int*)0x97))
#define	ADCDL	(*((__RAM unsigned int*)0x98))
#define	ROMADRH	(*((__RAM unsigned int*)0XA0))
#define	FVPPCHK	((*((__RAM struct specialRegister *)0XA0)).bit7)
#define	FROMADR10	((*((__RAM struct specialRegister *)0XA0)).bit2)
#define	FROMADR9	((*((__RAM struct specialRegister *)0XA0)).bit1)
#define	FROMADR8	((*((__RAM struct specialRegister *)0XA0)).bit0)
#define	ROMADRL	(*((__RAM unsigned int*)0XA1))
#define	FROMADR7	((*((__RAM struct specialRegister *)0XA1)).bit7)
#define	FROMADR6	((*((__RAM struct specialRegister *)0XA1)).bit6)
#define	FROMADR5	((*((__RAM struct specialRegister *)0XA1)).bit5)
#define	FROMADR4	((*((__RAM struct specialRegister *)0XA1)).bit4)
#define	FROMADR3	((*((__RAM struct specialRegister *)0XA1)).bit3)
#define	FROMADR2	((*((__RAM struct specialRegister *)0XA1)).bit2)
#define	FROMADR1	((*((__RAM struct specialRegister *)0XA1)).bit1)
#define	FROMADR0	((*((__RAM struct specialRegister *)0XA1)).bit0)
#define	ROMDAH	(*((__RAM unsigned int*)0XA2))
#define	FROMDA15	((*((__RAM struct specialRegister *)0XA2)).bit7)
#define	FROMDA14	((*((__RAM struct specialRegister *)0XA2)).bit6)
#define	FROMDA13	((*((__RAM struct specialRegister *)0XA2)).bit5)
#define	FROMDA12	((*((__RAM struct specialRegister *)0XA2)).bit4)
#define	FROMDA11	((*((__RAM struct specialRegister *)0XA2)).bit3)
#define	FROMDA10	((*((__RAM struct specialRegister *)0XA2)).bit2)
#define	FROMDA9	((*((__RAM struct specialRegister *)0XA2)).bit1)
#define	FROMDA8	((*((__RAM struct specialRegister *)0XA2)).bit0)
#define	ROMDAL	(*((__RAM unsigned int*)0XA3))
#define	FROMDA7	((*((__RAM struct specialRegister *)0XA3)).bit7)
#define	FROMDA6	((*((__RAM struct specialRegister *)0XA3)).bit6)
#define	FROMDA5	((*((__RAM struct specialRegister *)0XA3)).bit5)
#define	FROMDA4	((*((__RAM struct specialRegister *)0XA3)).bit4)
#define	FROMDA3	((*((__RAM struct specialRegister *)0XA3)).bit3)
#define	FROMDA2	((*((__RAM struct specialRegister *)0XA3)).bit2)
#define	FROMDA1	((*((__RAM struct specialRegister *)0XA3)).bit1)
#define	FROMDA0	((*((__RAM struct specialRegister *)0XA3)).bit0)
#define	ROMCNT	(*((__RAM unsigned int*)0XA4))
#define	ROMCNT1	((*((__RAM struct specialRegister *)0XA4)).bit1)
#define	ROMCNT0	((*((__RAM struct specialRegister *)0XA4)).bit0)
#define	P0M	(*((__RAM unsigned int*)0xB8))
#define	FP07M	((*((__RAM struct specialRegister *)0xB8)).bit7)
#define	FP06M	((*((__RAM struct specialRegister *)0xB8)).bit6)
#define	FP05M	((*((__RAM struct specialRegister *)0xB8)).bit5)
#define	FP04M	((*((__RAM struct specialRegister *)0xB8)).bit4)
#define	FP03M	((*((__RAM struct specialRegister *)0xB8)).bit3)
#define	FP02M	((*((__RAM struct specialRegister *)0xB8)).bit2)
#define	FP01M	((*((__RAM struct specialRegister *)0xB8)).bit1)
#define	FP00M	((*((__RAM struct specialRegister *)0xB8)).bit0)
#define	PEDGE	(*((__RAM unsigned int*)0xBF))
#define	FP00G1	((*((__RAM struct specialRegister *)0xBF)).bit4)
#define	FP00G0	((*((__RAM struct specialRegister *)0xBF)).bit3)
#define	P1M	(*((__RAM unsigned int*)0xC1))
#define	FP11M	((*((__RAM struct specialRegister *)0xC1)).bit1)
#define	FP10M	((*((__RAM struct specialRegister *)0xC1)).bit0)
#define	INTRQ	(*((__RAM unsigned int*)0xc8))
#define	FADCIRQ	((*((__RAM struct specialRegister *)0xc8)).bit7)
#define	FT0IRQ	((*((__RAM struct specialRegister *)0xc8)).bit4)
#define	FP00IRQ	((*((__RAM struct specialRegister *)0xc8)).bit0)
#define	INTEN	(*((__RAM unsigned int*)0xc9))
#define	FADCIEN	((*((__RAM struct specialRegister *)0xc9)).bit7)
#define	FT0IEN	((*((__RAM struct specialRegister *)0xc9)).bit4)
#define	FP00IEN	((*((__RAM struct specialRegister *)0xc9)).bit0)
#define	OSCM	(*((__RAM unsigned int*)0xCA))
#define	FCPUM1	((*((__RAM struct specialRegister *)0xCA)).bit4)
#define	FCPUM0	((*((__RAM struct specialRegister *)0xCA)).bit3)
#define	FCLKMD	((*((__RAM struct specialRegister *)0xCA)).bit2)
#define	FSTPHX	((*((__RAM struct specialRegister *)0xCA)).bit1)
#define	WDTR	(*((__RAM unsigned int*)0xCC))
#define	PCL	(*((__RAM unsigned int*)0xCE))
#define	PCH	(*((__RAM unsigned int*)0xCF))
#define	P0	(*((__RAM unsigned int*)0xd0))
#define	FP07	((*((__RAM struct specialRegister *)0xd0)).bit7)
#define	FP06	((*((__RAM struct specialRegister *)0xd0)).bit6)
#define	FP05	((*((__RAM struct specialRegister *)0xd0)).bit5)
#define	FP04	((*((__RAM struct specialRegister *)0xd0)).bit4)
#define	FP03	((*((__RAM struct specialRegister *)0xd0)).bit3)
#define	FP02	((*((__RAM struct specialRegister *)0xd0)).bit2)
#define	FP01	((*((__RAM struct specialRegister *)0xd0)).bit1)
#define	FP00	((*((__RAM struct specialRegister *)0xd0)).bit0)
#define	P1	(*((__RAM unsigned int*)0xD1))
#define	FP11	((*((__RAM struct specialRegister *)0xD1)).bit1)
#define	FP10	((*((__RAM struct specialRegister *)0xD1)).bit0)
#define	T0M	(*((__RAM unsigned int*)0xD8))
#define	FT0ENB	((*((__RAM struct specialRegister *)0xD8)).bit7)
#define	FT0RATE2	((*((__RAM struct specialRegister *)0xD8)).bit6)
#define	FT0RATE1	((*((__RAM struct specialRegister *)0xD8)).bit5)
#define	FT0RATE0	((*((__RAM struct specialRegister *)0xD8)).bit4)
#define	T0C	(*((__RAM unsigned int*)0xD9))
#define	STKP	(*((__RAM unsigned int*)0xDF))
#define	FGIE	((*((__RAM struct specialRegister *)0xDF)).bit7)
#define	FSTKPB2	((*((__RAM struct specialRegister *)0xDF)).bit2)
#define	FSTKPB1	((*((__RAM struct specialRegister *)0xDF)).bit1)
#define	FSTKPB0	((*((__RAM struct specialRegister *)0xDF)).bit0)
#define	P1UR	(*((__RAM unsigned int*)0xE1))
#define	FP11R	((*((__RAM struct specialRegister *)0xE1)).bit1)
#define	FP10R	((*((__RAM struct specialRegister *)0xE1)).bit0)
#define	_YZ	(*((__RAM unsigned int*)0xE7))
#define	STK7L	(*((__RAM unsigned int*)0xf0))
#define	STK7H	(*((__RAM unsigned int*)0xf1))
#define	STK6L	(*((__RAM unsigned int*)0xf2))
#define	STK6H	(*((__RAM unsigned int*)0xf3))
#define	STK5L	(*((__RAM unsigned int*)0xf4))
#define	STK5H	(*((__RAM unsigned int*)0xf5))
#define	STK4L	(*((__RAM unsigned int*)0xf6))
#define	STK4H	(*((__RAM unsigned int*)0xf7))
#define	STK3L	(*((__RAM unsigned int*)0xf8))
#define	STK3H	(*((__RAM unsigned int*)0xf9))
#define	STK2L	(*((__RAM unsigned int*)0xfa))
#define	STK2H	(*((__RAM unsigned int*)0xfb))
#define	STK1L	(*((__RAM unsigned int*)0xfc))
#define	STK1H	(*((__RAM unsigned int*)0xfd))
#define	STK0L	(*((__RAM unsigned int*)0xfe))
#define	STK0H	(*((__RAM unsigned int*)0xff))
#define SLEEPMODE __asm{SleepMode}
#define GREENMODE __asm{GreenMode}
#define SLOWMODE __asm{SLowMode}
#define SLOW2NORMAL __asm{Slow2Normal}
#define ROMWRTVPP __asm{RomwrtVpp}
#endif
