#define EXTERN  extern
#include        "define.h"

/* note: in the C30 code, int's were disabled, then re-enabled */
/*       then finally, the int was cleared (writes to IF and IE) */
/* I think that in this implimentation, that isn't necessary.  See  */
/* page 6-22: 6.5.6 External Interrupts */

void c_int01(void)
   {
   int  i;
   float *iqptr;

int     junk;   
   
   /* interrupt acknowlage */
   /* this isn't necessary if IIOF1 is used in level mode (176) */
/*   
   asm("      LDI   0h,AR1");
   asm("      IACK  *AR1");
*/

   /* turn on the cache */
   
   asm("        LDI     800H,ST");
   
   if(*Gate0mode && *Gates == 1)   /* if gate0 time series */
      {
      gate0ts();
      return;
      }
   
   if(*Gate0mode)      /* if GATE0MODE is turned on */
      {
      discrim();        /* compute sin(FREQ) */
                        /* stores result in *DISCRIMINATOR */
                        /* also reads in gate0 I and Q into *IQPTR */

      }
   else    
      {*IQPTR = *FIFO;  *(IQPTR+1) = *FIFO;}   /* read gate0 from FIFO */
   
   
   LEDSET(LED2);
   
   readfifo();          /* read remaining gates from fifo */

   LEDCLR(LED2);
   LEDSET(LED2);
   
   if(*Pcorrect)
      correctphase();   /* subtract phase of gate 0 from all gates */
   
   LEDCLR(LED2);
   LEDSET(LED2);
   
   if(*Clutterfilter)
     c_filter();       /* perform a clutter filter */
   
   LEDCLR(LED2);
   LEDSET(LED2);
   
   if(*Timeseries)
      timeseries();
   
   LEDCLR(LED2);
   LEDSET(LED2);
   
   pulsepair();        /* compute A,B, and P */
   
   LEDCLR(LED2);
   }
