示例#1
0
	/* outputs an operand 'x' */
bool outop(op_t &x)
{
// const char *ptr;
  ea_t v;
	switch (x.type)
	{
	case o_reg:
		out_register(ph.regNames[x.reg]);
		break;
	case o_imm:
		OutValue(x, OOFS_IFSIGN | OOFW_IMM);
		break;
	case o_mem:
	case o_near:
		v=toEA(cmd.cs, x.addr);
		if ( !out_name_expr(x, v, x.addr) )
		{
			OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_32);
			QueueMark(Q_noName, cmd.ea);
			break;
		}
		break;
	default:
		out_symbol('?');
		break;
	}
	return 1;
}
示例#2
0
void out_print_address(op_t &x, ea_t /*pc*/)
{
  if (!out_name_expr(x, x.addr))
  {
    OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN);
    QueueSet(Q_noName, cmd.ea);
  }
}
示例#3
0
文件: out.cpp 项目: nealey/vera
//----------------------------------------------------------------------
bool outop( op_t &x )
{
    uval_t v, v1;
//  const char *ptr;

    switch( x.type )
    {
    case o_imm:
        out_symbol( '#' );
        OutValue( x, OOF_SIGNED | OOFW_IMM );
        break;

    case o_indexed:
        OutValue( x, OOF_ADDR|OOF_SIGNED|(is_ext_insn() ? OOFW_32 : OOFW_16) ); //.addr
        v = x.value;
        out_symbol( '[' );
        if ( v != 0 ) goto OUTPHRASE;
        out_symbol( ']' );
        break;

    case o_indirect:
    case o_indirect_inc:
        out_symbol( '[' );

    case o_mem:
    case o_near:
        v = x.addr;
OUTPHRASE:
        v1 = toEA( getSR(cmd.ea, (x.type == o_near) ? rVcs : rVds), v);
        if( !out_name_expr( x, v1, v ) )
        {
            OutValue( x, (x.type == o_indexed ? 0 : OOF_ADDR) | OOF_NUMBER|OOFS_NOSIGN|
                      ((x.type == o_near) ? (is_ext_insn() ? OOFW_32 : OOFW_16) : OOFW_8) );
            QueueMark( Q_noName, cmd.ea );
        }

        if( x.type == o_indirect || x.type == o_indirect_inc ||
                x.type == o_indexed )
        {
            out_symbol( ']' );
            if( x.type == o_indirect_inc )    out_symbol( '+' );
        }
        break;

    case o_void:
        return 0;

    case o_bit:
        out_symbol( char('0' + x.reg) );
        break;

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

    return 1;
}
示例#4
0
//----------------------------------------------------------------------
bool idaapi outop(op_t &x)
{
  ea_t ea;
  if ( x.type == o_imm )
    out_symbol('#');
  char buf[MAXSTR];

  switch ( x.type )
  {
    case o_void:
      return 0;

    case o_imm:
      OutValue(x, OOFS_IFSIGN|OOFW_IMM);
      break;

    case o_reg:
      outreg(x.reg);

      break;

    case o_mem:
      // no break;
    case o_near:
      {
        ea = calc_mem(x);
        if ( ea == cmd.ea+cmd.size )
          out_ip_rel(cmd.size);
        else if ( !out_name_expr(x, ea, x.addr) )
          out_bad_address(x.addr);
      }
      break;

    case o_phrase:
      {
       qsnprintf(buf, sizeof(buf), "%%%c%" FMT_EA "x", 'a' + x.reg, x.value);

       ea = calc_data_mem(x, as + x.reg);
       if ( ( ea != BADADDR ) && ( ( x.reg != SR3 ) || ( x.value < 6 ) ) )
       {
           out_line(buf, COLOR_AUTOCMT);
           out_symbol(' ');
           out_address(ea, x);
        }
       else
           out_line(buf, COLOR_REG);

      }
      break;

    default:
      interr("out");
      break;
  }
  return 1;
}
示例#5
0
//----------------------------------------------------------------------
static void out_address(ea_t ea, op_t &x)
{
  segment_t *s = getseg(ea);
  ea_t value = s != NULL ? ea - get_segm_base(s) : ea;
  if ( !out_name_expr(x, ea, value) )
  {
    out_tagon(COLOR_ERROR);
    out_snprintf("%a", ea);
    out_tagoff(COLOR_ERROR);
    QueueSet(Q_noName, cmd.ea);
  }
}
示例#6
0
文件: out.cpp 项目: nealey/vera
//----------------------------------------------------------------------
static void out_address(ea_t ea, op_t &x)
{

    if ( !out_name_expr(x, ea,/* ea */ BADADDR) )
    {
          out_tagon(COLOR_ERROR);
          OutValue(x, OOFW_IMM|OOF_ADDR|OOFW_16);
          out_snprintf(" (ea = %a)", ea);
          out_tagoff(COLOR_ERROR);
          QueueMark(Q_noName, cmd.ea);
    }

}
示例#7
0
//----------------------------------------------------------------------
static int OutVarName(op_t &x, int iscode, int relative)
{
//char *ptr;
ushort addr = ushort(x.addr);
if(relative)
  {
  addr += (ushort)cmd.ip;
  addr += cmd.size;           // ig: this is tested only for 6809
  }
//Получить линейный адресс
ea_t toea = toEA((iscode || relative) ? codeSeg(addr,x.n) : dataSeg_op(x.n), addr);
//Получть строку для данного лин. адресса
return out_name_expr(x, toea, addr);
}
示例#8
0
文件: out.cpp 项目: nealey/vera
//----------------------------------------------------------------------
void OutAddr(op_t& x, ea_t ea, ea_t off, bool isSigned = false) {
  // try and find the real name expression
  if ( !out_name_expr(x, ea, off) )
  {
    // work out flags correctly
    uint32 flags = OOF_ADDR | OOFW_16;
    if (isSigned) flags |= OOF_SIGNED;
    else flags |= OOFS_NOSIGN;

    // if name wasn't found, just output the value & add to noname queue
    OutValue(x, flags);
    QueueMark(Q_noName, cmd.ea);
  }
}
示例#9
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);
}
示例#10
0
/*
#<pydoc>
def out_name_expr(op, ea, off):
    """
    Output a name expression
    @param op: operand (of type op_t)
    @param ea: address of expression
    @param off: the value of name expression. this parameter is used only to
                check that the name expression will have the wanted value.
                You may pass BADADDR for this parameter.
    @return: true if the name expression has been produced
    """
    pass
#</pydoc>
*/
bool py_out_name_expr(
  PyObject *py_op,
  ea_t ea,
  PyObject *py_off)
{
  PYW_GIL_CHECK_LOCKED_SCOPE();
  op_t *op = op_t_get_clink(py_op);
  uint64 v(0);
  adiff_t off;
  if ( PyW_GetNumber(py_off, &v) )
    off = adiff_t(v);
  else
    off = BADADDR;

  return op == NULL ? false : out_name_expr(*op, ea, off);
}
示例#11
0
// output an address
static void outaddr(op_t &op, const bool replace_with_label = true) {
    bool ind = is_addr_ind(op);      // is operand indirect ?
    bool sp = is_addr_sp(op);        // is operand special page ?

    int size = 16;  // operand is 16 bits long

    if ( ind)    out_symbol('(' );
    if ( sp)     { out_symbol('\\' ); size = 8; /* just display the first 8 bits */ }

    if ( !out_name_expr(op, toEA(cmd.cs, op.addr), op.addr) || !replace_with_label)
    {
        if ( replace_with_label) out_tagon(COLOR_ERROR );
        OutValue(op, OOF_ADDR | OOFS_NOSIGN | (size < 16 ? OOFW_8 : OOFW_16) );
        if ( replace_with_label) out_tagoff(COLOR_ERROR );
    }

    if ( ind)    out_symbol(')' );
}
示例#12
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);
        }
}
示例#13
0
//----------------------------------------------------------------------
static void out_address(op_t &op)
{
  ea_t ea;
  if (op.type == o_near)
    ea = calc_code_mem(op.addr);
  else if (op.type == o_mem)
    ea = calc_data_mem(op);
  else if (op.type == o_io)
   ea = calc_io_mem(op);

  int reg = -1;
  if (op.type == o_mem) reg = get_mapped_register(ea);

  // print begin of the modifier
  switch(op.tms_modifier)
  {
    case TMS_MODIFIER_NULL:
      break;
    case TMS_MODIFIER_DMA:
      if ((int)reg == -1) out_symbol('@');
      break;
    case TMS_MODIFIER_ABS16:
    case TMS_MODIFIER_PTR:
      out_symbol('*');
      if (op.tms_modifier == TMS_MODIFIER_ABS16) out_line("abs16", COLOR_SYMBOL);
      out_line("(#", COLOR_SYMBOL);
      break;
    case TMS_MODIFIER_MMAP:
      out_line("mmap(@", COLOR_SYMBOL);
      break;
    case TMS_MODIFIER_PORT:
      out_line("port(#", COLOR_SYMBOL);
      break;
    case TMS_MODIFIER_PORT_AT:
      out_line("port(@", COLOR_SYMBOL);
      break;
    default:
      error("interr: out: o_address: modifier_begin");
  }


  if (op.type != o_io)
  {
    if (int(reg) != -1) // memory mapped register
      out_register(ph.regNames[reg]);
    else
    {
#ifndef TMS320C55_NO_NAME_NO_REF
      if ( !out_name_expr(op, ea, ea) )
#endif
      {
        out_tagon(COLOR_ERROR);
        if (op.type != o_mem)
          OutLong(op.addr, 16);
        else
          OutLong(op.addr, 16);
        out_tagoff(COLOR_ERROR);
        QueueMark(Q_noName, cmd.ea);
      }
    }
  }
  else // IO address
  {
    if (ea != BADADDR)
    {
      const char *name = NULL;
      if (idpflags & TMS320C55_IO) name = find_sym(ea);
      if (name)
        out_line(name, COLOR_IMPNAME);
      else
        OutLong(ea, 16);
    }
    else
    {
      out_tagon(COLOR_ERROR);
      OutLong(op.addr, 16);
      out_tagoff(COLOR_ERROR);
    }
  }

  // print end of the modifier
  switch(op.tms_modifier)
  {
    case TMS_MODIFIER_NULL:
    case TMS_MODIFIER_DMA:
      break;
    case TMS_MODIFIER_ABS16:
    case TMS_MODIFIER_PTR:
    case TMS_MODIFIER_MMAP:
    case TMS_MODIFIER_PORT:
    case TMS_MODIFIER_PORT_AT:
      out_symbol(')'); break;
    default:
      error("interr: out: o_address: modifier_begin");
  }
}
示例#14
0
bool __stdcall outop( op_t &x )
{
    char buf[MAXSTR];
    switch( x.type )
    {
    case o_imm:
        {
            switch(cmd.insnpref)
            {
            case SWFACTION_GETURL2:
                {
                    switch(x.specflag1)
                    {
                    case 'M':
                        if (x.value == 2)
                            out_keyword("method:POST");
                        else
                            x.value?out_keyword("method:GET"):out_keyword("method:none");
                        break;
                    case 'T':
                        x.value?out_keyword("target:sprite"):out_keyword("target:browser");
                        break;
                    case 'V':
                        x.value?out_keyword("vars:load"):out_keyword("vars:no");
                    }
                }
                break;
            case SWFACTION_CONSTANTPOOL:
                OutValue( x, OOFW_IMM );   
                break;
            case SWFACTION_GOTOFRAME2:
                if (x.n == 0)
                {
                    x.value?out_keyword("play:yes"):out_keyword("play:no");
                }
                else
                {
                    OutValue( x, OOFW_IMM );
                }
                break;
            case SWFACTION_DEFINEFUNCTION2:
                if (x.n == 5)
                {
                    //output the parameters first
                    uint16 p = cmd.auxpref,
                        i = 0;
                    uint16 param_length = get_word(cmd.ea + 1) - p -2;

                    out_char('{', COLOR_SYMBOL);
                    while (i < param_length)
                    {
                        
                        uint8 reg = get_byte(cmd.ea + 3 + p + i);
                        char* reg_name = buf;
                        *reg_name = 0;
                        
                        while ((i++ < param_length) && ((*(reg_name++) = get_byte(cmd.ea + 3 + p + i))!= 0)) {;}
                        i++;

                        if (reg_name > buf && *(--reg_name) == 0)
                        {
                            char r[6];
                            out_char('{', COLOR_SYMBOL);
                            if (reg)
                            {
                                qsnprintf(r, 5, "r%u", reg);
                                out_register( r );
                            }
                            else
                            {
                                out_char('0', COLOR_NUMBER);
                            }                            
                            out_line(",\"", COLOR_SYMBOL);
                            out_line(buf, COLOR_CHAR);
                            out_line("\"}, ", COLOR_SYMBOL);
                        }//if
                    }//while

                    out_line("}, ", COLOR_SYMBOL);
                }
                OutValue( x, OOFW_IMM );
                break;
            default:
                OutValue( x, OOFW_IMM );
            }
        }
        break;
    case o_reg:
        qsnprintf(buf, MAXSTR, "r%u", x.reg);
        out_register( buf );
        break;
    case o_near:
        if( !out_name_expr(x, x.addr, x.addr) ) 
        { 
            // if we could not create and output a name expression from the address
            OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_32); // instead output a raw value
            QueueMark(Q_noName, cmd.ea); //and mark this as a problem
        }
        break;
    case o_null:
        out_keyword("null");
        break;
    case o_undefined:
        out_keyword("undefined");
        break;
    case o_bool:
        x.value?out_keyword("true"):out_keyword("false");
        break;
    case o_const:
        out_keyword("constant:");
        OutValue( x, OOFW_IMM );
        break;
    case o_string:
        {
            uint16 p = 0;            
            char c;

            out_char('"', COLOR_SYMBOL);

            while ((c = get_byte(x.addr+p)) != 0)
            {
                if (is_printable(c))
                {
                    out_char(c, COLOR_CHAR);
                }
                else
                {
                    qsnprintf(buf, MAXSTR, "\\x%02X", c);
                    out_line(buf, COLOR_STRING);                    
                }
                p++;
            }

            out_char('"', COLOR_SYMBOL);
        }
        break;
    case o_void:
        return 0;
    default:
        warning( "out: %lx: bad optype %d", cmd.ea, x.type );
    }

    return 1;
}
示例#15
0
文件: out.cpp 项目: nealey/vera
//----------------------------------------------------------------------
bool outop(op_t &x) {
  ea_t segadr;
  switch (x.type) {
  case o_void:
    return 0;
  case o_reg:
    OutReg(x.reg);
        break;
  case o_fpreg:
    OutReg(x.reg + 8);
    break;
  case o_imm:            // 27
    if(x.ill_imm) {
      out_symbol('(');
      OutReg(rPC);
      out_symbol(')');
      out_symbol('+');
    } else {
      out_symbol('#');
      if(x.dtyp == dt_float || x.dtyp == dt_double) {
        char str[MAXSTR];
        if(out_real(&x.value, 2, str, sizeof(str))) {
          register char *p = str;
          while(*p == ' ') p++;
          out_symbol('^');
          out_symbol('F');
          out_line(p, COLOR_NUMBER);
        } else out_long(x.value, 8);
      } else OutValue(x, OOF_SIGNED | OOFW_IMM);
    }
    break;
  case o_mem:            // 37/67/77
  case o_near:      // jcc/ [jmp/call 37/67]
  case o_far:
    if(x.phrase != 0) {
      if(x.phrase == 077 || x.phrase == 037) out_symbol('@');
      if(x.phrase == 037) out_symbol('#');
      if(x.addr16 < m.asect_top && !isOff(uFlag,x.n)) {
        OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_16);
        break;
      }
    }
    segadr = toEA(x.type == o_far ? x.segval : codeSeg(x.addr16,x.n), x.addr16);
    if(!out_name_expr(x, segadr, x.addr16)) {
       if(x.type == o_far || x.addr16 < 0160000)
                                              QueueMark(Q_noName, cmd.ea);
       OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_16);
    }
    break;
  case o_number:      //EMT/TRAP/MARK/SPL
    OutValue(x, OOF_NUMBER | OOFS_NOSIGN | OOFW_8);
    break;
  case o_displ:           // 6x/7x (!67/!77)
    if(x.phrase >= 070) out_symbol('@');
    OutValue(x, OOF_ADDR | OOF_SIGNED | OOFW_16);
    out_symbol('(');
    goto endregout;
  case o_phrase:         // 1x/2x/3x/4x/5x (!27/!37)
    switch(x.phrase >> 3) {
       case 1:
         out_symbol('@');
         OutReg(x.phrase & 7);
         break;
       case 3:
         out_symbol('@');
       case 2:
         out_symbol('(');
         OutReg(x.phrase & 7);
         out_symbol(')');
         out_symbol('+');
         break;
       case 5:
         out_symbol('@');
       case 4:
         out_symbol('-');
         out_symbol('(');
endregout:
         OutReg(x.phrase & 7);
         out_symbol(')');
         break;
    }
    break;
  default:
  warning("out: %" FMT_EA "o: bad optype %d", cmd.ip, x.type);
        break;
  }
  return 1;
}
示例#16
0
//----------------------------------------------------------------------
bool outop(op_t &x)
{
  switch ( x.type )
  {

    case o_void:
      return 0;

    case o_reg:
      if ( ram != BADADDR )
      {
        char buf[MAXSTR];
        const char *name = get_name(cmd.ea, ram+x.reg, buf, sizeof(buf));
        if ( name != NULL )
        {
          out_register(name);
          break;
        }
      }
      out_register(ph.regNames[x.reg]);
      break;

    case o_imm:
      if ( cmd.itype == AVR_cbi
        || cmd.itype == AVR_sbic
        || cmd.itype == AVR_sbi
        || cmd.itype == AVR_sbis )
      {
        const char *bit = find_bit(cmd.Op1.addr, (size_t)x.value);
        if ( bit != NULL )
        {
          out_line(bit, COLOR_REG);
          break;
        }
      }
      if ( x.specflag1 && isOff1(uFlag) && !is_invsign(cmd.ea, uFlag, 1) )
      {
        out_symbol('-');
      }
      OutValue(x, OOFS_IFSIGN|OOF_SIGNED|OOFW_8);
      break;

    case o_near:
      {
        ea_t ea = toEA(cmd.cs, x.addr);
        if ( !out_name_expr(x, ea, x.addr) )
          out_bad_address(x.addr);
      }
      break;

    case o_mem:
      {
        ea_t ea = toEA(dataSeg(), x.addr);
        if ( !out_name_expr(x, ea, x.addr) )
          out_bad_address(x.addr);
      }
      break;

    case o_phrase:
      out_phrase(x.phrase);
      break;

    case o_displ:
      out_phrase(x.phrase);
      OutValue(x,OOF_ADDR|OOFS_NEEDSIGN|OOFW_IMM);
      break;

    case o_port:
      {
        const char *pname = find_port(x.addr);
        if ( pname == NULL )
          out_bad_address(x.addr);
        else
          out_register(pname);
      }
      break;

    default:
      warning("out: %a: bad optype %d", cmd.ea, x.type);
      break;
  }
  return 1;
}
示例#17
0
//----------------------------------------------------------------------
bool outop(op_t &x)
{
switch(x.type)
  {
  case o_void:  return 0;

  case o_reg:
    if(x.prepost) out_symbol('[');
    //Вывод регистра по номеру в регистре
    OutReg(x.reg);
    if(x.xmode)
      {
      out_symbol('+');
      OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_8);
      }
    if(x.prepost) out_symbol(']');
    break;

  case o_phrase:
    OutLine(ph.regNames[x.reg]);
    break;

  case o_bit:
    {
    switch(x.reg)
      {
      case rPSW:
        {
        OutLine("PSW.");
        switch(x.value)
          {
          case 0: OutLine("CY");break;
          case 4: OutLine("AC");break;
          case 6: OutLine("Z");break;
          case 7: OutLine("IE");break;
          default:OutValue(x, OOFW_IMM);
          } break;
        }

      case rA:
        {
        OutLine( "A." );
        OutChar(char('0'+x.value));
        } break;

      default:
        {
        if(!OutVarName(x, 1, 0) ) OutValue(x, OOF_ADDR | OOFW_16);
        out_symbol('.');
        //Ичем название бита по указанному адрессу
        if(!nec_find_ioport_bit((int)x.addr, (int)x.value))
          {
          //Вывод данных(тип o_imm)
          OutChar(char('0'+x.value));
          }
        }//       switch(x.regmode)
      }  // end switch(x.reg)
    } break;

  case o_imm:
    {
    if(!x.regmode)
      {
      out_symbol('#');
      //Вывод данных(тип o_imm)
      OutValue(x, OOFW_IMM );
      }
    else
      {
      out_symbol('1');
      }
    } break;

  case o_mem:
    {
    if(x.addr16) out_symbol('!');
    //выводит имя переменной из памяти(например byte_98)
    //Вывод имени переменной
    if(!OutVarName(x, 1, 0) )
    //Вывод данных
    OutValue(x, OOF_ADDR | OOFW_16);
    } break;

  case o_near:
    {
    if(x.addr16) out_symbol('!');
    if(x.form) out_symbol('[');
    //Получить линейный адресс
    ea_t v = toEA(cmd.cs,x.addr);
    if(!out_name_expr(x, v, x.addr))
      {
      //Вывести значение
      OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_16);
      QueueMark(Q_noName, cmd.ea);
      }
    if(x.form) out_symbol(']');
    } break;

  default:
    warning("out: %a: bad optype %d", cmd.ip, x.type);
    break;
  }

return(1);
}
示例#18
0
文件: out.cpp 项目: nealey/vera
//----------------------------------------------------------------------
bool outop(op_t &x)
{
  ea_t ea;
  char buf[MAXSTR];

  if ( x.type == o_imm ) out_symbol('#');

  switch ( x.type )
  {
    case o_void:
      return 0;

    case o_imm:
      if ( x.amode & amode_signed )
              OutValue(x, OOF_SIGNED|OOFW_IMM);
      else
              OutValue(x, OOFS_IFSIGN|OOFW_IMM);
      break;

    case o_reg:
      outreg(x.reg);
      break;

    case o_mem:
      // no break;
      ea = calc_mem(x);
      if ( ea != BADADDR )
        out_address(ea, x);
      else
      {
        out_tagon(COLOR_ERROR);
        OutValue(x, OOFW_IMM|OOF_ADDR|OOFW_16);
        out_tagoff(COLOR_ERROR);
      }
      break;

    case o_near:
      {
        ea_t ea = calc_mem(x);
        // xmem ioports
        if ( x.amode & (amode_x) && out_port_address(x.addr) )
        {
          char nbuf[MAXSTR];
          const char *pnam = find_port(x.addr);
          const char *name = get_true_name(BADADDR, ea, nbuf, sizeof(nbuf));
          if ( name == NULL || strcmp(name, pnam) != 0 )
            set_name(ea, pnam);
          break;
        }
        if ( ea == cmd.ea+cmd.size )
          out_ip_rel(cmd.size);
        else if ( !out_name_expr(x, ea, x.addr) )
          out_bad_address(x.addr);
      }
      break;

    case o_phrase:
      {
        if ( x.phtype < 4 )
        {
                qsnprintf(buf, sizeof(buf), formats[x.phtype], x.phrase);
                out_colored_register_line(buf);
        }
        if ( x.phtype == 4 )
        {
                out_symbol('(');
                outreg(x.reg);
                out_symbol(')');
        }
      }
      break;

    case o_local:
      {
        out_colored_register_line(formats2[x.phtype]);
        OutValue(x, OOF_SIGNED|OOF_ADDR);
        if ( x.phtype == 0 )
          out_symbol(')');
        break;
      }

    case o_textphrase:
      {
        char buf[MAXSTR];

              switch ( x.textphtype )
              {
                case text_swap:
                        out_line(swap_formats[x.phrase], COLOR_REG);
                        break;

                case text_banke:

                        int comma;
                        char r0[10], r1[10], r4[10], cfgi[10];
                        comma = 0;


                        r0[0]=r1[0]=r4[0]=cfgi[0]='\0';

                        if ( x.phrase & 0x01 ) //cfgi
                        {
                                qsnprintf(cfgi, sizeof(cfgi), "cfgi");
                                comma = 1;
                        }

                        if ( x.phrase & 0x02 ) //r4
                        {
                                qsnprintf(r4, sizeof(r4), "r4%s", (comma?", ":""));
                                comma = 1;
                        }

                        if ( x.phrase & 0x04 ) //r1
                        {
                                qsnprintf(r1, sizeof(r1), "r1%s", (comma?", ":""));
                                comma = 1;
                        }

                        if ( x.phrase & 0x08 ) //r0
                                qsnprintf(r0, sizeof(r0), "r0%s", (comma?", ":""));

                        qsnprintf(buf, sizeof(buf), "%s%s%s%s", r0, r1, r4, cfgi );
                        out_line(buf, COLOR_REG);

                        break;
                case text_cntx:
                        out_symbol( (x.phrase ? 'r': 's') );
                        break;
                case text_dmod:
                        if ( x.phrase )
                                qsnprintf(buf, sizeof(buf), " no modulo");
                        else
                                qsnprintf(buf, sizeof(buf), " modulo");

                        out_line(buf, COLOR_REG);

                        break;
                case text_eu:
                        qsnprintf(buf, sizeof(buf), " eu");
                        out_line(buf, COLOR_REG);
                        break;
              }

      }
      break;


    default:
      interr("out");
      break;
  }
  return 1;
}
示例#19
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);
}
示例#20
0
// output an operand
bool idaapi outop(op_t &x)
{
  switch ( x.type )
  {
    // register
    case o_reg:
      outreg(x.reg);
      break;

    // immediate
    case o_imm:
      {
        const ioport_t *port = find_sym(x.value);

        // this immediate is represented in the .cfg file
        if ( port != NULL )
        {
          // output the port name instead of the numeric value
          out_line(port->name, COLOR_IMPNAME);
        }
        // otherwise, simply print the value
        else
        {
          out_symbol('#');
          OutValue(x, OOFW_IMM|OOF_SIGNED);
        }
      }
      break;

    // displ @(imm, reg)
    case o_displ:
      out_symbol('@');
      out_symbol('(');
      OutValue(x, OOF_SIGNED | OOF_ADDR | OOFW_32);
      out_symbol(',');
      OutChar(' ');
      outreg(x.reg);
      out_symbol(')');
      break;

    // address
    case o_near:
      if ( !out_name_expr(x, toEA(cmd.cs, x.addr), x.addr) )
        OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_32);
      break;

    // phrase
    case o_phrase:
      switch ( x.specflag1 )
      {
        // @R
        case fRI:
          out_symbol('@');
          if ( isDefArg(uFlag, x.n) )
          {
            out_symbol('(');
            OutValue(x, 0);   // will print 0
            out_symbol(',');
            OutChar(' ');
            outreg(x.reg);
            out_symbol(')');
          }
          else
          {
            outreg(x.reg);
          }
          break;

        // @R+
        case fRIBA:
          out_symbol('@');
          outreg(x.reg);
          out_symbol('+');
          break;

        // @+R
        case fRIAA:
          out_symbol('@');
          out_symbol('+');
          outreg(x.reg);
          break;

        // @-R
        case fRIAS:
          out_symbol('@');
          out_symbol('-');
          outreg(x.reg);
          break;
      }
      break;
  }
  return 1;
}
示例#21
0
//----------------------------------------------------------------------
bool idaapi outop(op_t &x)
{
  uval_t v;

  switch ( x.type )
  {
    case o_imm:
      out_symbol('#');
      OutValue(x, OOFW_IMM);
      break;

    case o_ind_reg:
      out_symbol('@');

    case o_reg:
      OutReg(x.reg);
      break;

    case o_phrase:
//ig: лучше out_keyword, чем простой OutLine()
//    так цвет будет правильный
      out_keyword(phrases[x.phrase]);
      break;

    case o_displ:
      OutValue(x, OOF_ADDR | OOFW_IMM);  // x.addr
      out_symbol('(');
      OutReg(x.reg);
      out_symbol(')');
      break;

    case o_ind_mem:
      out_symbol('@');

    case o_mem:
    case o_near:
      v = map_addr(x.addr, x.n, x.type != o_near);
      if ( !out_name_expr(x, v, x.addr) )
      {
        const char *name = z8_find_ioport(v);
        if ( name != NULL )
        {
          out_line(name, COLOR_IMPNAME);
        }
        else
        {
          OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_16);
          QueueSet(Q_noName, cmd.ea);
        }
      }
      break;

    case o_void:
      return 0;

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

  return 1;
}
示例#22
0
// Output an operand as an address
static void out_addr(op_t &op) {
    if ( !out_name_expr(op, toEA(cmd.cs, op.addr), op.addr) )
        OutValue(op, OOF_ADDR | OOFS_NOSIGN);
}
示例#23
0
文件: out.cpp 项目: nealey/vera
// Output an operand as an address
inline void out_addr(op_t &op, bool find_label = true) {
    if ( !find_label || !out_name_expr(op, toEA(cmd.cs, op.addr), op.addr) )
        OutValue(op, OOF_ADDR | OOFS_NOSIGN);
}
示例#24
0
//----------------------------------------------------------------------
bool outop(op_t &x)
{
  switch ( x.type )
  {

    case o_void:
      return 0;

    case o_reg:
      outreg(x.reg);
      break;

    case o_reglist:
      out_symbol('(');
      out_reglist(x.reg, 8);
      out_symbol(')');
      break;

    case o_imm:
      out_symbol('#');
      OutValue(x, calc_opimm_flags());
      out_sizer(x);
      break;

    case o_mem:
      out_symbol('@');
    case o_near:
    case o_far:
      {
        ea_t ea = calc_mem(x);
        if ( !out_name_expr(x, ea, BADADDR) )
          out_bad_address(x.addr);
        out_sizer(x);
      }
      break;

    case o_phrase:
      if ( x.phtype == ph_normal )
      {
        bool outdisp = isOff(uFlag,x.n)
                    || isStkvar(uFlag,x.n)
                    || isEnum(uFlag,x.n)
                    || isStroff(uFlag,x.n);
        if ( outdisp )
         goto OUTDISP;
      }
      out_symbol('@');
      if ( x.phtype == ph_pre  ) out_symbol('-');
      outreg(x.phrase);
      if ( x.phtype == ph_post ) out_symbol('+');
      break;

    case o_displ:
OUTDISP:
      out_symbol('@');
      out_symbol('(');
      OutValue(x, calc_opdispl_flags());
      out_sizer(x);
      out_symbol(',');
      outreg(x.reg);
      out_symbol(')');
      break;

    default:
      interr("out");
      break;
  }
  return 1;
}