   switch ((COMMAND_ID)(*av[0])) {
      case CHECKSUM :
         EmuChecksum((ADDR *)(av[1]+1),(U32)data[2]);
         break;
      case CLR_EVENT :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else EmuClrEvent((U16)data[1]);
         break;
      case CLR_TRIG :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else {
            if (mtatExist) EmuClrTrig((U16)data[1]);
            else OutputStatus(NO_TRACE_MODULE,ON);
         }
         break;
      case COMPARE :
         EmuCompare((ADDR *)(av[1]+1), (U32)data[2], (ADDR *)(av[3]+1));
         break;
      case COPY :
         EmuCopy((ADDR *)(av[1]+1), (U32)data[2], (ADDR *)(av[3]+1));
         break;
      case FUNCTION_TEST :
         EmuFunctionTest((U16)data[1]);
         break;
      /*  only use at run command
      case ESC_COMMAND :
         break;
      */
      case FILL :
         EmuFill((ADDR *)(av[1]+1), (U32)data[2], (U8 *)(av[3]+1), *av[3]);
         break;
      case GET_ID :
         EmuGetID();
         break;
     // case GET_ALL_CO_REG :
     //    EmuGetAllCoReg();
     //    break;
      case GET_ALL_REG :
         EmuGetAllReg();
         break;
      //case GET_ALL_INTERNAL_REG :
      //   EmuGetAllIntReg();
      //   break;
      case GET_CO_COVERAGE :
         break;
     // case GET_CO_REG :
     //    EmuGetCoReg((U16)data[1]);
     //    break;
      case GET_CONTROL :
         EmuGetControl();
         break;
      case GET_DEPTH :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else {
            if (mtatExist) EmuGetTraceDepth((U16)data[1]);
            else OutputStatus(NO_TRACE_MODULE,ON);
         }
         break;
      case GET_LAST_BUFF :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else {
            if (mtatExist) EmuGetTraceInfo();
            else OutputStatus(NO_TRACE_MODULE,ON);
         }
         break;
      case GET_MAP :
         EmuGetMap();
         break;
      case GET_EVENT :
         EmuGetAllEvent();
         break;
      case GET_MAP_SIZE :
         EmuGetMapSize();
         break;
      //case GET_MODE :
      //   EmuGetMode();
      //   break;
      case GET_READY :
         EmuGetReady();
         break;
      case GET_REG :
         EmuGetReg((REG_MODE)data[1], (U16)data[2]);
         break;
      case GET_SIZE :
         EmuGetAccessSize();
         break;
      case GET_STAT :
         EmuGetStatus();
         break;
      case GET_SYNC :
         EmuGetSync();
         break;
      case GET_VERIFY :
         EmuGetVerify();
         break;
      case GET_WAIT :
         EmuGetWait();
         break;
      case GO_COMMAND :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else {
            EmuGo((S16)data[1]);
            return(GOOD);
         }
         break;
    //  case HALT :
    //     EmuHalt();
    //     break;
      case INPUT :
         //EmuInput((U16)data[1], (U16)data[2], (U16)data[3]);
         break;
      case LIST_TRACE :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else {
            if (mtatExist) EmuListTrace((U16)data[1],(U32)data[2],(U8 *)(av[3]+1));
            else OutputStatus(NO_TRACE_MODULE,ON);
         }
         break;
      case OUTPUT :
         //EmuOutput((U16)data[1], (U8 *)(av[2]+1), (U16)data[3], (U16)data[4]);
         break;
      case READ_MEM_N :
         EmuReadMemN((ADDR *)(av[1]+1), (U16)data[2]);
         break;
      case RESET :
         EmuReset();
         AccessIceFlag(READ_ONE,FLYING,&flyFlag);
         break;
      case SEARCH :
         EmuSearch((ADDR *)(av[1]+1), (U32)data[2], (U8 *)(av[3]+1), *av[3]);
         break;
      case SET_CONTROL :
         EmuSetControl((U16)data[1]);
         break;
      case SET_CO_COVERAGE :
         break;
     // case SET_CO_REG :
     //    EmuSetCoReg((U16)data[1],(U16 *)(av[2]+1));
     //    break;
      case SET_EVENT :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else EmuSetEvent((U16)data[1], (U8 *)(av[2]+1));
         break;
      case SET_ALL_EVENT :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else EmuSetAllEvent((U8 *)(av[1]+1),(U8 *)(av[2]+1),(U8 *)(av[3]+1));
         break;
      case SET_EX_BKPT :
         EmuSetExBkpt((U16)data[1], (ADDR *)(av[2]+1));
         break;
      case SET_EXT_EVENT :
         EmuSetExtEvent((U16)data[1]);
         break;
      //case SET_ID :
      //   EmuSetID((U16)data[1]);
      //   break;
      case SET_MEM_N :
         EmuSetMemN((ADDR *)(av[1]+1), (U8 *)(av[2]+1), *av[2]);
         break;
      case SET_MAP :
         EmuSetMap((U32)data[1], (U32)data[2], (U16)data[3]);
         break;
      case SET_REG :
         EmuSetReg((REG_MODE)data[1], (U16)data[2],(U32)data[3]);
         break;
      case SET_READY :
         EmuSetReady((U16)data[1]);
         break;
      case SET_SIZE :
         EmuSetAccessSize((U16)data[1]);
         break;
      case SET_SYNC :
         EmuSetSync((U16)data[1]);
         break;
      case SET_TRACE_BREAK :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else {
            if (mtatExist) EmuSetTraceBreak((U16)data[1]);
            else OutputStatus(NO_TRACE_MODULE,ON);
         }
         break;
      case SET_TRACE_BUFF :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else {
            if (mtatExist) EmuSetTraceBuff((U16)data[1]);
            else OutputStatus(NO_TRACE_MODULE,ON);
         }
         break;
      case SET_TRIG :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else {
            if (mtatExist) EmuSetTrig((U16)data[1],(U16 *)(av[2]+1),(U16 *)(av[3]+1),(U16)(data[4]));
            else OutputStatus(NO_TRACE_MODULE,ON);
         }
         break;
      case GET_TRIG :
         if (mtatExist) EmuGetAllTrig();
         else OutputStatus(NO_TRACE_MODULE,ON);
         break;
      case SET_TIME_COUNT :
         EmuSetTimerCounter((U16)data[1],(U32)data[2]);
         break;
      //case SET_TIMER_REG :
      //   EmuEpTimer((U16)data[1]);
      //   break;
      case SET_VERIFY :
         EmuSetVerify((U16)data[1]);
         break;
      case SET_WAIT :
         EmuSetWait((U16)data[1]);
         break;
      case STEP :
         if (flyFlag) status = INVALID_FLY_COMMAND;
         else EmuStepRange((ADDR *)(av[1]+1),(ADDR *)(av[2]+1));
         break;
    //  case STEP_ONE :
    //     if (flyFlag) status = INVALID_FLY_COMMAND;
    //     else EmuStepRange(0,0);
    //     break;
      case TEST :
         EmuTest((ADDR *)(av[1]+1), (U32)data[2]);
         break;
      case GET_CPU_STATUS :
         EmuGetCpuStatus();
         break;
      case ABORT :
         EmuAbort();
         AccessIceFlag(READ_ONE,FLYING,&flyFlag);
         break;
      case DIAGNOSTIC :
         //EmuDiagnostic();
         break;
      case ENABLE_SW_BKPT :
         EmuEnSwBkpt();
         break;
      case DISABLE_SW_BKPT :
         EmuDisSwBkpt();
         break;
      case SET_BKPT_CODE :
         EmuSetBkptCode((BKPT_OP_CODE)data[1]);
         break;
      default :
         EmuReportError(COMMAND_ERROR);
   } /* end switch *data[0]. */
