#define LED_ON asm(" bset xf")
#define LED_OFF asm(" bclr xf")

void blink_led();

#define IOPORT_REGISTER(reg)     (*(ioport volatile unsigned short *)(reg))

#define PCGCR1  0x1c02
#define PCGCR2  0x1c03
#define PSRCR   0x1c04
#define PRCR    0x1C05

#define CCR2    0x1c1f
#define CGCR1   0x1c20
#define CGCR2   0x1c21
#define CGCR3   0x1c22
#define CGCR4   0x1c23
#define CCSSR   0x1c24

unsigned short block =1;

void main()
{
	unsigned short i, j, k;

	(IOPORT_REGISTER(0x1C02)) = 0;
	(IOPORT_REGISTER(0x1C03)) = 0;
	for(i=0; i<0x100; i++);
	while (block);
 	while(1)
	 {
		blink_led();
//		for(j=0; j<0xffff; j++)
		{
			for(i=0; i<0xa; i++)
			{
			for (k=0; k<0xffff; k++);
			}
		}

	 }
}

#pragma CODE_SECTION(blink_led, "blink_section")
void blink_led()
{
	static int toggle=0;

	if (0 == toggle)
	{
		LED_ON;
		toggle = 1;
	}
	else
	{
		LED_OFF;
		toggle = 0;
	}

}





