
// the command which will place the device into BootROM mode
const char code bootrom_init_cmd[] = "boot";
// pointer used to keep track of how much of the command has been received
const char code *pcmd = bootrom_init_cmd;

/*******************************************************************************/
/* 			        PROGRAM CODE				       */
/*******************************************************************************/  

/*-------------------------------------------------------------------------------
Interrupt routine
	void uart_isr (void)
-------------------------------------------------------------------------------*/
void uart_isr (void) interrupt 4 using 1
{
	if (RI != 0)		/* Received data interrupt */
  	{
  		RI = 0;		/* Clear interrup flag */
		if (SBUF == *pcmd)
			{
     			// echo character
     			while (TI !=0);
  	  		TI = 0;
	  		SBUF = *pcmd;
			
		  	// move to next character in command
		  	pcmd++;
		  	
		  	// if null terminator reached then whole command received
		  	if (!*pcmd)
	 	  	{
		    		// echo '.' to indicate success
		    		while (TI !=0);
				TI = 0;
				SBUF = '.';
				// disable interrupts
		    		//EA = 0;
	        		GoToBoot();
		  	}
		}
		else
		{
	      		// character received wasn't next character in command
			// so start over again
      			pcmd = bootrom_init_cmd;
			// application processing of serial input goes here
		}
  
  		if ((u8ReceiveIn + 1) != u8ReceiveOut)
    		au8ReceiveBuffer [u8ReceiveIn++] = SBUF;
    	}
