#ifndef __SN8F27E611LEN__H
#define __SN8F27E611LEN__H

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

#define NOP(X)  	__asm{	_NOP X }
#define LOG(X)  	__asm{	LOG CNameToAsmLabel(X) }
sfr	L = 0x80;
sfr	H = 0x81;
sfr	R = 0x82;
sfr	Z = 0x83;
sfr	Y = 0x84;
sfr	X = 0x85;
sfr	PFLAG = 0x86;
sbit	FZ = 0x86:0;
sbit	FDC = 0x86:1;
sbit	FC = 0x86:2;
sbit	FSTKOV = 0x86:4;
sbit	FRST = 0x86:5;
sbit	FWDT = 0x86:6;
sbit	FPOR = 0x86:7;
sfr	W0 = 0x88;
sfr	W1 = 0x89;
sfr	W2 = 0x8a;
sfr	W3 = 0x8b;
sfr	W4 = 0x8c;
sfr	W5 = 0x8d;
sfr	W6 = 0x8e;
sfr	W7 = 0x8f;
sfr	_HL = 0x90;
sfr	_YZ = 0x91;
sfr	PCL = 0x93;
sfr	PCH = 0x94;
sfr	OSCM = 0x95;
sbit	FCPUM1 = 0x95:4;
sbit	FCPUM0 = 0x95:3;
sbit	FCLKMD = 0x95:2;
sbit	FSTPHX = 0x95:1;
sfr	WDTR = 0x96;
sfr	INTRQ0 = 0x97;
sbit	FADCIRQ = 0x97:7;
sbit	FTC2IRQ = 0x97:5;
sbit	FTC1IRQ = 0x97:4;
sbit	FTC0IRQ = 0x97:3;
sbit	FT0IRQ = 0x97:2;
sbit	FP00IRQ = 0x97:0;
sfr	INTRQ1 = 0x98;
sbit	FUTXIRQ = 0x98:3;
sbit	FURXIRQ = 0x98:2;
sbit	FSIOIRQ = 0x98:1;
sbit	FWAKEIRQ = 0x98:0;
sfr	INTEN0 = 0x9a;
sbit	FADCIEN = 0x9a:7;
sbit	FTC2IEN = 0x9a:5;
sbit	FTC1IEN = 0x9a:4;
sbit	FTC0IEN = 0x9a:3;
sbit	FT0IEN = 0x9a:2;
sbit	FP00IEN = 0x9a:0;
sfr	INTEN1 = 0x9b;
sbit	FUTXIEN = 0x9b:3;
sbit	FURXIEN = 0x9b:2;
sbit	FSIOIEN = 0x9b:1;
sbit	FWAKEIEN = 0x9b:0;
sfr	P1W = 0x9e;
sbit	FP17W = 0x9e:7;
sbit	FP16W = 0x9e:6;
sbit	FP15W = 0x9e:5;
sbit	FP14W = 0x9e:4;
sbit	FP13W = 0x9e:3;
sbit	FP12W = 0x9e:2;
sbit	FP11W = 0x9e:1;
sbit	FP10W = 0x9e:0;
sfr	PEDGE = 0x9f;
sbit	FP00G1 = 0x9f:1;
sbit	FP00G0 = 0x9f:0;
sfr	P0M = 0xa0;
sbit	FP04M = 0xa0:4;
sbit	FP03M = 0xa0:3;
sbit	FP02M = 0xa0:2;
sbit	FP01M = 0xa0:1;
sbit	FP00M = 0xa0:0;
sfr	P1M = 0xa1;
sbit	FP17M = 0xa1:7;
sbit	FP16M = 0xa1:6;
sbit	FP15M = 0xa1:5;
sbit	FP14M = 0xa1:4;
sbit	FP13M = 0xa1:3;
sbit	FP12M = 0xa1:2;
sbit	FP11M = 0xa1:1;
sbit	FP10M = 0xa1:0;
sfr	P0 = 0xa6;
sbit	FP04 = 0xa6:4;
sbit	FP03 = 0xa6:3;
sbit	FP02 = 0xa6:2;
sbit	FP01 = 0xa6:1;
sbit	FP00 = 0xa6:0;
sfr	P1 = 0xa7;
sbit	FP17 = 0xa7:7;
sbit	FP16 = 0xa7:6;
sbit	FP15 = 0xa7:5;
sbit	FP14 = 0xa7:4;
sbit	FP13 = 0xa7:3;
sbit	FP12 = 0xa7:2;
sbit	FP11 = 0xa7:1;
sbit	FP10 = 0xa7:0;
sfr	P0UR = 0xac;
sfr	P1UR = 0xad;
sfr	T0M = 0xb2;
sbit	FT0ENB = 0xb2:7;
sbit	FT0RATE2 = 0xb2:6;
sbit	FT0RATE1 = 0xb2:5;
sbit	FT0RATE0 = 0xb2:4;
sbit	FT0TB = 0xb2:0;
sfr	T0C = 0xb3;
sfr	TC0M = 0xb4;
sbit	FTC0ENB = 0xb4:7;
sbit	FTC0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sbit	FADCKS1 = 0xca:6;
sbit	FADLEN = 0xca:5;
sbit	FADCKS0 = 0xca:4;
sbit	FADB3 = 0xca:3;
sbit	FADB2 = 0xca:2;
sbit	FADB1 = 0xca:1;
sbit	FADB0 = 0xca:0;
sfr	ADT = 0xcb;
sbit	FADTS1 = 0xcb:7;
sbit	FADTS0 = 0xcb:6;
sbit	FADT4 = 0xcb:4;
sbit	FADT3 = 0xcb:3;
sbit	FADT2 = 0xcb:2;
sbit	FADT1 = 0xcb:1;
sbit	FADT0 = 0xcb:0;
sfr	VREFH = 0xcc;
sbit	FEVHENB = 0xcc:7;
sbit	FVHS1 = 0xcc:1;
sbit	FVHS0 = 0xcc:0;
sfr	PECMD = 0xdb;
sfr	PEROML = 0xdc;
sfr	PEROMH = 0xdd;
sfr	PERAML = 0xde;
sfr	PERAMCNT = 0xdf;
sfr	SIOM = 0xe0;
sbit	FSENB = 0xe0:7;
sbit	FSTART = 0xe0:6;
sbit	FSRATE1 = 0xe0:5;
sbit	FSRATE0 = 0xe0:4;
sbit	FMLSB = 0xe0:3;
sbit	FSCKMD = 0xe0:2;
sbit	FCPOL = 0xe0:1;
sbit	FCPHA = 0xe0:0;
sfr	SIOR = 0xe1;
sfr	SIOB = 0xe2;
sfr	SIOC = 0xe3;
sbit	FSIOBZ = 0xe3:2;
sbit	FSCSEN = 0xe3:1;
sbit	FSCSP = 0xe3:0;
sfr	URTX = 0xe4;
sbit	FUTXEN = 0xe4:7;
sbit	FUTXPEN = 0xe4:6;
sbit	FUTXPS = 0xe4:5;
sbit	FUTXBRK = 0xe4:4;
sbit	FURXBZ = 0xe4:3;
sbit	FUTXBZ = 0xe4:2;
sfr	URRX = 0xe5;
sbit	FURXEN = 0xe5:7;
sbit	FURXPEN = 0xe5:6;
sbit	FURXPS = 0xe5:5;
sbit	FURXPC = 0xe5:4;
sbit	FUFMER = 0xe5:3;
sbit	FURS2 = 0xe5:2;
sbit	FURS1 = 0xe5:1;
sbit	FURS0 = 0xe5:0;
sfr	URCR = 0xe6;
sfr	UTXD = 0xe7;
sfr	URXD = 0xe8;
sfr	STKP = 0xef;
sbit	FGIE = 0xef:7;
sbit	FLVD24 = 0xef:6;
sbit	FLVD33 = 0xef:5;
sbit	FSTKPB2 = 0xef:2;
sbit	FSTKPB1 = 0xef:1;
sbit	FSTKPB0 = 0xef:0;
sfr	STK7L = 0xf0;
sfr	STK7H = 0xf1;
sfr	STK6L = 0xf2;
sfr	STK6H = 0xf3;
sfr	STK5L = 0xf4;
sfr	STK5H = 0xf5;
sfr	STK4L = 0xf6;
sfr	STK4H = 0xf7;
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
