Ejemplo n.º 1
0
//----------------------------------------------------------------------
static void out_bad_address(ea_t addr)
{
  if ( !out_port_address(addr) )
  {
    out_tagon(COLOR_ERROR);
    OutLong(addr, 16);
    out_tagoff(COLOR_ERROR);
    QueueSet(Q_noName, cmd.ea);
  }
}
Ejemplo n.º 2
0
Archivo: out.cpp Proyecto: 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;
}