Exemplo n.º 1
0
void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir)
{
  char *infbuf="inf";
  
  if (available(fp,ir,title)) {
    indent=pr_title(fp,indent,title);
#define PS(t,s) pr_str(fp,indent,t,s)
#define PI(t,s) pr_int(fp,indent,t,s)
#define PR(t,s) pr_real(fp,indent,t,s)
    PS("integrator",EI(ir->eI));
    PI("nsteps",ir->nsteps);
    PS("ns_type",ENS(ir->ns_type));
    PI("nstlist",ir->nstlist);
    PI("ndelta",ir->ndelta);
    PS("bDomDecomp",BOOL(ir->bDomDecomp));
    PI("decomp_dir",ir->decomp_dir);
    PI("nstcomm",ir->nstcomm);
    PI("nstlog",ir->nstlog);
    PI("nstxout",ir->nstxout);
    PI("nstvout",ir->nstvout);
    PI("nstfout",ir->nstfout);
    PI("nstenergy",ir->nstenergy);
    PI("nstxtcout",ir->nstxtcout);
    PR("init_t",ir->init_t);
    PR("delta_t",ir->delta_t);
    PR("xtcprec",ir->xtcprec);
    PI("nkx",ir->nkx);
    PI("nky",ir->nky);
    PI("nkz",ir->nkz);
    PI("pme_order",ir->pme_order);
    PR("ewald_rtol",ir->ewald_rtol);
    PR("ewald_geometry",ir->ewald_geometry);
    PR("epsilon_surface",ir->epsilon_surface);
    PS("optimize_fft",BOOL(ir->bOptFFT));
    PS("ePBC",EPBC(ir->ePBC));
    PS("bUncStart",BOOL(ir->bUncStart));
    PS("bShakeSOR",BOOL(ir->bShakeSOR));
    PS("etc",ETCOUPLTYPE(ir->etc));
    PS("epc",EPCOUPLTYPE(ir->epc));
    PS("epctype",EPCOUPLTYPETYPE(ir->epct));
    PR("tau_p",ir->tau_p);
    pr_rvecs(fp,indent,"ref_p",ir->ref_p,DIM);
    pr_rvecs(fp,indent,"compress",ir->compress,DIM);
    PS("bSimAnn",BOOL(ir->bSimAnn)); 
    PR("zero_temp_time",ir->zero_temp_time); 
    PR("rlist",ir->rlist);
    PS("coulombtype",EELTYPE(ir->coulombtype));
    PR("rcoulomb_switch",ir->rcoulomb_switch);
    PR("rcoulomb",ir->rcoulomb);
    PS("vdwtype",EVDWTYPE(ir->vdwtype));
    PR("rvdw_switch",ir->rvdw_switch);
    PR("rvdw",ir->rvdw);
    if (fabs(ir->epsilon_r) > GMX_REAL_MIN)
      PR("epsilon_r",ir->epsilon_r);
    else
      PS("epsilon_r",infbuf);
    PS("DispCorr",EDISPCORR(ir->eDispCorr));
    PR("fudgeQQ",ir->fudgeQQ);
    PS("free_energy",EFEPTYPE(ir->efep));
    PR("init_lambda",ir->init_lambda);
    PR("sc_alpha",ir->sc_alpha);
    PR("sc_sigma",ir->sc_sigma);
    PR("delta_lambda",ir->delta_lambda);
    PS("disre_weighting",EDISREWEIGHTING(ir->eDisreWeighting));
    PS("disre_mixed",BOOL(ir->bDisreMixed));
    PR("dr_fc",ir->dr_fc);
    PR("dr_tau",ir->dr_tau);
    PR("nstdisreout",ir->nstdisreout);
    PR("orires_fc",ir->orires_fc);
    PR("orires_tau",ir->orires_tau);
    PR("nstorireout",ir->nstorireout);
    PR("em_stepsize",ir->em_stepsize);
    PR("em_tol",ir->em_tol);
    PI("niter",ir->niter);
    PR("fc_stepsize",ir->fc_stepsize);
    PI("nstcgsteep",ir->nstcgsteep);
    PS("ConstAlg",ESHAKETYPE(ir->eConstrAlg));
    PR("shake_tol",ir->shake_tol);
    PI("lincs_order",ir->nProjOrder);
    PR("lincs_warnangle",ir->LincsWarnAngle);
    PR("bd_temp",ir->bd_temp);
    PR("bd_fric",ir->bd_fric);
    PI("ld_seed",ir->ld_seed);
    PR("cos_accel",ir->cos_accel);
    PI("userint1",ir->userint1);
    PI("userint2",ir->userint2);
    PI("userint3",ir->userint3);
    PI("userint4",ir->userint4);
    PR("userreal1",ir->userreal1);
    PR("userreal2",ir->userreal2);
    PR("userreal3",ir->userreal3);
    PR("userreal4",ir->userreal4);
#undef PS
#undef PR
#undef PI
    pr_grp_opts(fp,indent,"grpopts",&(ir->opts));
    pr_cosine(fp,indent,"efield-x",&(ir->ex[XX]));
    pr_cosine(fp,indent,"efield-xt",&(ir->et[XX]));
    pr_cosine(fp,indent,"efield-y",&(ir->ex[YY]));
    pr_cosine(fp,indent,"efield-yt",&(ir->et[YY]));
    pr_cosine(fp,indent,"efield-z",&(ir->ex[ZZ]));
    pr_cosine(fp,indent,"efield-zt",&(ir->et[ZZ]));
  }
}
Exemplo n.º 2
0
BUESSION_API zval *buession_get_global_variables(uint type TSRMLS_DC){
	zval **result;

	#if(PHP_MAJOR_VERSION == 5)&&(PHP_MINOR_VERSION < 4)
		zend_bool jit_initialization = (PG(auto_globals_jit)&&!PG(register_globals)&&!PG(register_long_arrays));
	#else
		zend_bool jit_initialization = PG(auto_globals_jit);
	#endif

	#if HAVE_BUESSION_DEBUG
		switch(type){
			case TRACK_VARS_POST:
				zend_hash_find(&EG(symbol_table), "_POST", 6, (void **) &result);
				break;
			case TRACK_VARS_GET:
				zend_hash_find(&EG(symbol_table), "_GET", 5, (void **) &result);
				break;
			case TRACK_VARS_SESSION:
				result = &PS(http_session_vars);
				break;
			case TRACK_VARS_COOKIE:
				zend_hash_find(&EG(symbol_table), "_COOKIE", 8, (void **) &result);
				break;
			case TRACK_VARS_SERVER:
				if(jit_initialization){
					zend_is_auto_global("_SERVER", 7 TSRMLS_CC);
				}
				zend_hash_find(&EG(symbol_table), "_SERVER", 8, (void **) &result);
				break;
			case TRACK_VARS_ENV:
				if(jit_initialization){
					zend_is_auto_global("_ENV", 4 TSRMLS_CC);
				}
				result = &PG(http_globals)[TRACK_VARS_ENV];
				break;
			case TRACK_VARS_FILES:
				result = &PG(http_globals)[TRACK_VARS_FILES];
				break;
			case TRACK_VARS_REQUEST:
				if(jit_initialization){
					zend_is_auto_global("_REQUEST", 9 TSRMLS_CC);
				}
				zend_hash_find(&EG(symbol_table), "_REQUEST", 9, (void **) &result);
				break;
			case TRACK_VARS_GLOBALS:
				zend_hash_find(&EG(symbol_table), "GLOBALS", 8, (void **) &result);
				break;
			default:
				break;
		}
	#else
		switch(type){
			case TRACK_VARS_POST: case TRACK_VARS_GET: case TRACK_VARS_FILES: case TRACK_VARS_COOKIE:
				result = &PG(http_globals)[type];
				break;
			case TRACK_VARS_SESSION:
				result = &PS(http_session_vars);
				break;
			case TRACK_VARS_ENV:
				if(jit_initialization){
					zend_is_auto_global("_ENV", 4 TSRMLS_CC);
				}
				result = &PG(http_globals)[type];
				break;
			case TRACK_VARS_SERVER:
				if(jit_initialization){
					zend_is_auto_global("_SERVER", 7 TSRMLS_CC);
				}
				result = &PG(http_globals)[type];
				break;
			case TRACK_VARS_REQUEST:
				if(jit_initialization){
					zend_is_auto_global("_REQUEST", 8 TSRMLS_CC);
				}
				result = &PG(http_globals)[type];
				break;
			case TRACK_VARS_GLOBALS:
				zend_hash_find(&EG(symbol_table), "GLOBALS", 8, (void **) &result);
				break;
			default:
				break;
		}
	#endif

	if(!result||!(*result)){
		BUESSION_ARRAY_INIT(*result);
		return *result;
	}

	Z_ADDREF_PP(result);
	return *result;
}
Exemplo n.º 3
0
//
//
// System setup menu
//
//
void misc_setup(u08 force_menu)
{
#ifdef MENU_CODE
u08 bl;
u08 sound;
u08 invert;
u08 clock;

   // load backlight value in EEPROM
   bl = eeprom_read_byte((uint8_t *) EE_BACKLIGHT);

   // validate the sound value in EEPROM
   sound = eeprom_read_byte((uint8_t *) EE_SOUND);
   if(sound == 'N') sound = 1;
   else if(sound == 'F') sound = 0;
   else {
      force_menu = 1;
      sound = 1;
   }

   // validate the time value in EEPROM
   clock = eeprom_read_byte((uint8_t *) EE_SET_TIME);
   if(clock == 'N') clock = 1;
   else if(clock == 'F') clock = 0;
   else {
      force_menu = 1;
      clock = 0;
   }

   // validate the button color value in EEPROM
   invert = eeprom_read_byte((uint8_t *) EE_INVERT_BUT);
   if((invert != 0x00) && (invert != 0xFF)) {
      force_menu = 1;
      invert = 0xFF;
   }


   time_not_set = 1;
   if(force_menu == 0) goto use_params;

   MENU_INIT

   do {
      MENU_CONTROLS


      if((COLS < 160) || (ROWS < 80)) {
         menu_label    (0,0,   PS("Misc Setup")); 
         menu_checkbox (1*CHAR_WIDTH-4,  (CHAR_HEIGHT+CHAR_HEIGHT/2)*1, PS("Backlight"),  bl, 1);
         menu_checkbox (1*CHAR_WIDTH-4,  (CHAR_HEIGHT+CHAR_HEIGHT/2)*2, PS("Beeper"),  sound, 2);
         menu_checkbox (1*CHAR_WIDTH-4,  (CHAR_HEIGHT+CHAR_HEIGHT/2)*3, PS("Invert buttons"), invert, 3);
         #ifdef TIME_CLOCK
            menu_checkbox (1*CHAR_WIDTH-4,  (CHAR_HEIGHT+CHAR_HEIGHT/2)*4, PS("Set clock"), clock, 4);
         #endif
         menu_exitbutton();
      }
      else {
         menu_label    (0,0,   PS("Misc Setup Menu")); 
         menu_checkbox (4*CHAR_WIDTH,  CHAR_HEIGHT*2, PS("Backlight"),  bl, 1);
         menu_checkbox (4*CHAR_WIDTH,  CHAR_HEIGHT*4, PS("Beeper"),  sound, 2);
         menu_checkbox (4*CHAR_WIDTH,  CHAR_HEIGHT*6, PS("Invert buttons"), invert, 3);
         #ifdef TIME_CLOCK
            menu_checkbox (4*CHAR_WIDTH,  CHAR_HEIGHT*8, PS("Set clock"), clock, 4);
         #endif
         menu_exitbutton();
      }

      MENU_COMMANDS

      // menu button/control responses

      switch(menu_cmd()) {
         case 1: 
            break;

         case 2: 
            break;

         case 3: 
            break;

         case 4: 
            #ifdef TIME_CLOCK
               if(clock) {
                  menu_call(set_time);
                  time_not_set = 0;
               }
            #endif
            break;
      }
   } while(menu_cmd() != MENU_EXITCODE) ;  // repeat until exit command

   wait_while_touched();

   if(bl) bl = 0xFF;  //!!!  
   eeprom_write_byte((uint8_t *) EE_BACKLIGHT,  bl);

   if(sound)  eeprom_write_byte((uint8_t *) EE_SOUND,  (uint8_t) 'N');
   else       eeprom_write_byte((uint8_t *) EE_SOUND,  (uint8_t) 'F');

   if(invert)  eeprom_write_byte((uint8_t *) EE_INVERT_BUT,  (uint8_t) 0xFF);
   else        eeprom_write_byte((uint8_t *) EE_INVERT_BUT,  (uint8_t) 0x00);

   if(clock)   eeprom_write_byte((uint8_t *) EE_SET_TIME,  (uint8_t) 'N');
   else        eeprom_write_byte((uint8_t *) EE_SET_TIME,  (uint8_t) 'F');

   

   use_params:
   lcd_backlight(bl);

   #ifdef TIME_CLOCK
      if(eeprom_read_byte((uint8_t *) EE_SET_TIME) == 'N') {
         if(time_not_set) set_time();
      }
   #endif

   if(sound) beep_disabled = 0;
   else      beep_disabled = 1;

   if(invert) invert_buttons = WHITE;
   else       invert_buttons = 0x00;
#endif
}
Exemplo n.º 4
0
/**
    \fn dumpx265Setup
*/
void dumpx265Setup(x265_param *param)
{
#define PI(x) printf(#x"\t:%d\n",(int)param->x)
#define PD(x) printf(#x"\t:%d\n",(double)param->x)
#define PS(x) printf(#x"\t:%s\n",param->x)
    printf("*************************************\n");
    printf("***      Encoder Environment      ***\n");
    printf("*************************************\n");

    PI(cpuid);
    PI(bEnableWavefront);
#if X265_BUILD >= 47
    PS(numaPools);
#else
    PI(poolNumThreads);
#endif
    PI(frameNumThreads);
    PI(logLevel);
    PI(bLogCuStats);
    PI(bEnablePsnr);
    PI(bEnableSsim);
    PI(decodedPictureHashSEI);

    printf("*************************************\n");
    printf("** Internal Picture Specification  **\n");
    printf("*************************************\n");

    PI(internalBitDepth);
    PI(internalCsp);
    PI(fpsNum);
    PI(fpsDenom);
    PI(sourceWidth);
    PI(sourceHeight);
    PI(levelIdc);
    PI(interlaceMode);
    PI(bRepeatHeaders);
    PI(bEnableAccessUnitDelimiters);
    PI(bEmitHRDSEI);

    printf("*************************************\n");
    printf("*** Coding Unit (CU) Definitions  ***\n");
    printf("*************************************\n");

    PI(maxCUSize);
    PI(tuQTMaxInterDepth);
    PI(tuQTMaxIntraDepth);

    printf("*************************************\n");
    printf("***  GOP Structure and Lookahead  ***\n");
    printf("*************************************\n");

    PI(bOpenGOP);
    PI(keyframeMin);
    PI(keyframeMax);
    PI(maxNumReferences);
    PI(bFrameAdaptive);
    PI(bframes);
    PI(bBPyramid);
    PI(lookaheadDepth);
    PI(bFrameBias);
    PI(scenecutThreshold);

    printf("*************************************\n");
    printf("***      Intra Coding Tools       ***\n");
    printf("*************************************\n");

    PI(bEnableConstrainedIntra);
    PI(bEnableStrongIntraSmoothing);

    printf("*************************************\n");
    printf("***      Inter Coding Tools       ***\n");
    printf("*************************************\n");

    PI(searchMethod);
    PI(subpelRefine);
    PI(searchRange);
    PI(maxNumMergeCand);
    PI(bEnableWeightedPred);
    PI(bEnableWeightedBiPred);

    printf("*************************************\n");
    printf("***        Analysis Tools         ***\n");
    printf("*************************************\n");

    PI(bEnableAMP);
    PI(bEnableRectInter);
#if X265_BUILD < 45
    PI(bEnableCbfFastMode);
#endif
    PI(bEnableEarlySkip);
    PI(rdPenalty);
    PI(rdLevel);
    PD(psyRd);

    printf("*************************************\n");
    printf("***         Coding Tools          ***\n");
    printf("*************************************\n");

    PI(bEnableSignHiding);
    PI(bEnableTransformSkip);
    PI(bEnableTSkipFast);
    PI(bEnableLoopFilter);
    PI(bEnableSAO);

#if X265_BUILD >= 33
    PI(bSaoNonDeblocked);
#else
    PI(saoLcuBoundary);
#endif

#if X265_BUILD < 32
    PI(saoLcuBasedOptimization);
#endif

    PI(cbQpOffset);
    PI(crQpOffset);
    PI(bIntraInBFrames);

#if X265_BUILD >= 40
    PI(noiseReductionIntra);
    PI(noiseReductionInter);
#else
    PI(noiseReduction);
#endif

    PI(bLossless);
    PI(bCULossless);

#define RI(x) printf(#x"\t:%d\n",(int)param->rc.x)
#define RD(x) printf(#x"\t:%f\n",(double)param->rc.x)
    printf("*************************************\n");
    printf("***         Rate Control          ***\n");
    printf("*************************************\n");

    RI(rateControlMode);
    RI(qp);
    RI(bitrate);

#if X265_BUILD >= 41
    RI(bStrictCbr);
#else
    RD(rateTolerance);
#endif

    RD(qCompress);
    RD(ipFactor);
    RD(pbFactor);
    RI(qpStep);
    RD(rfConstant);
    RI(aqMode);
    RD(aqStrength);
    RI(vbvMaxBitrate);
    RI(vbvBufferSize);
    RD(vbvBufferInit);
    RI(cuTree);
    RD(rfConstantMax);
    RD(rfConstantMin);
    RI(bStatWrite);
    RI(bStatRead);
    RD(qblur);
    RD(complexityBlur);

#define VI(x) printf(#x"\t:%d\n",(int)param->vui.x)
    printf("*************************************\n");
    printf("***  Video Usability Information  ***\n");
    printf("*************************************\n");

    VI(aspectRatioIdc);
    VI(sarWidth);
    VI(sarHeight);
    VI(bEnableOverscanInfoPresentFlag);
    VI(bEnableOverscanAppropriateFlag);
    VI(bEnableVideoSignalTypePresentFlag);
    VI(videoFormat);
    VI(bEnableVideoFullRangeFlag);
    VI(bEnableColorDescriptionPresentFlag);
    VI(colorPrimaries);
    VI(transferCharacteristics);
    VI(matrixCoeffs);
    VI(bEnableChromaLocInfoPresentFlag);
    VI(chromaSampleLocTypeTopField);
    VI(chromaSampleLocTypeBottomField);
    VI(bEnableDefaultDisplayWindowFlag);
    VI(defDispWinLeftOffset);
    VI(defDispWinRightOffset);
    VI(defDispWinTopOffset);
    VI(defDispWinBottomOffset);

}
Exemplo n.º 5
0
int Sigma_i(int i, int n)
{
	int s=0;
	for(int vi=0; vi<=i; vi++) s+=PS(vi,n);
	return s;
};
Exemplo n.º 6
0
static bool send_size(int fd, size_t size)
{
    uint32_t size32 = ntohl(size);
    return send_all(fd, PS(size32));
}
Exemplo n.º 7
0
Arquivo: msp430-dis.c Projeto: 5kg/gdb
static int
msp430_singleoperand (disassemble_info *info,
		      struct msp430_opcode_s *opcode,
		      bfd_vma addr,
		      unsigned short insn,
		      char *op,
		      char *comm,
		      unsigned short extension_word,
		      int *cycles)
{
  int regs = 0, regd = 0;
  int ad = 0, as = 0;
  int where = 0;
  int cmd_len = 2;
  int dst = 0;
  int fmt;
  int extended_dst = extension_word & 0xf;

  regd = insn & 0x0f;
  regs = (insn & 0x0f00) >> 8;
  as = (insn & 0x0030) >> 4;
  ad = (insn & 0x0080) >> 7;

  if (opcode->fmt < 0)
    fmt = (- opcode->fmt) - 1;
  else
    fmt = opcode->fmt;

  switch (fmt)
    {
    case 0:			/* Emulated work with dst register.  */
      if (regs != 2 && regs != 3 && regs != 1)
	return 0;

      /* Check if not clr insn.  */
      if (opcode->bin_opcode == 0x4300 && (ad || as))
	return 0;

      /* Check if really inc, incd insns.  */
      if ((opcode->bin_opcode & 0xff00) == 0x5300 && as == 3)
	return 0;

      if (ad == 0)
	{
	  *cycles = 1;

	  /* Register.  */
	  if (regd == 0)
	    {
	      *cycles += 1;
	      sprintf (op, "r0");
	    }
	  else if (regd == 1)
	    sprintf (op, "r1");

	  else if (regd == 2)
	    sprintf (op, "r2");

	  else
	    sprintf (op, "r%d", regd);
	}
      else	/* ad == 1 msp430dis_opcode.  */
	{
	  if (regd == 0)
	    {
	      /* PC relative.  */
	      dst = msp430dis_opcode (addr + 2, info);
	      cmd_len += 2;
	      *cycles = 4;
	      sprintf (op, "0x%04x", dst);
	      sprintf (comm, "PC rel. abs addr 0x%04x",
		       PS ((short) (addr + 2) + dst));
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  sprintf (op, "0x%05x", dst);
		  sprintf (comm, "PC rel. abs addr 0x%05lx",
			   (long)((addr + 2 + dst) & 0xfffff));
		}
	    }
	  else if (regd == 2)
	    {
	      /* Absolute.  */
	      dst = msp430dis_opcode (addr + 2, info);
	      cmd_len += 2;
	      *cycles = 4;
	      sprintf (op, "&0x%04x", PS (dst));
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  sprintf (op, "&0x%05x", dst & 0xfffff);
		}
	    }
	  else
	    {
	      dst = msp430dis_opcode (addr + 2, info);
	      cmd_len += 2;
	      *cycles = 4;
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  if (dst & 0x80000)
		    dst |= -1 << 20;
		}
	      else if (dst & 0x8000)
		dst |= -1 << 16;
	      sprintf (op, "%d(r%d)", dst, regd);
	    }
	}
      break;

    case 2:	/* rrc, push, call, swpb, rra, sxt, push, call, reti etc...  */
      if (as == 0)
	{
	  if (regd == 3)
	    {
	      /* Constsnts.  */
	      sprintf (op, "#0");
	      sprintf (comm, "r3 As==00");
	    }
	  else
	    {
	      /* Register.  */
	      sprintf (op, "r%d", regd);
	    }
	  *cycles = 1;
	}
      else if (as == 2)
	{
	  * cycles = print_as2_reg_name (regd, op, comm, 1, 1, 3);
	}
      else if (as == 3)
	{
	  if (regd == 0)
	    {
	      *cycles = 3;
	      /* absolute. @pc+ */
	      dst = msp430dis_opcode (addr + 2, info);
	      cmd_len += 2;
	      sprintf (op, "#%d", dst);
	      if (dst > 9 || dst < 0)
		sprintf (comm, "#0x%04x", PS (dst));
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  if (dst & 0x80000)
		    dst |= -1 << 20;
		  sprintf (op, "#%d", dst);
		  if (dst > 9 || dst < 0)
		    sprintf (comm, "#0x%05x", dst);
		}
	    }
	  else
	    * cycles = print_as3_reg_name (regd, op, comm, 1, 1, 3);
	}
      else if (as == 1)
	{
	  *cycles = 4;
	  if (regd == 0)
	    {
	      /* PC relative.  */
	      dst = msp430dis_opcode (addr + 2, info);
	      cmd_len += 2;
	      sprintf (op, "0x%04x", PS (dst));
	      sprintf (comm, "PC rel. 0x%04x",
		       PS ((short) addr + 2 + dst));
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  sprintf (op, "0x%05x", dst & 0xffff);
		  sprintf (comm, "PC rel. 0x%05lx",
			   (long)((addr + 2 + dst) & 0xfffff));
		}
	    }
	  else if (regd == 2)
	    {
	      /* Absolute.  */
	      dst = msp430dis_opcode (addr + 2, info);
	      cmd_len += 2;
	      sprintf (op, "&0x%04x", PS (dst));
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  sprintf (op, "&0x%05x", dst & 0xfffff);
		}
	    }
	  else if (regd == 3)
	    {
	      *cycles = 1;
	      sprintf (op, "#1");
	      sprintf (comm, "r3 As==01");
	    }
	  else
	    {
	      /* Indexed.  */
	      dst = msp430dis_opcode (addr + 2, info);
	      cmd_len += 2;
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  if (dst & 0x80000)
		    dst |= -1 << 20;
		}
	      else if (dst & 0x8000)
		dst |= -1 << 16;
	      sprintf (op, "%d(r%d)", dst, regd);
	      if (dst > 9 || dst < 0)
		sprintf (comm, "%05x", dst);
	    }
	}
      break;

    case 3:			/* Jumps.  */
      where = insn & 0x03ff;
      if (where & 0x200)
	where |= ~0x03ff;
      if (where > 512 || where < -511)
	return 0;

      where *= 2;
      sprintf (op, "$%+-8d", where + 2);
      sprintf (comm, "abs 0x%lx", (long) (addr + 2 + where));
      *cycles = 2;
      return 2;
      break;
    default:
      cmd_len = 0;
    }

  return cmd_len;
}
Exemplo n.º 8
0
void EmulatorThread::run()
{
    // Load PC from Reset Vector
    CpuInitialize();
    lcdoffshift0flag = false;
    //g_stp = 1; // test
#ifndef FAKENMI
    unsigned int nmistart = GetTickCount();
#endif
    gThreadFlags &= 0xFFFEu; // Remove 0x01 from gThreadFlags (stack related)
#ifdef AUTOTEST
    unsigned totalline = 0; // TODO: long long
    enablelogging = false;
#endif
    while(fKeeping) {
#if 1
        const unsigned spdc1016freq = GlobalSetting.SPDC1016Frequency;
#endif
#ifdef FAMENMI
        twohznmicycle = spdc1016freq / 2;
#endif
        while (batchcount >= 0 && fKeeping) {
#ifdef AUTOTEST
            totalline++;
            TryTest(totalline);
#endif // AUTOTEST
#ifdef LOGASM
#ifdef AUTOTEST
            if (enablelogging) {
#endif
#ifdef HANDYPSP
                LogDisassembly(mPC, NULL);
#else
                LogDisassembly(regs.pc, NULL);
#endif // HANDYPSP
#ifdef AUTOTEST
            }
#endif // AUTOTEST
#endif // LOGASM
            if (matrixupdated) {
                matrixupdated = false;
                AppendLog("keypadmatrix updated.");
            }

            nmicount++; // MERGEASM
            // 2Hz NMI
            // TODO: use batchcount as NMI source
#ifdef FAKENMI
            if (nmicount % 400000 == 0) {
                nmicount = 0; // MERGEASM
            //if (twohznmicycle < 0) {
            //    twohznmicycle = spdc1016freq / 2; // reset
#else
            // in CC800 hardware, NMI is generated by 32.768k crystal, but spdc1016 use RC oscillator so cycle/NMI can be mismatched.
            unsigned int dummynow = GetTickCount();
            if (dummynow - nmistart >= 500) {
                nmistart += 500;
#endif
                //g_nmi = 0; // next CpuExecute will execute two instructions
                gThreadFlags |= 0x08; // Add NMIFlag
            }

            // NMI > IRQ
            if ((gThreadFlags & 0x08) != 0) {
                gThreadFlags &= 0xFFF7u; // remove 0x08 NMI Flag
                // FIXME: NO MORE REVERSE
                g_nmi = TRUE; // next CpuExecute will execute two instructions
                qDebug("ggv wanna NMI.");
                //fprintf(stderr, "ggv wanna NMI.\n");
                gDeadlockCounter--; // wrong behavior of wqxsim
#ifdef HANDYPSP
            } else if (((PS() & AF_INTERRUPT) == 0) && ((gThreadFlags & TF_IRQFLAG) != 0)) {
#else
            } else if (((regs.ps & 0x4) == 0) && ((gThreadFlags & 0x10) != 0)) {
#endif
                gThreadFlags &= 0xFFEFu; // remove 0x10 IRQ Flag
                g_irq = TRUE; // B flag (AF_BREAK) will remove in CpuExecute
                qDebug("ggv wanna IRQ.");
                gDeadlockCounter--; // wrong behavior of wqxsim
            }

            DWORD CpuTicks = CpuExecute();
            totalcycle += CpuTicks;
            twohznmicycle -= CpuTicks;
            // add checks for reset, IRQ, NMI, and other pin signals
            if (lastTicket == 0) {
                lastTicket = GetTickCount();
            }

            gDeadlockCounter++;
            if (gDeadlockCounter == 6000) {
                // overflowed
                gDeadlockCounter = 0;
                if ((gThreadFlags & 0x80u) == 0) {
                    // CheckTimerbaseAndEnableIRQnEXIE1
                    CheckTimebaseAndEnableIRQnEXIE1();
                    if (timer0started) {
                        // mayDestAddr == 5 in ReadRegister
                        // mayBaseTable have 0x100 elements?
                        //increment = mayBasetable[mayDestAddr];  // mayBaseTable[5] == 3
                        //t0overflow = (unsigned int)(increment + mayPreviousTimer0Value) < 0xFF;
                        //mayPreviousTimer0Value += increment;
                        //if ( !t0overflow )
                        //{
                        //    mayPreviousTimer0Value = 0;
                        //    Turnoff2HzNMIMaskAddIRQFlag();
                        //}
                        int increment = 3;
                        prevtimer0value += increment;
                        if (prevtimer0value >= 0xFFu) {
                            prevtimer0value = 0;
                            Turnoff2HzNMIMaskAddIRQFlag();
                        }
                    }
                } else {
                    // RESET
                    fixedram0000[io01_int_enable] |= 0x1; // TIMER A INTERRUPT ENABLE
                    fixedram0000[io02_timer0_val] |= 0x1; // [io01+1] Timer0 bit1 = 1
                    gThreadFlags &= 0xFF7F;      // remove 0x80 | 0x10
#ifdef HANDYPSP
                    mPC = *(unsigned short*)&pmemmap[mapE000][0x1FFC];
#else
                    regs.pc = *(unsigned short*)&pmemmap[mapE000][0x1FFC];
#endif
                }
            } else {
                if (timer0started) {
                    // mayDestAddr == 5 in ReadRegister
                    // mayBaseTable have 0x100 elements?
                    int increment = 3;
                    prevtimer0value += increment;
                    if (prevtimer0value >= 0xFFu) {
                        prevtimer0value = 0;
                        Turnoff2HzNMIMaskAddIRQFlag();
                    }
                }
            }
            

            //if (timer0started) {
            //    fixedram0000[io02_timer0_val] = fixedram0000[io02_timer0_val] + 1;
            //}
            //if (timer1started) {
            //    fixedram0000[io03_timer1_val] = fixedram0000[io03_timer1_val] + 1;
            //}

            // TODO: dynamic re-measure
            if (measured == false && totalcycle % spdc1016freq < 10 && totalcycle > spdc1016freq) {
                measured = true;
#if 0
                // fixed rate on device
                // realworld time = 106
#ifdef HANDYPSP
                batchlimiter = spdc1016freq / 88; // 12*10=120ms
#else
                batchlimiter = spdc1016freq / 4;
#endif
                batchcount = batchlimiter;
#else
                if (totalcycle < spdc1016freq * 2) {
                    // first loop check!
                    // spdc1016 executed one second in fullspeed virtual timeline
                    unsigned long long realworldtime = GetTickCount() - lastTicket; // should less than 1000ms
                    lastTicket = GetTickCount();
                    //double virtual100ms = realworldtime / 100.0;
                    qDebug("realworldtime:%llu", realworldtime);
                    fprintf(stderr, "realworldtime:%llu\n", realworldtime);
                    if (realworldtime > 1000) {
                        // TODO: device may slower than simulator
                        // in my test iPad I get 3528/3779/3630 msec to finish one sdpc1016freq loop
                        // we should make screen refresh at least twice per real world second or screen will never been updated
                        // 1000->500 2000->250 4000->125
                        batchlimiter = 500 * spdc1016freq / realworldtime;
                        if (remeasure) {
                            qDebug("remeasure on batchlimiter: %u", batchlimiter);
                            fprintf(stderr, "remeasure on batchlimiter: %u\n", batchlimiter);
                            measured = false;
                            totalcycle = 0;
                            remeasure--;
                        }
                        batchcount = batchlimiter;
                    } else if (batchlimiter == 0) {
                        // 1000 - realworldtime = overflow time, overflow time / 10 = sleepcount, freq / sleepcount = batchcount
                        //batchlimiter = spdc1016freq / ((1000 - realworldtime) / 10);
                        sleepcount = (1000 - realworldtime) / sleepgap;
                        batchlimiter = spdc1016freq * sleepgap / (1000 - realworldtime);
                    } else {
                        // wrong path?
                        // sleep(0) is less than 10ms, but we'd never go here
                    }
                    batchcount = batchlimiter;
                } else {
                    // totalcycle > spdc1016freq * 2
                    // TODO:  check once more
                }
#endif // TARGET_IPHONE_SIMULATOR
            } // measured == false && totalcycle % spdc1016freq < 10 && totalcycle > spdc1016freq 
            if (totalcycle % spdc1016freq > 10 && totalcycle > spdc1016freq) {
                // FIXME: bug on slow device
                //measured = false;
            }

            if (batchlimiter != 0) {
                batchcount -= CpuTicks;
            }

            //usleep(10);
            //Sleep(0);
        }

        if (memcmp(&fixedram0000[0x9C0], fLCDBuffer, 160*80/8) != 0) {
            memcpy(fLCDBuffer, &fixedram0000[0x9C0], 160*80/8);
            qDebug("lcdBufferChanged");
            fprintf(stderr, "lcdBufferChanged\n");
            emit lcdBufferChanged(new QByteArray((const char*)fLCDBuffer, 160*80/8));
        }

        Sleep(10); // SleepGap. 10ms = 10us
        if (batchlimiter > 0) {
            batchcount = batchlimiter;
        } else {
            batchcount = spdc1016freq * 2; // dirty fix
        }
    }
    //this->deleteLater();
}

void EmulatorThread::StopKeeping()
{
    fKeeping = false;
}

#ifdef AUTOTEST
void EmulatorThread::TryTest( unsigned line )
{
    // Network
    if (line == 1024000) {
        keypadmatrix[1][6] = 1;
        CheckLCDOffShift0HotkeyAndEnableWatchDog();
    }
    if (line == 1064000) {
        keypadmatrix[1][6] = 0;
        CheckLCDOffShift0HotkeyAndEnableWatchDog();
    }
    // Down
    if (line == 1224000) {
        keypadmatrix[6][3] = 1;
        CheckLCDOffShift0HotkeyAndEnableWatchDog();
    }
    if (line == 1264000) {
        keypadmatrix[6][3] = 0;
        CheckLCDOffShift0HotkeyAndEnableWatchDog();
    }
    // Enter
    if (line == 1424000) {
        keypadmatrix[6][5] = 1;
        CheckLCDOffShift0HotkeyAndEnableWatchDog();
        enablelogging = true;
    }
    if (line == 1524000) {
        keypadmatrix[6][5] = 0;
        CheckLCDOffShift0HotkeyAndEnableWatchDog();
    }
    // Splash
    if (line == 4724000) {
        keypadmatrix[6][5] = 1;
        CheckLCDOffShift0HotkeyAndEnableWatchDog();
    }
    if (line == 4764000) {
        keypadmatrix[6][5] = 0;
        CheckLCDOffShift0HotkeyAndEnableWatchDog();
    }

}
#endif

void CheckLCDOffShift0HotkeyAndEnableWatchDog()
{
    //// may check hotkey press
    //if ( gLcdoffShift0Flag )
    //{
    //    if ( keypadmatrix1[6] || keypadmatrix1[7] )
    //    {
    //        // Line6 Dict Card
    //        // Line7 on/off
    //        EnableWatchDogFlag();               // 0x80
    //        gLcdoffShift0Flag = 0;
    //    }
    //}
    //else
    //{
    //    // Set lcdoffshift0flag only when keypadmatrix3 == 0xFB
    //    if ( keypadmatrix1[7] == 0xFBu )
    //        gLcdoffShift0Flag = 1;
    //}
    matrixupdated = true;
    if (lcdoffshift0flag) {
        // we don't have invert bit for row6,7
        //bool row67down = false;
        for (int y = 0; y < 2; y++) {
            for (int x = 0; x < 8; x++) {
                if (keypadmatrix[y][x] == 1) {
                    //row6,7down = true;
                    EnableWatchDogFlag();
                    lcdoffshift0flag = false;
                    return;
                }
            }
        }
    } else {
        if (keypadmatrix[0][2] == 1) {
            lcdoffshift0flag = true; // this flag is used for UI? (IO05_ClockControl)
        }
    }
}
Exemplo n.º 9
0
static bool send_size(int fd, size_t size)
{
    uint32_t size32 = ntohl(size);
    ssize_t send_rc = send(fd, PS(size32), 0);
    return send_rc == sizeof size32;
}
Exemplo n.º 10
0
CString CGenericProcessingMachine::DefaultConfigurationName(void)
{
    return ChangeFileExt(ExtractFileName(PS().Parameter(0)),".cfg");
}
Exemplo n.º 11
0
inline static void histogram_helper_cs_RAW_helper_process_pixel_float(
    const dt_dev_histogram_collection_params_t *const histogram_params, const float *pixel, uint32_t *histogram)
{
  const uint32_t i = PS(*pixel, histogram_params);
  histogram[4 * i]++;
}
Exemplo n.º 12
0
void CGenericProcessingMachine::Initialize(const CParameterString& Parameters)
{
    PS().SetParameters(Parameters);
    Initialize();
}
Exemplo n.º 13
0
void CGenericProcessingMachine::Initialize(int argc, char * argv[])
{
    PS().SetParameters(argc,argv);
    Initialize();
}
Exemplo n.º 14
0
Arquivo: RT0.c Projeto: AlexIljin/oo2c
void OOC_RT0_init() {
#ifdef USE_BOEHM_GC
    GC_all_interior_pointers = 0;
    GC_INIT();
    /* tell GC to accept pointers with an offset of 8/16/24 as references to
       a given object; this is necessary if the GC is running with the
       ALL_INTERIOR_POINTERS option; the offsets cover records and open
       arrays with up to 5 free dimensions on 32 bit architectures */
    GC_REGISTER_DISPLACEMENT(8);
    GC_REGISTER_DISPLACEMENT(16);
    GC_REGISTER_DISPLACEMENT(24);
#endif

    modules = RT0__NewBlock(sizeModules*sizeof(RT0__Module));

    PS(RT0__boolean  , "BOOLEAN",  RT0__strBoolean  , sizeof(OOC_BOOLEAN));
    PS(RT0__char     , "CHAR",     RT0__strChar     , sizeof(OOC_CHAR8));
    PS(RT0__longchar , "LONGCHAR", RT0__strLongchar , sizeof(OOC_CHAR16));
    PS(RT0__ucs4char , "UCS4CHAR", RT0__strUCS4Char , sizeof(OOC_CHAR32));
    PS(RT0__shortint , "SHORTINT", RT0__strShortint , sizeof(OOC_INT8));
    PS(RT0__integer  , "INTEGER",  RT0__strInteger  , sizeof(OOC_INT16));
    PS(RT0__longint  , "LONGINT",  RT0__strLongint  , sizeof(OOC_INT32));
    PS(RT0__real     , "REAL",     RT0__strReal     , sizeof(OOC_REAL32));
    PS(RT0__longreal , "LONGREAL", RT0__strLongreal , sizeof(OOC_REAL64));
    PS(RT0__set32    , "SET",      RT0__strSet32    , sizeof(OOC_UINT32));
    PS(RT0__byte     , "BYTE",     RT0__strByte     , sizeof(OOC_BYTE));
    PS(RT0__ptr      , "PTR",      RT0__strPtr      , sizeof(OOC_PTR));
    PS(RT0__procedure, "$PROC",    RT0__strProcedure, sizeof(OOC_PTR));
}
Exemplo n.º 15
0
bool CProcessingMachine::Configure(const CString& FileName)
{
 CGenericProcessingMachine::Configure(""/*FileName*/);
 if (DoShowHelp())
 {
  DisplayHelpMessage();
  return false;
 }
 if (BeVerbose())
 {
  std::cout<<"Command line parameters:"<<std::endl;
  PSC().Print(std::cout);
 }
 if (PSC().VarDefined("--version"))
 {
  std::cout<<"cbp2make rev."<<REVISION_NUMBER<<std::endl;
  return false;
 }
#ifdef REVISION_NUMBER
 if (!BeQuiet()) std::cout<<"Starting cbp2make rev."<<REVISION_NUMBER<<"..."<<std::endl;
#endif
 m_BuildManager.Config().BeQuiet() = BeQuiet();
 m_BuildManager.Config().BeVerbose() = BeVerbose();
 CString cfg_name = ConfigurationName();
 // Lookup configuration file
 // 1) if "-cfg" option is specified, use it as-is
 // 2) if "-cfg" option is not specified do following:
 // 2A) use default configuration in current directory
 //     if it exists or "--local" option is specified.
 // 2B) find and/or create configuration in user's home directory,
 //     if it is not possible, fallback to current directory.
 if (!PSC().VarDefined(GPM_VAR_NAME_CFG) &&
     ((!FileExists(cfg_name) && !PSC().VarDefined("--local")) ||
      PSC().VarDefined("--global")))
 {
  CString cfg_path = JoinPaths(HomeDirPath(),".cbp2make");
  if (!DirExists(cfg_path))
  {
   MakeDir(cfg_path);
  }
  if (DirExists(cfg_path))
  {
   cfg_name = JoinPaths(cfg_path,DefaultConfigurationName());
  }
 }
 if (FileExists(cfg_name))
 {
  if (!BeQuiet()) std::cout<<"Using configuration: "<<cfg_name.GetCString()<<std::endl;
  m_BuildManager.Config().Load(cfg_name);
  m_BuildManager.Config().BeQuiet() = BeQuiet();
  m_BuildManager.Config().BeVerbose() = BeVerbose();
 }
 else
 {
  if (!BeQuiet()) std::cout<<"Using default configuration."<<std::endl;
  m_BuildManager.Config().Platforms().AddDefault();
  m_BuildManager.Config().ToolChains().AddDefault();
  //do not create configuration file unless explicitly instructed to do so
  //m_BuildManager.Config().Save(cfg_name);
 }
 if (PSC().VarDefined("--default-options"))
 {
  m_BuildManager.Config().DefaultOptions() = PSC().VarNamed("--default-options").GetString();
 }
 if (!m_BuildManager.Config().DefaultOptions().IsEmpty())
 {
  PS().AddParameters(m_BuildManager.Config().DefaultOptions());
  PSC().ProcessParameters(PS());
  CGenericProcessingMachine::Configure("");
  m_BuildManager.Config().BeQuiet() = BeQuiet();
  m_BuildManager.Config().BeVerbose() = BeVerbose();
 }
 // cache frequently used variables
 bool os_unix = PSC().VarDefined("-unix");
 bool os_windows = PSC().VarDefined("-windows");
 bool os_mac = PSC().VarDefined("-mac");
 CPlatform::OS_Type os_type = CPlatform::OS_Unix;
 if (os_unix) os_type = CPlatform::OS_Unix;
 else if (os_windows) os_type = CPlatform::OS_Windows;
 else if (os_mac) os_type = CPlatform::OS_Mac;
 bool os_any = os_unix || os_windows || os_mac;
 // configure
 m_BuildManager.Config().Platforms().AddDefault();
 if (PSC().VarDefined("--config"))
 {
  CString config_item_str = PSC().VarNamed("--config").GetString();
  int config_item = GuessStr(config_item_str,"toolchain tool platform variable options",
                             config_item_str,true);
  if (0==config_item)
  {
   CString chain_name = PSC().VarNamed("-chain").GetString();
   if (PSC().VarDefined("--add"))
   {
    if (PSC().VarDefined("-chain"))
    {
     CToolChain *tc = m_BuildManager.ToolChains().Find(os_type,chain_name);
     if (0==tc)
     {
      tc = m_BuildManager.ToolChains().Add(os_type,chain_name);
     }
     if (0==tc) return false;
     ConfigureToolchain(tc);
    }
   } // add-toolchain
   else if (PSC().VarDefined("--remove")&&PSC().VarDefined("-chain")&&os_any)
   {
    m_BuildManager.ToolChains().Remove(os_type,chain_name);
   }
  }
  if (1==config_item)
  {
   CString chain_name = PSC().VarNamed("-chain").GetString();
   if (PSC().VarDefined("--add"))
   {
    if (PSC().VarDefined("-chain"))
    {
     CToolChain *tc = m_BuildManager.ToolChains().Find(os_type,chain_name);
     if (0==tc)
     {
      tc = m_BuildManager.ToolChains().Add(os_type,chain_name);
     }
     if (0==tc) return false;
     if (PSC().VarDefined("-tool")&&PSC().VarDefined("-type"))
     {
      CString tool_type_str = PSC().VarNamed("-type").GetString();
      int tool_type_int = GuessStr(tool_type_str,"other pp as cc rc sl dl el nl count",
                                   tool_type_str,false);
      CBuildTool::ToolType tool_type = (CBuildTool::ToolType)tool_type_int;
      CString tool_name = PSC().VarNamed("-tool").GetString();
      CBuildTool *bt = tc->FindBuildToolByName(tool_name);
      if (0==bt)
      {
       bt = tc->CreateBuildTool(tool_type);
       bt->Alias() = tool_name;
      }
      if (0==bt) return false;
      ConfigureBuildTool(bt);
     }
    }
   } // add-tool
   else if (PSC().VarDefined("--remove")&&PSC().VarDefined("-chain")&&PSC().VarDefined("-tool")&&os_any)
   {
    CToolChain *tc = m_BuildManager.ToolChains().Find(os_type,chain_name);
    if (0!=tc)
    {
     return tc->RemoveToolByName(PSC().VarNamed("-tool").GetString());
    }
   }
  }
  if (2==config_item)
  {
   if (os_any)
   {
    CPlatform *p = m_BuildManager.Platforms().Find(os_type);
    if (0==p) return false;
    ConfigurePlatform(p);
   }
  }
  if (3==config_item)
  {
   if (PSC().VarDefined("--add"))
   {
    CString set_name = PSC().VarNamed("-set").GetString();
    if (PSC().VarDefined("-name") && PSC().VarDefined("-value"))
    {
     CString var_name = PSC().VarNamed("-name").GetString();
     CGlobalVariableSet *vset = m_BuildManager.Config().GlobalVariables().Add(set_name);
     CGlobalVariable *var = vset->Add(var_name);
     if (PSC().VarDefined("-desc"))
     {
      var->Description() = PSC().VarNamed("-desc").GetString();
     }
     if (PSC().VarDefined("-value"))
     {
      var->Add(PSC().VarNamed("-field").GetString(),
               PSC().VarNamed("-value").GetString());
     }
    }
   } // add variable
   else if (PSC().VarDefined("--remove"))
   {
    CString set_name = PSC().VarNamed("-set").GetString();
    if (PSC().VarDefined("-name"))
    {
     CString var_name = PSC().VarNamed("-name").GetString();
     CGlobalVariableSet *vset = m_BuildManager.Config().GlobalVariables().Add(set_name);
     CGlobalVariable *var = vset->Add(var_name);
     if (PSC().VarDefined("-field"))
     {
      // if both variable and field names are defined, remove the field
      var->Remove(PSC().VarNamed("-field").GetString());
     }
     else
     {
      // if variable name is defined, but field name is not, remove the variable
      vset->Remove(var_name);
     }
    }
    else
    {
     // if both variable and field names are not defined,
     // but set name is defined, remove the entire set
     if (PSC().VarDefined("-set"))
     {
      m_BuildManager.Config().GlobalVariables().Remove(set_name);
     }
    }
   } // remove variable
  } // config variable
  if (config_item < 0) m_BuildManager.Config().Show();
  std::cout<<"Saving configuration: "<<cfg_name.GetCString()<<std::endl;
  m_BuildManager.Config().Save(cfg_name);
  return false;
 } // config
 //
 bool os_all = PSC().VarDefined("--all-os");
      os_all = os_all || (os_unix && os_windows && os_mac);
      os_unix = os_unix || os_all;
      os_windows = os_windows || os_all;
      os_mac = os_mac || os_all;
 bool os_none = !os_all && !os_unix && !os_windows && !os_mac;
 if (os_none)
 {
#ifdef OS_UNIX
  os_unix = true;
#endif
#ifdef OS_WIN
  os_windows = true;
#endif
#ifdef OS_MAC
  os_mac = true;
#endif
 }
 if (os_unix)
 {
  CPlatform *p = m_BuildManager.Config().Platforms().Find(CPlatform::OS_Unix);
  if (p) p->Active() = true;
 }
 if (os_windows)
 {
  CPlatform *p = m_BuildManager.Config().Platforms().Find(CPlatform::OS_Windows);
  if (p) p->Active() = true;
 }
 if (os_mac)
 {
  CPlatform *p = m_BuildManager.Config().Platforms().Find(CPlatform::OS_Mac);
  if (p) p->Active() = true;
 }
 //
 {
  CString vset_name = PSC().VarNamed("-set").GetString();
  CGlobalVariableSet *vset = m_BuildManager.Config().GlobalVariables().Find(vset_name);
  if (0!=vset)
  {
   vset->Active() = true;
  }
 }
 m_BuildManager.Config().FlatObjectNames() = PSC().VarDefined("--flat-objects");
 m_BuildManager.Config().FlatObjectPaths() = PSC().VarDefined("--flat-objpath");
 m_BuildManager.Config().MultilineObjects() = PSC().VarDefined("--wrap-objects");
 m_BuildManager.Config().MultilineOptions() = PSC().VarDefined("--wrap-options");
 m_BuildManager.Config().IncludeDependencies() = PSC().VarDefined("--with-deps");
 {
  CString target_case_name = PSC().VarNamed("--target-case").GetString();
  m_BuildManager.Config().TargetNameCase() =
   GuessStr(target_case_name,"keep lower upper",target_case_name,false);
 }
 {
  CString macros_case_name = PSC().VarNamed("--macros-case").GetString();
  m_BuildManager.Config().MacroVariableCase() =
   GuessStr(macros_case_name,"keep lower upper",macros_case_name,false);
 }
 {
  CString quote_path_name = PSC().VarNamed("--quote-path").GetString();
  m_BuildManager.Config().QuotePathMode() =
   GuessStr(quote_path_name,"auto never always",quote_path_name,false);
 }
 m_BuildManager.Config().KeepObjectDirectories() = PSC().VarDefined("--keep-objdir");
 m_BuildManager.Config().KeepOutputDirectories() = PSC().VarDefined("--keep-outdir");
 {
  CStringList targets;
  ParseStr(PSC().VarNamed("-targets").GetString(),',',targets);
  targets.RemoveEmpty();
  targets.RemoveDuplicates();
  m_BuildManager.Config().Targets() = targets;
 }
 //if (BeVerbose()) PSC().Print(std::cout);
 return true;
}
Exemplo n.º 16
0
int main(int argc, char *argv[])
{
    //set the variables
    int Select = 0;
    bool INTERACTIVE = false;
    bool test = false;
    SIMULATION* SIMINFO;
    FILE *DATA;
    if(argc !=5)
    {
        printf("+===================================+\n");
        printf("|              ProcSim              |\n");
        printf("|===================================|\n");
        printf("|  What type of simulation?         |\n");
        printf("|----+------------------------------|\n");
        printf("|  1 |  First Come First Server     |\n");
        printf("|  2 |  Shortest Job First          |\n");
        printf("|  3 |  Shortest Job Remaining      |\n");
        printf("|  4 |  Round-Robin                 |\n");
        printf("|  5 |  Priority                    |\n");
        printf("|----|--Multi-level Feedback Queue  |\n");
        printf("+----+------------------------------+\n\n\n\n");
        printf("ProcSim <Input File> <Num of Processes> <Snapshot Time Interval> <Select>\n");
        return -1;
    }

    if ((DATA=fopen(argv[1],"rt")) == NULL)
    {
        printf("Sorry Could not find the File\nIt might have ran away from you!\nmake sure it is in the same directory as me(Program)\n");
        printf("I am going to skip the inputing from a file");
        exit(0);
    }

    Select = atoi(argv[4]);

//setup the Data
    SIMINFO= (SIMULATION*) malloc (sizeof (SIMULATION));
    SIMINFO->IOProc = 0;
    SIMINFO->RQProc = 0;
    SIMINFO->Time = 0;
    SIMINFO->CPU_Idle = 0;
    SIMINFO->IOJFinished = -1;//indicate no jobs finished
    SIMINFO->TotalProc = atoi(argv[2]);
    SIMINFO->TimeInterval = atoi(argv[3]);
    SIMINFO->PCheck = false;

    sprintf(SIMINFO->SeqOfProc, ":");
    PROCESS Proc[SIMINFO->TotalProc];
    SIMINFO->RQProc = InputFromFile(Proc,DATA);
    SIMINFO->IOProc = 0;
    //ListProcess(Proc,SIMINFO);

//just uncomment what function you need

if(Select == 1)
{
    FCFS(Proc, SIMINFO);
}
if(Select == 2)
{
    SJF(Proc, SIMINFO);
}
if(Select == 3)
{
    SJR(Proc, SIMINFO);
}
if(Select == 4)
{
    RR(Proc, SIMINFO);
}
if(Select == 5)
{
    PS(Proc,SIMINFO);
}
if(Select == 6)
{
    //Not Implemented
}


    if(test == true)
    {
        //Array_test(DATA,total);
    }

    //Interactive Mode
    if(INTERACTIVE == true)
    {
        //main menu for the ProSim functions
        printf("+===================================+\n");
        printf("|              ProcSim              |\n");
        printf("|===================================|\n");
        printf("|  What type of simulation?         |\n");
        printf("|----+------------------------------|\n");
        printf("|  1 |  First Come First Server     |\n");
        printf("|  2 |  Shortest Job First          |\n");
        printf("|  3 |  Shortest Job Remaining      |\n");
        printf("|  4 |  Round-Robin                 |\n");
        printf("|  5 |  Priority                    |\n");
        printf("|  6 |  Multi-level Feedback Queue  |\n");
        printf("|  x |  Exit the program            |\n");
        printf("+----+------------------------------+\n");

    }

    return 0;
}
Exemplo n.º 17
0
bool await_go(void)
{
    char buf[2];
    ssize_t rc = recv(assert_connection(), PS(buf), 0);
    return 2 == rc && !memcmp("GO", PS(buf));
}
Exemplo n.º 18
0
void pr_inputrec(FILE *fp,int indent,const char *title,t_inputrec *ir,
		 bool bMDPformat)

{
  char *infbuf="inf";
  
  if (available(fp,ir,indent,title)) {
    if (!bMDPformat)
      indent=pr_title(fp,indent,title);
    PS("integrator",EI(ir->eI));
    PI("nsteps",ir->nsteps);
    PI("init_step",ir->init_step);
    PS("ns_type",ENS(ir->ns_type));
    PI("nstlist",ir->nstlist);
    PI("ndelta",ir->ndelta);
    PI("nstcomm",ir->nstcomm);
    PS("comm_mode",ECOM(ir->comm_mode));
    PI("nstlog",ir->nstlog);
    PI("nstxout",ir->nstxout);
    PI("nstvout",ir->nstvout);
    PI("nstfout",ir->nstfout);
    PI("nstenergy",ir->nstenergy);
    PI("nstxtcout",ir->nstxtcout);
    PR("init_t",ir->init_t);
    PR("delta_t",ir->delta_t);
    PR("xtcprec",ir->xtcprec);
    PI("nkx",ir->nkx);
    PI("nky",ir->nky);
    PI("nkz",ir->nkz);
    PI("pme_order",ir->pme_order);
    PR("ewald_rtol",ir->ewald_rtol);
    PR("ewald_geometry",ir->ewald_geometry);
    PR("epsilon_surface",ir->epsilon_surface);
    PS("optimize_fft",BOOL(ir->bOptFFT));
    PS("ePBC",EPBC(ir->ePBC));
    PS("bPeriodicMols",BOOL(ir->bPeriodicMols));
    PS("bContinuation",BOOL(ir->bContinuation));
    PS("bShakeSOR",BOOL(ir->bShakeSOR));
    PS("etc",ETCOUPLTYPE(ir->etc));
    PS("epc",EPCOUPLTYPE(ir->epc));
    PS("epctype",EPCOUPLTYPETYPE(ir->epct));
    PR("tau_p",ir->tau_p);
    pr_matrix(fp,indent,"ref_p",ir->ref_p,bMDPformat);
    pr_matrix(fp,indent,"compress",ir->compress,bMDPformat);
    PS("refcoord_scaling",EREFSCALINGTYPE(ir->refcoord_scaling));
    if (bMDPformat)
      fprintf(fp,"posres_com  = %g %g %g\n",ir->posres_com[XX],
	      ir->posres_com[YY],ir->posres_com[ZZ]);
    else
      pr_rvec(fp,indent,"posres_com",ir->posres_com,DIM,TRUE);
    if (bMDPformat)
      fprintf(fp,"posres_comB = %g %g %g\n",ir->posres_comB[XX],
	      ir->posres_comB[YY],ir->posres_comB[ZZ]);
    else
      pr_rvec(fp,indent,"posres_comB",ir->posres_comB,DIM,TRUE);
    PI("andersen_seed",ir->andersen_seed);
    PR("rlist",ir->rlist);
    PR("rtpi",ir->rtpi);
    PS("coulombtype",EELTYPE(ir->coulombtype));
    PR("rcoulomb_switch",ir->rcoulomb_switch);
    PR("rcoulomb",ir->rcoulomb);
    PS("vdwtype",EVDWTYPE(ir->vdwtype));
    PR("rvdw_switch",ir->rvdw_switch);
    PR("rvdw",ir->rvdw);
    if (ir->epsilon_r != 0)
      PR("epsilon_r",ir->epsilon_r);
    else
      PS("epsilon_r",infbuf);
    if (ir->epsilon_rf != 0)
      PR("epsilon_rf",ir->epsilon_rf);
    else
      PS("epsilon_rf",infbuf);
    PR("tabext",ir->tabext);
    PS("implicit_solvent",EIMPLICITSOL(ir->implicit_solvent));
    PS("gb_algorithm",EGBALGORITHM(ir->gb_algorithm));
    PR("gb_epsilon_solvent",ir->gb_epsilon_solvent);
    PI("nstgbradii",ir->nstgbradii);
    PR("rgbradii",ir->rgbradii);
    PR("gb_saltconc",ir->gb_saltconc);
    PR("gb_obc_alpha",ir->gb_obc_alpha);
    PR("gb_obc_beta",ir->gb_obc_beta);
    PR("gb_obc_gamma",ir->gb_obc_gamma);
    PR("sa_surface_tension",ir->sa_surface_tension);
	  
    PS("DispCorr",EDISPCORR(ir->eDispCorr));
    PS("free_energy",EFEPTYPE(ir->efep));
    PR("init_lambda",ir->init_lambda);
    PR("sc_alpha",ir->sc_alpha);
    PI("sc_power",ir->sc_power);
    PR("sc_sigma",ir->sc_sigma);
    PR("delta_lambda",ir->delta_lambda);
    
    PI("nwall",ir->nwall);
    PS("wall_type",EWALLTYPE(ir->wall_type));
    PI("wall_atomtype[0]",ir->wall_atomtype[0]);
    PI("wall_atomtype[1]",ir->wall_atomtype[1]);
    PR("wall_density[0]",ir->wall_density[0]);
    PR("wall_density[1]",ir->wall_density[1]);
    PR("wall_ewald_zfac",ir->wall_ewald_zfac);

    PS("pull",EPULLTYPE(ir->ePull));
    if (ir->ePull != epullNO)
      pr_pull(fp,indent,ir->pull);

    PS("disre",EDISRETYPE(ir->eDisre));
    PS("disre_weighting",EDISREWEIGHTING(ir->eDisreWeighting));
    PS("disre_mixed",BOOL(ir->bDisreMixed));
    PR("dr_fc",ir->dr_fc);
    PR("dr_tau",ir->dr_tau);
    PR("nstdisreout",ir->nstdisreout);
    PR("orires_fc",ir->orires_fc);
    PR("orires_tau",ir->orires_tau);
    PR("nstorireout",ir->nstorireout);

    PR("dihre-fc",ir->dihre_fc);
    
    PR("em_stepsize",ir->em_stepsize);
    PR("em_tol",ir->em_tol);
    PI("niter",ir->niter);
    PR("fc_stepsize",ir->fc_stepsize);
    PI("nstcgsteep",ir->nstcgsteep);
    PI("nbfgscorr",ir->nbfgscorr);

    PS("ConstAlg",ECONSTRTYPE(ir->eConstrAlg));
    PR("shake_tol",ir->shake_tol);
    PI("lincs_order",ir->nProjOrder);
    PR("lincs_warnangle",ir->LincsWarnAngle);
    PI("lincs_iter",ir->nLincsIter);
    PR("bd_fric",ir->bd_fric);
    PI("ld_seed",ir->ld_seed);
    PR("cos_accel",ir->cos_accel);
    pr_matrix(fp,indent,"deform",ir->deform,bMDPformat);
    PI("userint1",ir->userint1);
    PI("userint2",ir->userint2);
    PI("userint3",ir->userint3);
    PI("userint4",ir->userint4);
    PR("userreal1",ir->userreal1);
    PR("userreal2",ir->userreal2);
    PR("userreal3",ir->userreal3);
    PR("userreal4",ir->userreal4);
    pr_grp_opts(fp,indent,"grpopts",&(ir->opts),bMDPformat);
    pr_cosine(fp,indent,"efield-x",&(ir->ex[XX]),bMDPformat);
    pr_cosine(fp,indent,"efield-xt",&(ir->et[XX]),bMDPformat);
    pr_cosine(fp,indent,"efield-y",&(ir->ex[YY]),bMDPformat);
    pr_cosine(fp,indent,"efield-yt",&(ir->et[YY]),bMDPformat);
    pr_cosine(fp,indent,"efield-z",&(ir->ex[ZZ]),bMDPformat);
    pr_cosine(fp,indent,"efield-zt",&(ir->et[ZZ]),bMDPformat);
    PS("bQMMM",BOOL(ir->bQMMM));
    PI("QMconstraints",ir->QMconstraints);
    PI("QMMMscheme",ir->QMMMscheme);
    PR("scalefactor",ir->scalefactor);
    pr_qm_opts(fp,indent,"qm_opts",&(ir->opts));
  }
}
Exemplo n.º 19
0
PackGUI::PackGUI(QString defaultName, QString defaultPath, int noOfFiles, QString filename) :
        PackGUIBase(0)
{
    // first, fill the WhatToPack textfield with information
    if (noOfFiles == 1)
        TextLabel1->setText(i18n("Pack %1", filename));
    else
        TextLabel1->setText(i18np("Pack %1 file", "Pack %1 files", noOfFiles));

    // now, according to the Konfigurator, fill the combobox with the information
    // about what kind of packing we can do
    KConfigGroup group(krConfig, "Archives");
    QStringList lst = group.readEntry("Supported Packers", QStringList());
    // now, clear the type combo and begin...
    typeData->clear();
    if (PS("tar")) typeData->addItem("tar");
    if (PS("tar") && PS("gzip")) typeData->addItem("tar.gz");
    if (PS("tar") && PS("bzip2")) typeData->addItem("tar.bz2");
    if (PS("tar") && PS("lzma")) typeData->addItem("tar.lzma");
    if (PS("tar") && PS("xz")) typeData->addItem("tar.xz");
    if (PS("zip")) typeData->addItem("zip");
    if (PS("zip")) typeData->addItem("cbz");
    if (PS("rar")) typeData->addItem("rar");
    if (PS("rar")) typeData->addItem("cbr");
    if (PS("lha")) typeData->addItem("lha");
    if (PS("arj")) typeData->addItem("arj");
    if (PS("7z")) typeData->addItem("7z");
    // set the last used packer as the top one
    QString tmp = group.readEntry("lastUsedPacker", QString());
    if (!tmp.isEmpty()) {
        for (int i = 0; i < typeData->count(); ++i)
            if (typeData->itemText(i) == tmp) {
                typeData->removeItem(i);
                typeData->insertItem(0, tmp);
                typeData->setCurrentIndex(0);
                break;
            }
    }
    checkConsistency();

    queue = false;

    // and go on with the normal stuff
    dirData->setText(defaultPath);
    nameData->setText(defaultName);
    nameData->setFocus();
    if (typeData->count() == 0) // if no packers are available
        okButton->setEnabled(false);
    setGeometry(krMainWindow->x() + krMainWindow->width() / 2 - width() / 2, krMainWindow->y() + krMainWindow->height() / 2 - height() / 2, width(), height());
    exec();
}
Exemplo n.º 20
0
u08 ve_update(void )  // do we need param?
{

  COORD mds;   
  u08   cmd;

 
  if (vePort == -1) { // LCD GUI

     MENU_CONTROLS 
  
     menu_exitbutton();

     mds = (CHAR_WIDTH*BUTTON_SIZE) + ButtonBorder + ButtonRowSpacing;   //!!! ButtonBorder*2
     #ifdef RES_128x64
       menu_label    (0,0,PS("Var Editor"));
       menu_buttonrow(5,XROWS-(CHAR_HEIGHT+6),  PS("G \xAE\xAF #WR"));
       menu_button   (5+mds*6,XROWS-CHAR_HEIGHT*4+2, PS("+"),'+');
       menu_button   (5+mds*7,XROWS-CHAR_HEIGHT*4+2, PS("-"),'-');
     #else
       menu_label    (0,0,PS("Variable Editor"));
       menu_buttonrow(5,XROWS-(CHAR_HEIGHT+6),  PS("G \xAE\xAF  # WR"));
       menu_button   (5+mds*8,XROWS-CHAR_HEIGHT*4-6, PS("+"),'+');
       menu_button   (5+mds*9,XROWS-CHAR_HEIGHT*4-6, PS("-"),'-');
     #endif

     
      varedit_slider();

      if(MenuDraw) ve_setflag (veDO_REFRESH);  // if MenuDraw (set by menu_init) then screen was cleared and controls just
                                            // redrawn, so redraw current variable
 
      MENU_COMMANDS  

          cmd = menu_cmd();

   } else  // Serial Console
   {  
      MenuCmd = 0; // make sure disabled

      cmd = 0;        
   
      switch (vePort) { 
        case 0 : if (rx_haschar()) {cmd = rx_getchar(); beep(20,1000); }
                         break;

            case 1 : if (rx1_haschar()) {cmd = rx1_getchar(); beep(20,1000); }
                         break;
      }
           
          if ((cmd>='a') && (cmd<='z')) cmd -=32; // shift to uppercase 
         

      // handle numeric entry using local buffer

          if ((cmd>='0') && (cmd<='9') && (veBufIndex < VE_BUF_SIZE))
          {
             veBuf[veBufIndex++] = cmd;
                 printf("%c",cmd);  // echo character
                 cmd = 0;           // prevent refresh  (display of group / var)
      }
          
      // handle backspace

      if ((cmd ==8) && (veBufIndex>0)) {
              veBufIndex--;
                  printf("%c",cmd); 
                  cmd = 0;   // prevent refresh
      }
                  
      
      if (cmd==13) {
            veStoreSerialBuffer=1;   
            // leave cmd alone to force refresh
      }
   
   }
   // menu button/control responses

  

   switch(cmd) {
      case 1   :  // slider 
         ve_setflag(veUPDATE_FROM_SLIDER);  // current var will set to slider value 
         break;                    // on next call to ve_process()

      // select next group
      case 'G' :  
         if(++veCurGroup>veGroupCount) veCurGroup=1;
                
         veCurVar = 1;
         veCurVal = MAXLONG;

         ve_setflag(veCOUNT_VARS);
         ve_process();
         ve_clrflag(veCOUNT_VARS);
         
       

         break;  // next group

   
      // select previous / next variable 
          // special arrow characters  0xAE  <-    0xAF  ->

      case '<':;  // greater than or ".' char (for Serial Console Support)
          case ',':;
      case 0xAE: if(veVarCount && (--veCurVar==0)) veCurVar=veVarCount;
                     break;  // prev variable

          case '>':;
          case '.':;
      case 0xAF: if(veVarCount && (++veCurVar>veVarCount)) veCurVar=1;  break;  // next variable

      case '=':;
      case '+': veDelta = ( 1); break;   // flag for inc/dec of current variable  

          case '_':;
      case '-': veDelta = (-1); break;

      case '#': ve_setflag(veCALL_INPUT_DIALOG); break;  // flag 

      case 'W':
          case 'R': ve_read_write(cmd,1);      // do 'R'-Read or 'W'-Write of vars from/to EEPROM
                    menu_init();
                                ve_setflag(veDO_REFRESH);
                                break;
      

      case 'X': MenuCmd = MENU_EXITCODE;  // Close Variable Editor  (Remote Serial Console)
                    printf (PS("Exit. Thank You for using Megadonkey Variable Editor\n"));
                                break;

   }

       
   if(ve_flag(veDO_REFRESH) || (((cmd!=0)||menu_cmd()) && (menu_cmd() != MENU_EXITCODE))) {

      if(ve_flag(veDO_REFRESH)) {
         ve_setflag(veCOUNT_VARS);  // do a variable count pass through list 
         ve_process();              // really this could be done one time with static defs
         ve_clrflag(veCOUNT_VARS);  // thinking toward dynamic list
         ve_clrflag(veDO_REFRESH); 
      }


      if (vePort==-1)  // output to LCD 
          {

         // if 'G' command erase group label and variable label
         // if not just erase variable label


         set_color(color ^ WHITE);
         if(menu_cmd() == 'G') {
            filled_box(0,CHAR_HEIGHT*3/2,XCOLS-1, CHAR_HEIGHT*3/2+CHAR_HEIGHT-1); 
         }
         #ifdef RES_128x64
           filled_box(0,CHAR_HEIGHT*3, XCOLS-1,CHAR_HEIGHT*4-1);
         #else
           filled_box(0,CHAR_HEIGHT*4, XCOLS-1,CHAR_HEIGHT*5-1);
         #endif
         set_color(color ^ WHITE);
          
          
         ve_process();      // update display of current var & update slider vals
               
         mds = MenuDraw;    // save MenuDraw state
         MenuDraw = 1;      // force redraw of slider
         varedit_slider();  
         MenuDraw = mds;    // restore MenuDraw state  
       }   
       else // Output to Serial Port
       {
          if (cmd != 0) ve_process(); // update display of current var : output to serial port

       }



   }  
                                       

   if ((menu_cmd() == MENU_EXITCODE) && (vePort != -1))
   { lcd_set_stdout();         // ASSUME LCD was connected to std out (maybe should have saved state)
     printf (PS("VE Exit"));
   }


             
   return (menu_cmd() != MENU_EXITCODE);  // return TRUE unless close [X] 

 
}
Exemplo n.º 21
0
Arquivo: msp430-dis.c Projeto: 5kg/gdb
static int
msp430_doubleoperand (disassemble_info *info,
		      struct msp430_opcode_s *opcode,
		      bfd_vma addr,
		      unsigned short insn,
		      char *op1,
		      char *op2,
		      char *comm1,
		      char *comm2,
		      unsigned short extension_word,
		      int *cycles)
{
  int regs = 0, regd = 0;
  int ad = 0, as = 0;
  int cmd_len = 2;
  int dst = 0;
  int fmt;
  int extended_dst = extension_word & 0xf;
  int extended_src = (extension_word >> 7) & 0xf;

  regd = insn & 0x0f;
  regs = (insn & 0x0f00) >> 8;
  as = (insn & 0x0030) >> 4;
  ad = (insn & 0x0080) >> 7;

  if (opcode->fmt < 0)
    fmt = (- opcode->fmt) - 1;
  else
    fmt = opcode->fmt;

  if (fmt == 0)
    {
      /* Special case: rla and rlc are the only 2 emulated instructions that
	 fall into two operand instructions.  */
      /* With dst, there are only:
	 Rm       	Register,
         x(Rm)     	Indexed,
         0xXXXX    	Relative,
         &0xXXXX    	Absolute 
         emulated_ins   dst
         basic_ins      dst, dst.  */

      if (regd != regs || as != ad)
	return 0;		/* May be 'data' section.  */

      if (ad == 0)
	{
	  /* Register mode.  */
	  if (regd == 3)
	    {
	      strcpy (comm1, _("Illegal as emulation instr"));
	      return -1;
	    }

	  sprintf (op1, "r%d", regd);
	  *cycles = 1;
	}
      else			/* ad == 1 */
	{
	  if (regd == 0)
	    {
	      /* PC relative, Symbolic.  */
	      dst = msp430dis_opcode (addr + 2, info);
	      cmd_len += 4;
	      *cycles = 6;
	      sprintf (op1, "0x%04x", PS (dst));
	      sprintf (comm1, "PC rel. 0x%04x",
		       PS ((short) addr + 2 + dst));
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  if (dst & 0x80000)
		    dst |= -1 << 20;
		  sprintf (op1, "0x%05x", dst & 0xfffff);
		  sprintf (comm1, "PC rel. 0x%05lx",
			   (long)((addr + 2 + dst) & 0xfffff));
		}
	    }
	  else if (regd == 2)
	    {
	      /* Absolute.  */
	      dst = msp430dis_opcode (addr + 2, info);
	      /* If the 'src' field is not the same as the dst
		 then this is not an rla instruction.  */
	      if (dst != msp430dis_opcode (addr + 4, info))
		return 0;
	      cmd_len += 4;
	      *cycles = 6;
	      sprintf (op1, "&0x%04x", PS (dst));
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  sprintf (op1, "&0x%05x", dst & 0xfffff);
		}
	    }
	  else
	    {
	      /* Indexed.  */
	      dst = msp430dis_opcode (addr + 2, info);
	      if (extended_dst)
		{
		  dst |= extended_dst << 16;
		  if (dst & 0x80000)
		    dst |= -1 << 20;
		}
	      else if (dst & 0x8000)
		dst |= -1 << 16;
	      cmd_len += 4;
	      *cycles = 6;
	      sprintf (op1, "%d(r%d)", dst, regd);
	      if (dst > 9 || dst < -9)
		sprintf (comm1, "#0x%05x", dst);
	    }
	}

      *op2 = 0;
      *comm2 = 0;

      return cmd_len;
    }

  /* Two operands exactly.  */
  if (ad == 0 && regd == 3)
    {
      /* R2/R3 are illegal as dest: may be data section.  */
      strcpy (comm1, _("Illegal as 2-op instr"));
      return -1;
    }

  /* Source.  */
  if (as == 0)
    {
      *cycles = 1;
      if (regs == 3)
	{
	  /* Constants.  */
	  sprintf (op1, "#0");
	  sprintf (comm1, "r3 As==00");
	}
      else
	{
	  /* Register.  */
	  sprintf (op1, "r%d", regs);
	}
    }
  else if (as == 2)
    {
      * cycles = print_as2_reg_name (regs, op1, comm1, 1, 1, regs == 0 ? 3 : 2);
    }
  else if (as == 3)
    {
      if (regs == 0)
	{
	  *cycles = 3;
	  /* Absolute. @pc+.  */
	  dst = msp430dis_opcode (addr + 2, info);
	  cmd_len += 2;
	  sprintf (op1, "#%d", dst);
	  if (dst > 9 || dst < 0)
	    sprintf (comm1, "#0x%04x", PS (dst));
	  if (extended_src)
	    {
	      dst |= extended_src << 16;
	      if (dst & 0x80000)
		dst |= -1 << 20;
	      sprintf (op1, "#%d", dst);
	      if (dst > 9 || dst < 0)
		sprintf (comm1, "0x%05x", dst & 0xfffff);
	    }
	}
      else
	* cycles = print_as3_reg_name (regs, op1, comm1, 1, 1, 2);
    }
  else if (as == 1)
    {
      if (regs == 0)
	{
	  *cycles = 4;
	  /* PC relative.  */
	  dst = msp430dis_opcode (addr + 2, info);
	  cmd_len += 2;
	  sprintf (op1, "0x%04x", PS (dst));
	  sprintf (comm1, "PC rel. 0x%04x",
		   PS ((short) addr + 2 + dst));
	  if (extended_src)
	    {
	      dst |= extended_src << 16;
	      if (dst & 0x80000)
		dst |= -1 << 20;
	      sprintf (op1, "0x%05x", dst & 0xfffff);
	      sprintf (comm1, "PC rel. 0x%05lx",
		       (long) ((addr + 2 + dst) & 0xfffff));
	    }
	}
      else if (regs == 2)
	{
	  *cycles = 2;
	  /* Absolute.  */
	  dst = msp430dis_opcode (addr + 2, info);
	  cmd_len += 2;
	  sprintf (op1, "&0x%04x", PS (dst));
	  sprintf (comm1, "0x%04x", PS (dst));
	  if (extended_src)
	    {
	      dst |= extended_src << 16;
	      sprintf (op1, "&0x%05x", dst & 0xfffff);
	      * comm1 = 0;
	    }
	}
      else if (regs == 3)
	{
	  *cycles = 1;
	  sprintf (op1, "#1");
	  sprintf (comm1, "r3 As==01");
	}
      else
	{
	  *cycles = 3;
	  /* Indexed.  */
	  dst = msp430dis_opcode (addr + 2, info);
	  cmd_len += 2;
	  if (extended_src)
	    {
	      dst |= extended_src << 16;
	      if (dst & 0x80000)
		dst |= -1 << 20;
	    }
	  else if (dst & 0x8000)
	    dst |= -1 << 16;
	  sprintf (op1, "%d(r%d)", dst, regs);
	  if (dst > 9 || dst < -9)
	    sprintf (comm1, "0x%05x", dst);
	}
    }

  /* Destination. Special care needed on addr + XXXX.  */

  if (ad == 0)
    {
      /* Register.  */
      if (regd == 0)
	{
	  *cycles += 1;
	  sprintf (op2, "r0");
	}
      else if (regd == 1)
	sprintf (op2, "r1");

      else if (regd == 2)
	sprintf (op2, "r2");

      else
	sprintf (op2, "r%d", regd);
    }
  else	/* ad == 1.  */
    {
      * cycles += 3;

      if (regd == 0)
	{
	  /* PC relative.  */
	  *cycles += 1;
	  dst = msp430dis_opcode (addr + cmd_len, info);
	  sprintf (op2, "0x%04x", PS (dst));
	  sprintf (comm2, "PC rel. 0x%04x",
		   PS ((short) addr + cmd_len + dst));
	  if (extended_dst)
	    {
	      dst |= extended_dst << 16;
	      if (dst & 0x80000)
		dst |= -1 << 20;
	      sprintf (op2, "0x%05x", dst & 0xfffff);
	      sprintf (comm2, "PC rel. 0x%05lx",
		       (long)((addr + cmd_len + dst) & 0xfffff));
	    }
	  cmd_len += 2;
	}
      else if (regd == 2)
	{
	  /* Absolute.  */
	  dst = msp430dis_opcode (addr + cmd_len, info);
	  cmd_len += 2;
	  sprintf (op2, "&0x%04x", PS (dst));
	  if (extended_dst)
	    {
	      dst |= extended_dst << 16;
	      sprintf (op2, "&0x%05x", dst & 0xfffff);
	    }
	}
      else
	{
	  dst = msp430dis_opcode (addr + cmd_len, info);
	  cmd_len += 2;
	  if (dst & 0x8000)
	    dst |= -1 << 16;
	  if (dst > 9 || dst < 0)
	    sprintf (comm2, "0x%04x", PS (dst));
	  if (extended_dst)
	    {
	      dst |= extended_dst << 16;
	      if (dst & 0x80000)
		dst |= -1 << 20;
	      if (dst > 9 || dst < 0)
		sprintf (comm2, "0x%05x", dst & 0xfffff);
	    }
	  sprintf (op2, "%d(r%d)", dst, regd);
	}
    }

  return cmd_len;
}
Exemplo n.º 22
0
void ve_sample_varlist(void)
{
   ve_group (PS("MOTOR CONTROL"));

   ve_onoff (PS("PWM Direct"), PWMDirect,0);
   ve_int   (PS("PWM Left Motor"), PWML,-128,128);
   ve_int   (PS("PWM Right Motor"), PWMR,-128,128);

   ve_int   (PS("Update 100ths"), UpdateDelay,1,50);

   ve_int   (PS("Kp"), Kp,0,100);
   ve_int   (PS("Ki"), Ki,0,100);
   ve_int   (PS("Kd"), Kd,-100,100);
   ve_int   (PS("PWM Max"), PWM_Max,0,127);
   ve_int   (PS("Mode"), Mode,1,3);
   ve_bit   ("HeadLight",Controls,3);   // bit toggle  (can use bit 0 for byte boolean) 

   ve_eeprom(0);
   ve_int   (PS("Ktemp"), Ktemp,0,10);  // don't write to EEPROM
   ve_eeprom(1);

   ve_group (PS("SONAR CONTROL"));
   ve_int   (PS("Gain"), Gain,1,10); 
   ve_int   (PS("Threshold Far"), TFar,1,10);
   ve_int   (PS("Threshold Near"), TNear,1,10);

   ve_group (PS("SOUND CONTROL"));
   ve_onoff (PS("Beep "), BeepEnable,0);
   ve_int   (PS("BeepFrq"), BeepFrq,100,3000);

   ve_group (PS("LED CONTROL"));
   ve_int   (PS("LED2 Inten "), LEDInten[2-1],0,255);
   ve_int   (PS("LED3 Inten "), LEDInten[3-1],0,255);

   ve_group (PS("TOAD"));
   ve_onoff (PS("Toad Heater"),Controls,2);      // simimar to ve_bit except displays ON/OFF
   ve_onoff (PS("Toad Humidifier") ,Controls,3);
   ve_onoff (PS("Toad A/C"),Controls,7);
   ve_eeprom(0);
   ve_int   (PS("ToadCtrlsDiag"),Controls,0,255);  // diagnostic viewer of var
   ve_eeprom(1);
}
Exemplo n.º 23
0
void initKeycodes()
{
    pc("[06.000050] -initKeycodes() called");
    int line;
    int scan;
    if (askKeycodes)
    {
        pc("[06.000055] +Ask User");
        pc("[06.000056] +Attemp Overlay - Debug Output frozen");
        char vm[25 * 2 * 80];
        kmemcpy(&(vm[0]), &(video[0]), 25 * 80 * 2);
        setFix(0);
        clearscreen();
        printLogo();
        for(line = 1; line <= 23; line++) kprintf(" ");
        kprintf("%c Please choose Keyboard layout %c\n\n", (char) 174, (char) 175);
        for(line = 1; line <= 26; line++) kprintf(" ");
        kprintf("<1> QWERTY (English Layout)\n");
        for(line = 1; line <= 26; line++) kprintf(" ");
        kprintf("<2> QWERTZ (German Layout)\n");
        changeColor(0x0, 0x0);
        kprintf(" \b");
        scan = FetchAndAnalyzeScancode();
        changeColor(0x0, 0xF);
        kmemcpy(&(video[0]), &(vm[0]), 25 * 80 * 2);
        setFix(10);
        pc("[06.000056] +overlay finished");
    }
    else
    {
        PS("[06.%s] +echo \"Using Keyboard Layout QWERTZ (GERMAN)", dl);
        DEBUG_MSG("IO:       Using Keyboard Layout QWERTZ (German)...");
        scan = 3;
        dbg(true);
    }
    pc("[06.000081] +setIOKbLeyout to %s", (scan == 2) ? "QWERTY - US" : "QWERTZ - DE");
    if (scan == 2) // QWERTY -- US
    {
        unsigned char tasciiNonShift[100] = {
            0, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', BACKSPACE,
            TAB, 'q', 'w',   'e', 'r', 't', 'y', 'u', 'i', 'o', 'p',   '[', ']', ENTER, 0,
            'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\',
            'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0, 0, 0, ' ', 0,
            KF1, KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0,
            KHOME, KUP, KPGUP,'-', KLEFT, '5', KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12
        };
        tasciiNonShift[86] = '<';

        unsigned char tasciiShift[100] = {
            0, ESC, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', BACKSPACE,
            TAB, 'Q', 'W',   'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P',   '{', '}', ENTER, 0,
            'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '\"', '~', 0, '|',
            'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 0, 0, 0, ' ', 0,
            KF1,   KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0,
            KHOME, KUP, KPGUP, '-', KLEFT, '5',   KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12
        };
        tasciiShift[86] = '>';

        unsigned char tasciiAltGR[100] = {
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
        };
        tasciiAltGR[86] = '|';
        int i;
        for(i = 0; i <= 100; i++)
        {
            asciiNonShift[i] = tasciiNonShift[i];
            asciiShift[i] = tasciiShift[i];
            asciiAltGR[i] = tasciiAltGR[i];
        }
    }
    else // QWERTZ -- Germany
    {
        unsigned char tasciiNonShift[100] = {
            0, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 225,0, BACKSPACE,
            TAB, 'q', 'w',   'e', 'r', 't', 'z', 'u', 'i', 'o', 'p',   0, '+', ENTER, 0,//29
            'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0,0, '#', 0, '#',
            'y', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '-', '<', 0, 0, ' ', 0,
            KF1, KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0,
            KHOME, KUP, KPGUP,'-', KLEFT, '5', KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12
        };
        tasciiNonShift[86] = '<';
        tasciiNonShift[26] = (char) 129;
        tasciiNonShift[39] = (char) 148;
        tasciiNonShift[40] = (char) 132;
        tasciiNonShift[41] = (char) 95;

        unsigned char tasciiShift[100] = {
            0, ESC, '!', '\"', 0, '$', '%', '&', '/', '(', ')', '=', '?', '`', BACKSPACE,
            TAB, 'Q', 'W',   'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P',   0, '*', ENTER, 0,
            'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0,0, '\'', 0, '\'',
            'Y', 'X', 'C', 'V', 'B', 'N', 'M', ';', ':', '_', '>', 0, 0, ' ', 0,
            KF1,   KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0,
            KHOME, KUP, KPGUP, '-', KLEFT, '5',   KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12
        };
        tasciiShift[86] = '>';
        tasciiShift[26] = (char) 154;
        tasciiShift[39] = (char) 153;
        tasciiShift[40] = (char) 142;
        tasciiShift[41] = (char) 248;

        unsigned char tasciiAltGR[100] = {
            0, 170, 173,253,0, 0,0,0, '{', '[', ']', '}', '\\', 0, 0,
            0, '@', 0,   0, 0, 0,0,0, 0,237,0,   0, '~', 0, 0,
            145, 0, 0, 0,0,0, 0, 0,0,0, '^', '`', 0, 0,
            0,0,0,0,0,0, 0,0,0, 0, '|', 0, 0, 0, 0,
            0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        };
        tasciiAltGR[86] = '|';

        int i;
        for(i = 0; i < 100; i++)
        {
            asciiNonShift[i] = tasciiNonShift[i];
            asciiShift[i] = tasciiShift[i];
            asciiAltGR[i] = tasciiAltGR[i];
        }
    }
    pc("[06.000165] +ret");
}
Exemplo n.º 24
0
int Sigma_n(int i, int n)
{
	int s=0;
	for(int vn=0; vn<=n; vn++) s+=PS(i,vn);
	return s;
};