示例#1
0
static void do_out_equ(const char *name, const char *equ, uchar off)
{
  char buf[MAXSTR];
  char *ptr = buf;
  char *const end = buf + sizeof(buf);
  gl_name = 0;
  if (ash.uflag & UAS_PSAM)
  {
    ptr = tag_addstr(ptr, end, COLOR_KEYWORD, equ);
    APPCHAR(ptr, end, ' ');
    APPEND(ptr, end, name);
    ptr = tag_addchr(ptr, end, COLOR_SYMBOL, ',');
  }
  else
  {
    APPEND(ptr, end, name);
    if(ash.uflag & UAS_EQCLN)
      ptr = tag_addchr(ptr, end, COLOR_SYMBOL, ':');
    APPCHAR(ptr, end, ' ');
    ptr = tag_addstr(ptr, end, COLOR_KEYWORD, equ);
    APPCHAR(ptr, end, ' ');
  }
  ptr = tag_on(ptr, end, COLOR_NUMBER);
  ptr += btoa32(ptr, end-ptr, off);
  tag_off(ptr, end, COLOR_NUMBER);
  MakeLine(buf, 0);
}
示例#2
0
static int out_equ(ea_t ea)
{
  char buf[MAXSTR];
  char *const end = buf + sizeof(buf);
  segment_t *s = getseg(ea);
  if ( s != NULL && s->type == SEG_IMEM && ash.a_equ != NULL)
  {
    char nbuf[MAXSTR];
    char *name = get_name(BADADDR, ea, nbuf, sizeof(nbuf));
    if ( name != NULL
      && ((ash.uflag & UAS_PBYTNODEF) == 0 || !IsPredefined(name)) )
    {
      get_colored_name(BADADDR, ea, buf, sizeof(buf));
      uchar off = uchar(ea - get_segm_base(s));
      do_out_equ(buf, ash.a_equ, off);
      if ( (ash.uflag & UAS_AUBIT) == 0 && (off & 0xF8) == off )
      {
        char *ptr = tag_on(tail(buf), end, COLOR_SYMBOL);
        APPCHAR(ptr, end, ash.uflag & UAS_NOBIT ? '_' : '.');
        APPCHAR(ptr, end, '0');
        tag_off(ptr, end, COLOR_SYMBOL);
        for ( int i=0; i < 8; i++ )
        {
          const ioport_bit_t *b = find_bit(off, i);
          char *p2 = ptr;
          if ( b == NULL || b->name == NULL )
            ptr[-1] = '0' + i;
          else
            p2 = tag_addstr(ptr-1, end, COLOR_HIDNAME, b->name);
          tag_off(p2, end, COLOR_SYMBOL);
          do_out_equ(buf, ash.a_equ, off+i);
        }
        MakeNull();
      }
    }
    else
    {
      gl_name = 0;
      MakeLine("");
    }
    return 1;
  }
  if ( ash.uflag & UAS_NODS )
  {
    if ( !isLoaded(ea) && s->type == SEG_CODE )
    {
      adiff_t org = ea - get_segm_base(s) + get_item_size(ea);
      btoa(buf, sizeof(buf), org);
      printf_line(inf.indent, COLSTR("%s %s", SCOLOR_ASMDIR), ash.origin, buf);
      return 1;
    }
  }
  return 0;
}
示例#3
0
//--------------------------------------------------------------------------
static void out_equ(const char *name, const char *equ, uchar off)
{
  char buf[MAXSTR];
  char *const end = buf + sizeof(buf);

  char *p = tag_addstr(buf, end, COLOR_DNAME, name);
  APPCHAR(p, end, ' ');
  p = tag_addstr(p, end, COLOR_KEYWORD, equ);
  APPCHAR(p, end, ' ');
  p = tag_on(p, end, COLOR_NUMBER);
  p += btoa(p, end-p, off);
  tag_off(p, end, COLOR_NUMBER);
  MakeLine(buf, 0);
}
示例#4
0
//--------------------------------------------------------------------------
void assume(ea_t ea)
{
  segreg_t *Darea  = getSRarea(ea);
  segment_t *Sarea = getseg(ea);
  char buf[MAXSTR];
  char *const end = buf + sizeof(buf);

  if ( Sarea == NULL || Darea == NULL || !inf.s_assume ) return;

  bool show = (ea == Sarea->startEA);
  if ( show || Darea->startEA == ea )
  {
    bool used = false;
    segreg_t our = *Darea;
    segreg_t *prev = show ? NULL : getSRarea(ea-1);
    char *ptr = NULL;
    for ( int i=ph.regFirstSreg; i <= ph.regLastSreg; i++ )
    {
      if ( i == ph.regCodeSreg ) continue;
      if ( prev == NULL || prev->reg(i) != our.reg(i) )
      {
        if ( !used )
        {
          ptr = tag_on(buf, end, COLOR_AUTOCMT);
          APPEND(ptr, end, ash.cmnt);
          APPEND(ptr, end, " assume ");
        }
        else
        {
          APPCHAR(ptr, end, ',');
          APPCHAR(ptr, end, ' ');
        }
        used = true;
        APPEND (ptr, end, ph.regNames[i]);
        APPCHAR(ptr, end, ':');
        if ( our.reg(i) == BADSEL )
          APPEND(ptr, end, "nothing");
        else
          ptr += btoa(ptr, end-ptr, our.reg(i), 16);
      }
    }
    if ( used )
    {
      tag_off(ptr, end, COLOR_AUTOCMT);
      MakeLine(buf, inf.indent);
    }
  }
}