#ifndef __SN8P2761__H
#define __SN8P2761__H

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

#define NOP(X)  	__asm{	_NOP X }
#define LOG(X)  	__asm{	LOG CNameToAsmLabel(X) }
sfr	R = 0x82;
sfr	Z = 0x83;
sfr	Y = 0x84;
sfr	PFLAG = 0x86;
sbit	FZ = 0x86:0;
sbit	FDC = 0x86:1;
sbit	FC = 0x86:2;
sbit	FLVD24 = 0x86:4;
sbit	FLVD36 = 0x86:5;
sbit	FNPD = 0x86:6;
sbit	FNT0 = 0x86:7;
sfr	CM0M = 0x9c;
sbit	FCM0G0 = 0x9c:0;
sbit	FCM0G1 = 0x9c:1;
sbit	FCM0OUT = 0x9c:2;
sbit	FCM0OEN = 0x9c:3;
sbit	FCM0S0 = 0x9c:4;
sbit	FCM0S1 = 0x9c:5;
sbit	FCM0T = 0x9c:6;
sbit	FCM0EN = 0x9c:7;
sfr	PW1M = 0xa0;
sbit	FPW1PO = 0xa0:0;
sbit	FPWNV10 = 0xa0:2;
sbit	FPWNV11 = 0xa0:3;
sbit	FPW1RATE0 = 0xa0:4;
sbit	FPW1RATE1 = 0xa0:5;
sbit	FPW1RATE2 = 0xa0:6;
sbit	FPW1EN = 0xa0:7;
sfr	PWCH = 0xa1;
sbit	FPWCH10 = 0xa1:0;
sbit	FPWCH11 = 0xa1:1;
sbit	FPWCH10A = 0xa1:2;
sbit	FPWCH11A = 0xa1:3;
sbit	FPWCH10B = 0xa1:4;
sbit	FPWCH11B = 0xa1:5;
sfr	PW1YL = 0xa2;
sbit	FPW1Y0 = 0xa2:0;
sbit	FPW1Y1 = 0xa2:1;
sbit	FPW1Y2 = 0xa2:2;
sbit	FPW1Y3 = 0xa2:3;
sbit	FPW1Y4 = 0xa2:4;
sbit	FPW1Y5 = 0xa2:5;
sbit	FPW1Y6 = 0xa2:6;
sbit	FPW1Y7 = 0xa2:7;
sfr	PW1YH = 0xa3;
sbit	FPW1Y8 = 0xa3:0;
sbit	FPW1Y9 = 0xa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
sbit	FADB0 = 0xb3:0;
sbit	FADB1 = 0xb3:1;
sbit	FADB2 = 0xb3:2;
sbit	FADB3 = 0xb3:3;
sbit	FADCKS0 = 0xb3:4;
sfr	ADT = 0xb4;
sbit	FADT0 = 0xb4:0;
sbit	FADT1 = 0xb4:1;
sbit	FADT2 = 0xb4:2;
sbit	FADT3 = 0xb4:3;
sbit	FADT4 = 0xb4:4;
sbit	FADTS0 = 0xb4:6;
sbit	FADTS1 = 0xb4:7;
sfr	P0M = 0xb8;
sbit	FP00M = 0xb8:0;
sbit	FP01M = 0xb8:1;
sbit	FP02M = 0xb8:2;
sbit	FP03M = 0xb8:3;
sbit	FP04M = 0xb8:4;
sbit	FP05M = 0xb8:5;
sbit	FP06M = 0xb8:6;
sfr	PEDGE = 0xbf;
sbit	FP00G0 = 0xbf:3;
sbit	FP00G1 = 0xbf:4;
sfr	P1W = 0xc0;
sfr	P1M = 0xc1;
sbit	FP10M = 0xc1:0;
sbit	FP11M = 0xc1:1;
sbit	FP12M = 0xc1:2;
sbit	FP13M = 0xc1:3;
sbit	FP14M = 0xc1:4;
sbit	FP15M = 0xc1:5;
sbit	FP16M = 0xc1:6;
sfr	INTRQ = 0xc8;
sbit	FP00IRQ = 0xc8:0;
sbit	FT0IRQ = 0xc8:4;
sbit	FPW1IRQ = 0xc8:5;
sbit	FCM0IRQ = 0xc8:6;
sbit	FADCIRQ = 0xc8:7;
sfr	INTEN = 0xc9;
sbit	FP00IEN = 0xc9:0;
sbit	FT0IEN = 0xc9:4;
sbit	FPW1IEN = 0xc9:5;
sbit	FCM0IEN = 0xc9:6;
sbit	FADCIEN = 0xc9:7;
sfr	OSCM = 0xca;
sbit	FCPUM1 = 0xca:4;
sbit	FCPUM0 = 0xca:3;
sbit	FCLKMD = 0xca:2;
sbit	FSTPHX = 0xca:1;
sfr	WDTR = 0xcc;
sfr	PCL = 0xce;
sfr	PCH = 0xcf;
sfr	P0 = 0xd0;
sbit	FP00 = 0xd0:0;
sbit	FP01 = 0xd0:1;
sbit	FP02 = 0xd0:2;
sbit	FP03 = 0xd0:3;
sbit	FP04 = 0xd0:4;
sbit	FP05 = 0xd0:5;
sbit	FP06 = 0xd0:6;
sfr	P1 = 0xd1;
sbit	FP10 = 0xd1:0;
sbit	FP11 = 0xd1:1;
sbit	FP12 = 0xd1:2;
sbit	FP13 = 0xd1:3;
sbit	FP14 = 0xd1:4;
sbit	FP15 = 0xd1:5;
sbit	FP16 = 0xd1:6;
sfr	P0DR = 0xd6;
sfr	T0M = 0xd8;
sbit	FT0RATE0 = 0xd8:4;
sbit	FT0RATE1 = 0xd8:5;
sbit	FT0RATE2 = 0xd8:6;
sbit	FT0ENB = 0xd8:7;
sfr	T0C = 0xd9;
sfr	STKP = 0xdf;
sbit	FSTKPB0 = 0xdf:0;
sbit	FSTKPB1 = 0xdf:1;
sbit	FGIE = 0xdf:7;
sfr	P0UR = 0xe0;
sfr	P1UR = 0xe1;
sfr	_YZ = 0xe7;
sfr	STK3L = 0xf8;
sfr	STK3H = 0xf9;
sfr	STK2L = 0xfa;
sfr	STK2H = 0xfb;
sfr	STK1L = 0xfc;
sfr	STK1H = 0xfd;
sfr	STK0L = 0xfe;
sfr	STK0H = 0xff;
#define SLEEPMODE __asm{SleepMode}
#define GREENMODE __asm{GreenMode}
#define SLOWMODE __asm{SLowMode}
#define SLOW2NORMAL __asm{Slow2Normal}
#endif
