#ifndef __HS2300_P_H
#define __HS2300_P_H

//
// Special function register definitions
//

volatile         unsigned char           OPTION              @ 0x051;
volatile         unsigned char           IOSTA               @ 0x055;
volatile         unsigned char           IOSTB               @ 0x056;

// Register: INDF
volatile         unsigned char           INDF                @ 0x000;
// bit and bitfield definitions

// Register: TMR0
volatile         unsigned char           TMR0                @ 0x001;
// bit and bitfield definitions

// Register: PCL
volatile         unsigned char           PCL                 @ 0x002;
// bit and bitfield definitions

// Register: STATUS
volatile         unsigned char           STATUS              @ 0x003;
// bit and bitfield definitions
volatile bit C   	             @ ((unsigned)&STATUS*8)+0;
volatile bit DC                  @ ((unsigned)&STATUS*8)+1;
volatile bit Z	                 @ ((unsigned)&STATUS*8)+2;
volatile bit PD                  @ ((unsigned)&STATUS*8)+3;
volatile bit T0                  @ ((unsigned)&STATUS*8)+4;
volatile bit GP0                 @ ((unsigned)&STATUS*8)+5;
volatile bit GP1                 @ ((unsigned)&STATUS*8)+6;
volatile bit RST                 @ ((unsigned)&STATUS*8)+7;

// Register: FSR
volatile         unsigned char           FSR                 @ 0x004;


// Register: PA
volatile         unsigned char           PA                @ 0x005;
// bit and bitfield definitions
volatile bit PA0                 @ ((unsigned)&PA*8)+0;
volatile bit PA1                 @ ((unsigned)&PA*8)+1;
volatile bit PA2                 @ ((unsigned)&PA*8)+2;
volatile bit PA3                 @ ((unsigned)&PA*8)+3;
volatile bit PA4                 @ ((unsigned)&PA*8)+4;
volatile bit PA5                 @ ((unsigned)&PA*8)+5;
volatile bit PA6                 @ ((unsigned)&PA*8)+6;
volatile bit PA7                 @ ((unsigned)&PA*8)+7;

// Register: PB
volatile         unsigned char           PB                @ 0x006;
// bit and bitfield definitions
volatile bit PB0                 @ ((unsigned)&PB*8)+0;
volatile bit PB1                 @ ((unsigned)&PB*8)+1;
volatile bit PB2                 @ ((unsigned)&PB*8)+2;
volatile bit PB3                 @ ((unsigned)&PB*8)+3;
volatile bit PB4                 @ ((unsigned)&PB*8)+4;
volatile bit PB5                 @ ((unsigned)&PB*8)+5;
volatile bit PB6                 @ ((unsigned)&PB*8)+6;
volatile bit PB7                 @ ((unsigned)&PB*8)+7;


volatile         unsigned char           PCON                @ 0x008;
volatile bit LVDTE                 @ ((unsigned)&PCON*8)+5;
volatile bit EIS                   @ ((unsigned)&PCON*8)+6;
volatile bit WDTE                  @ ((unsigned)&PCON*8)+7;


volatile         unsigned char           WUCON               @ 0x009;
volatile         unsigned char           PCHBUF              @ 0x00A;
volatile         unsigned char           PDCON               @ 0x00B;
volatile         unsigned char           ODCON               @ 0x00C;
volatile         unsigned char           PHCON               @ 0x00D;
volatile         unsigned char           INTEN               @ 0x00E;
volatile bit T0IE                 @ ((unsigned)&INTEN*8)+0;
volatile bit PBIE                 @ ((unsigned)&INTEN*8)+1;
volatile bit INTIE                @ ((unsigned)&INTEN*8)+2;
volatile bit GIE                  @ ((unsigned)&INTEN*8)+7;

volatile         unsigned char           INTFLAG             @ 0x00F;
volatile bit T0IF                 @ ((unsigned)&INTFLAG*8)+0;
volatile bit PBIF                 @ ((unsigned)&INTFLAG*8)+1;
volatile bit INTIF                @ ((unsigned)&INTFLAG*8)+2;

volatile         unsigned char           TC1CL             @ 0x071;


volatile         unsigned char           TC1M              @ 0x072;
volatile bit PWM0                 @ ((unsigned)&TC1M*8)+0;
volatile bit BUZ                  @ ((unsigned)&TC1M*8)+1;
volatile bit T16SEL               @ ((unsigned)&TC1M*8)+2;
volatile bit TCCKS                @ ((unsigned)&TC1M*8)+3;
volatile bit TC1S0                @ ((unsigned)&TC1M*8)+4;
volatile bit TC1S1                @ ((unsigned)&TC1M*8)+5;
volatile bit TC1S2                @ ((unsigned)&TC1M*8)+6;
volatile bit TC1TR                @ ((unsigned)&TC1M*8)+7;


volatile         unsigned char           TC1R              @ 0x073;
volatile         unsigned char           TC1D0             @ 0x074;
volatile         unsigned char           TC1D1             @ 0x075;
volatile         unsigned char           TC1D2             @ 0x076;


volatile         unsigned char           PWMCON            @ 0x077;
volatile bit PWM1EN               @ ((unsigned)&PWMCON*8)+0;
volatile bit PWM2EN               @ ((unsigned)&PWMCON*8)+1;
volatile bit PWM1S                @ ((unsigned)&PWMCON*8)+2;
volatile bit PWM2S                @ ((unsigned)&PWMCON*8)+3;
volatile bit PWM1XR0              @ ((unsigned)&PWMCON*8)+4;
volatile bit PWM1XR1              @ ((unsigned)&PWMCON*8)+5;
volatile bit PWM2XR0              @ ((unsigned)&PWMCON*8)+6;
volatile bit PWM2XR1              @ ((unsigned)&PWMCON*8)+7;

volatile         unsigned char           PDCON1            @ 0x078;




#define CLR_OPTION()	asm("movlw 0");\
						asm("movwf 51h");	

#define CLR_IOSTA()	asm("movlw 0");\
					asm("movwf 55h");
					
#define CLR_IOSTB()	asm("movlw 0");\
					asm("movwf 56h");	
							
					
volatile         unsigned char           SFR50              @ 0x050;			
volatile         unsigned char           SFR52              @ 0x052;
volatile         unsigned char           SFR53              @ 0x053;
volatile         unsigned char           SFR54              @ 0x054;
volatile         unsigned char           SFR57              @ 0x057;
volatile         unsigned char           SFR58              @ 0x058;
volatile         unsigned char           SFR59              @ 0x059;
volatile         unsigned char           SFR5A              @ 0x05A;
volatile         unsigned char           SFR5B              @ 0x05B;
volatile         unsigned char           SFR5C              @ 0x05C;
volatile         unsigned char           SFR5D              @ 0x05D;
volatile         unsigned char           SFR5E              @ 0x05E;
volatile         unsigned char           SFR5F              @ 0x05F;
volatile         unsigned char           SFR60              @ 0x060;
volatile         unsigned char           SFR61              @ 0x061;
volatile         unsigned char           SFR62              @ 0x062;
volatile         unsigned char           SFR63              @ 0x063;
volatile         unsigned char           SFR64              @ 0x064;
volatile         unsigned char           SFR65              @ 0x065;
volatile         unsigned char           SFR66              @ 0x066;
volatile         unsigned char           SFR67              @ 0x067;
volatile         unsigned char           SFR68              @ 0x068;
volatile         unsigned char           SFR69              @ 0x069;
volatile         unsigned char           SFR6A              @ 0x06A;
volatile         unsigned char           SFR6B              @ 0x06B;
volatile         unsigned char           SFR6C              @ 0x06C;
volatile         unsigned char           SFR6D              @ 0x06D;
volatile         unsigned char           SFR6E              @ 0x06E;
volatile         unsigned char           SFR6F              @ 0x06F;
volatile         unsigned char           SFR70              @ 0x070;

#endif
