Exemplo n.º 1
0
Arquivo: out.cpp Projeto: nealey/vera
//----------------------------------------------------------------------
static void out_address(ea_t ea, op_t &x, bool mapping, bool at)
{
  regnum_t reg = get_mapped_register(ea);
  if ( mapping && reg != rnone) out_register(ph.regNames[reg] );
  else
  {
#ifndef TMS320C54_NO_NAME_NO_REF
    char buf[MAXSTR];
    // since tms320c54 uses memory mapping, we turn off verification
    // of name expression values (3d arg of get_name_expr is BADADDR)
    if ( get_name_expr(cmd.ea+x.offb, x.n, ea, BADADDR, buf, sizeof(buf)) > 0 )
    {
      if ( at)
        out_symbol('@' );
      OutLine(buf);
    }
    else
#endif
    {
      out_tagon(COLOR_ERROR);
      OutValue(x, OOFW_IMM|OOF_ADDR);
      out_tagoff(COLOR_ERROR);
      QueueMark(Q_noName, cmd.ea);
    }
  }
}
Exemplo n.º 2
0
Arquivo: out.cpp Projeto: nealey/vera
//----------------------------------------------------------------------
static void outmem(op_t &x, ea_t ea)
{
  char buf[MAXSTR];
  if ( get_name_expr(cmd.ea+x.offb, x.n, ea, BADADDR, buf, sizeof(buf)) <= 0 )
  {
    const ioport_t *p = find_sym(x.addr);
    if ( p == NULL )
    {
      out_tagon(COLOR_ERROR);
      OutLong(x.addr, 16);
      out_tagoff(COLOR_ERROR);
      QueueMark(Q_noName,cmd.ea);
    }
    else
    {
      out_line(p->name, COLOR_IMPNAME);
    }
  }
  else
  {
    bool complex = strchr(buf, '+') || strchr(buf, '-');
    if ( complex ) out_symbol(ash.lbrace);
    OutLine(buf);
    if ( complex ) out_symbol(ash.rbrace);
  }
}
Exemplo n.º 3
0
//----------------------------------------------------------------------
char outName(ea_t from, int n, ea_t ea, uval_t off, uchar *rbad)
{
  char  buf[MAXSTR];

  if ( get_name_expr(from, n, ea + off, off, buf, sizeof(buf)) <= 0 ) {
    if ( loadpass >= 0) QueueMark(Q_noName, cmd.ea );
    return(0);
  }
  if ( chkOutLine(buf, tag_strlen(buf)) ) {
    *rbad = 1;
    return(0);
  }
  return(1);
}
Exemplo n.º 4
0
static void OutVarNameVal(op_t &x)
{
ushort addr = x.value;
ulong toea = toEA(codeSeg(addr,x.n), addr);
#if IDP_INTERFACE_VERSION > 37
	if(out_name_expr(x,toea,addr))return;
#else
	const char *ptr;
	if((ptr=get_name_expr(cmd.ea+x.offb, toea, addr)) != NULL){
		//вывод имен переменных и меток перехода
	    OutLine(ptr);
	}
#endif
else OutValue(x, OOFW_16);
}
Exemplo n.º 5
0
static void OutVarName(op_t &x)
{
ea_t addr = x.addr;
ea_t toea = toEA(codeSeg(addr,x.n), addr);
#if IDP_INTERFACE_VERSION > 37
//      msg("AT:%a target=%lx, segm=%lx, Result=%lx\n",
//                      cmd.ea,addr, codeSeg(addr,x.n),toea);
        if ( out_name_expr(x,toea,addr) )return;
#else
        const char *ptr;
        if ( (ptr=get_name_expr(cmd.ea+x.offb, toea, addr)) != NULL ){
                //вывод имен переменных и меток перехода
            OutLine(ptr);
        }
#endif
        else{
                OutValue(x, OOF_ADDR | OOF_NUMBER |
                                        OOFS_NOSIGN | OOFW_32);
                // пометим проблему - нет имени
                QueueMark(Q_noName,cmd.ea);
        }
}
Exemplo n.º 6
0
//----------------------------------------------------------------------
// вывод одного операнда
bool N78K_outop(op_t &x)
{
#if IDP_INTERFACE_VERSION <= 37
  uFlag = getFlags(cmd.ea);
#endif
  switch(x.type){
  case o_void: return 0;

  case o_reg:
		if(x.FormOut & FORM_OUT_SKOBA) out_symbol('[');
		OutReg(x.reg);
		if(x.FormOut & FORM_OUT_PLUS) out_symbol('+');
		if(x.FormOut & FORM_OUT_DISP){
			if(isOff(uFlag, x.n)){
				OutVarNameVal(x);
			}
			else OutValue(x, OOFW_IMM );
		}
		if(x.FormOut & FORM_OUT_REG){
			out_keyword( ph.regNames[x.SecondReg] );
		}
		if(x.FormOut & FORM_OUT_SKOBA) out_symbol(']');
		break;

  case o_bit:
       switch(x.FormOut){
        case FORM_OUT_S_ADDR:
        case FORM_OUT_SFR:
				OutVarName(x);
				out_symbol('.');
#if IDP_INTERFACE_VERSION > 37
				if( !nec_find_ioport_bit(x.addr, x.value) )
#endif
				{
					OutValue(x, OOFW_IMM);
				}
				break;

        case FORM_OUT_A:
				OutLine("A.");
				OutValue(x, OOFW_IMM);
				break;

        case FORM_OUT_PSW:
				OutLine("PSW.");
				switch(x.value){
				case 0:	OutLine("CY");break;
				case 1:	OutLine("ISP");break;
				case 3:	OutLine("RBS0");break;
				case 4:	OutLine("AC");break;
				case 5:	OutLine("RBS1");break;
				case 6:	OutLine("Z");break;
				case 7:	OutLine("IE");break;
				default:OutValue(x, OOFW_IMM);
				}
				break;

		case FORM_OUT_HL:
            out_symbol('[');
            OutReg(rHL);
            out_symbol(']');
            out_symbol('.');
			if(isOff(uFlag, x.n)){
				OutVarNameVal(x);
			}
			else OutValue(x, OOFW_IMM );
            break;

		}
		break;

  case o_imm:
		out_symbol('#');
		if(isOff(uFlag, x.n)){
			OutVarNameVal(x);
		}
		else OutValue(x, OOFW_IMM );
		break;

  case o_mem:
			//выводит имя переменной из памяти(например byte_98)
			if(x.FormOut & FORM_OUT_VSK)  out_symbol('!');
            if(x.FormOut & FORM_OUT_SKOBA) out_symbol('[');
			//Вывод имени переменной
			OutVarName(x);
            if(x.FormOut & FORM_OUT_SKOBA) out_symbol(']');
		    break;

  case o_near:
            if(x.FormOut & FORM_OUT_VSK) out_symbol('!');
            if(x.FormOut & FORM_OUT_SKOBA) out_symbol('[');
	       {
		    ulong adr;
			adr = toEA(codeSeg(x.addr,x.n),x.addr);
#if IDP_INTERFACE_VERSION > 37
            if( !out_name_expr(x, adr, x.addr)){
              OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_16);
              QueueMark(Q_noName, cmd.ea);
            }
#else
		{const char *ptr;
			ptr=get_name_expr(cmd.ea+x.offb, adr, x.addr);
            if( ptr == NULL ){
				OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_16);
				QueueMark(Q_noName, cmd.ea);
			}
			else OutLine(ptr);
		}
#endif
			}
			if(x.FormOut & FORM_OUT_SKOBA) out_symbol(']');
			break;

  // неизвестный операнд
  default:      warning("out: %lx: bad optype",cmd.ea,x.type);
                break;
  }
  return(1);
}
Exemplo n.º 7
0
bool outop(op_t &x)
{
  uval_t v;
  int dir, bit;
  char buf[MAXSTR];
  switch ( x.type )
  {
    case o_reg:
      OutReg(x.reg);
      break;

    case o_phrase:
      if ( x.phrase == fRi )
      {
        out_symbol('@');
        OutReg(x.indreg);
        break;
      }
      out_colored_register_line(phrases[x.phrase]);
      break;

    case o_displ:
      out_symbol('@');
      OutReg(x.reg);
      out_symbol('+');
      OutValue(x, OOF_ADDR | OOFS_IFSIGN | OOFW_16);
      break;

    case o_imm:
      out_symbol('#');
      if ( cmd.auxpref & aux_0ext ) out_symbol('0');
      if ( cmd.auxpref & aux_1ext ) out_symbol('1');
      OutValue(x, OOFS_IFSIGN | OOFW_IMM);
      break;

    case o_mem:
    case o_near:
      v = map_addr(x.addr, x.n, x.type==o_mem);
      if ( get_name_expr(cmd.ea+x.offb, x.n, v, x.addr, buf, sizeof(buf)) <= 0 )
      {
/*        int nbit;
        if ( cmd.itype == I51_ecall || cmd.itype == I51_ejmp )
          nbit = OOFW_32;
        else
          nbit = OOFW_16;*/
        OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_32);
        QueueMark(Q_noName, cmd.ea);
        break;
      }

      // we want to output SFR register names always in COLOR_REG,
      // so remove the color tags and output it manually:

      if ( x.type == o_mem && x.addr >= 0x80 )
      {
        tag_remove(buf, buf, sizeof(buf));
        out_register(buf);
        break;
      }
      OutLine(buf);
      break;

    case o_void:
      return false;

    case o_bit251:
      if ( x.b251_bitneg ) out_symbol('/');
      dir = x.addr;
      bit = x.b251_bit;
      goto OUTBIT;

    case o_bitnot:
      out_symbol('/');
    case o_bit:
      dir = (x.reg & 0xF8);
      bit = x.reg & 7;
      if ( (dir & 0x80) == 0 ) dir = dir/8 + 0x20;
OUTBIT:
      if(ash.uflag & UAS_PBIT)
      {
        const ioport_bit_t *predef = find_bit( dir, bit);
        if ( predef != NULL )
        {
          out_line(predef->name, COLOR_REG);
          break;
        }
      }
      {
        v = map_addr(dir, x.n, true);
        ssize_t len = get_name_expr(cmd.ea+x.offb, x.n, v, dir, buf, sizeof(buf));
        if ( len > 0 && strchr(buf, '+') == NULL )
        {

      // we want to output the bit names always in COLOR_REG,
      // so remove the color tags and output it manually:

          if ( dir < 0x80 )
          {
            OutLine(buf);
          }
          else
          {
            tag_remove(buf, buf, sizeof(buf));
            out_register(buf);
          }
        }
        else
        {
          out_long(dir, 16);
        }
        out_symbol(ash.uflag & UAS_NOBIT ? '_' : '.');
        out_symbol('0'+bit);
      }
      break;

     default:
       warning("out: %a: bad optype",cmd.ea,x.type);
       break;
  }
  return true;
}