⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 obj_viewer_c.cpp

📁 MCS51单片机的宏汇编器源程序。有需要的朋友请下载!
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    } // end switch
    ++i;
    fprintf(DesPt, "  [ID]=%4.4X",buf16(i)); i+=2;
    fprintf(DesPt, " [Offset]=%4.4X",buf16(i)); i+=2;
  } // end while
} // end show09
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
void OBJ_Viewer::show0F(int8u buf[], int16u rlen)
{ fprintf(DesPt, "\n[Segment Definitions Record 0FH]");
  int16u i = 0;
  while(i < rlen-1)
   { int16u t = buf16(i);
     fprintf(DesPt, "\n   [SEG ID]=%4.4X", t);
     if(!t) { fprintf(DesPt, " (Absolute segment)"); } // endif
     else   { fprintf(DesPt, " (Relocatable segment #%4.4X)", t-1); } // end else
     i+=2;

     fprintf(DesPt, "\n   [SEG INFO]=%2.2X",buf[i]);
     showSEGINFO(buf[i]);
     ++i;

     fprintf(DesPt, "\n   [REL TYP]=%2.2X ",buf[i]);
     switch(buf[i])
     { case 0 : fprintf(DesPt, "(ABSOLUTE)");       break;
       case 1 : fprintf(DesPt, "(UNIT)");           break;
       case 2 : fprintf(DesPt, "(BITADDRESSABLE)"); break;
       case 3 : fprintf(DesPt, "(INPAGE)");         break;
       case 4 : fprintf(DesPt, "(INBLOCK)");        break;
       case 5 : fprintf(DesPt, "(PAGE)");           break;
       default: fprintf(DesPt, "(???)");
     } // end switch
     ++i;

     fprintf(DesPt, "\t\t\t\t[unused byte]=%2.2X",buf[i]);
     ++i;

     fprintf(DesPt, "\n   [Segment Base]=%4.4X", buf16(i));
//     fprintf(DesPt, "\tThis field gives the absolute address of the segment.
//\n\t\t\tIt is used for absolute segments only.
//\n\t\t\tFor relocatable segment this field contain zero.");
     i+=2;

     fprintf(DesPt, "\n   [Segment Size]=%4.4X", buf16(i));
//     fprintf(DesPt, "\tThe number of bytes(or bits in the case of BIT type segment)
//\n\t\t\toccupied by the portion of the segment defined in this module.
//\n\t\t\tA value of zero specifies a size of 10000H(64K) bytes.
//\n\t\t\tThis field is ignored if the segment is empty(E is set).");
     i+=2;

     fprintf(DesPt, "\n   [Segment Name]=");
     i += 1 + showStr(buf+i);
//     fprintf(DesPt, "\tSince absolute segments have no names,
//\n\t\t\tthe field in their case specifies a null name.");

   } // end while
} // end show0F
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
void OBJ_Viewer::show10(int8u buf[])
{ fprintf(DesPt, "\n[Scope Definition Record 10H]");
  int16u i = 0;

  fprintf(DesPt, "\n   [BLK TYP]=%2.2X ",buf[i]);
  switch(buf[i])
  { case 0 : fprintf(DesPt, "(module block)"); break;
    case 1 : fprintf(DesPt, "(DO block)"); break;
    case 2 : fprintf(DesPt, "(PROCEDURE block)"); break;
    case 3 : fprintf(DesPt, "(module end)"); break;
    case 4 : fprintf(DesPt, "(DO end)"); break;
    case 5 : fprintf(DesPt, "(PROCEDURE end)"); break;
    default: fprintf(DesPt, "(??????)");
  } // end switch
  ++i;

  fprintf(DesPt, "\t\t[Block Name]");
  showStr(buf+i);
} // end show10
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
void OBJ_Viewer::show12(int8u buf[], int16u rlen)
{ int16u i = 0;
  fprintf(DesPt, "\n[Debug Items Record 12H]");
  int8u deftyp = buf[i];
  fprintf(DesPt, "\n   [DEF TYP]=%2.2H ",deftyp);
  switch(deftyp)
  { case 0 : fprintf(DesPt, "(Local symbols)");   break;
    case 1 : fprintf(DesPt, "(Public symbols)");  break;
    case 2 : fprintf(DesPt, "(Segment symbols)"); break;
    case 3 : fprintf(DesPt, "(Line numbers)");    break;
    default: fprintf(DesPt, "(???)");
  } // end switch
  ++i;

  while(i < rlen-1)
   { switch(deftyp)
     { case 0 : //
       case 1 : { fprintf(DesPt, "\n\t[SEG ID]=%2.2X",buf[i]); ++i;
                  fprintf(DesPt, "\t[SYM INFO]=%2.2X",buf[i]); showSYMINFO(buf[i]); ++i;
                  fprintf(DesPt, "\n\t[Offset]=%4.4X",buf16(i)); i+=2;
                  fprintf(DesPt, "\t[unuse byte]=%2.2X",buf[i]); ++i;
                  fprintf(DesPt, "\t[Symbol Name]"); i += 1 + showStr(buf+i);
                  break;
                } // end case
       case 2 : { fprintf(DesPt, "\n\t[SEG ID]=%2.2X",buf[i]); ++i;
                  fprintf(DesPt, "\t[SEG INFO]=%2.2X",buf[i]); showSEGINFO(buf[i]); ++i;
                  fprintf(DesPt, "\n\t[Offset]=%4.4X",buf16(i)); i+=2;
                  fprintf(DesPt, "\t[unuse byte]=%2.2X",buf[i]); ++i;
                  fprintf(DesPt, "\t[Symbol Name]"); i += 1 + showStr(buf+i);
                  break;
                } // end case
       case 3 : { fprintf(DesPt, "\n\t[SEG ID]=%2.2X",buf[i]); ++i;
                  fprintf(DesPt, "\t[Offset]=%4.4X",buf16(i)); i+=2;
                  fprintf(DesPt, "\t[Line Number]=%4.4X",buf16(i)); i+=2;
                  break;
                } // end case
       default: fprintf(DesPt, "[??????]");
     } // end switch
   } // end while
} // end show12
//---------------------------------------------------------------------------







//---------------------------------------------------------------------------
void OBJ_Viewer::show17(int8u buf[], int16u rlen)
{ fprintf(DesPt, "\n[Public Definitions Record 17H]");
  int16u i = 0;

  while(i < rlen-1)
  { fprintf(DesPt, "\n  [SEG ID]=%4.4X",buf16(i)); i+=2;
    fprintf(DesPt, " [SYM INFO]=%2.2X",buf[i]); ++i;
    fprintf(DesPt, " [Offset]=%4.4X",buf16(i)); i+=2;
    fprintf(DesPt, " [unused]=%2.2X",buf[i]); ++i;
    fprintf(DesPt, " [Public Name]"); i += showStr(buf+i);
  } // end while
} // end show17
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
void OBJ_Viewer::show19(int8u buf[], int16u rlen)
{ fprintf(DesPt, "\n[External Definitions Record 19H]");
  int16u i = 0;

  while(i < rlen-1)
  { fprintf(DesPt, "\n  [ID BLK]=%2.2X",buf[i]); ++i;
    fprintf(DesPt, " [EXT ID]=%4.4X",buf16(i)); i+=2;
    fprintf(DesPt, " [SYM INFO]=%2.2X",buf[i]); ++i;

    fprintf(DesPt, " [unused]=%2.2X",buf[i]); ++i;
    fprintf(DesPt, " [Ext Name]"); i += showStr(buf+i);
  } // end while
} // end show19
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
void OBJ_Viewer::show23(int8u buf[], int16u rlen)
{ fprintf(DesPt, "\n[DEBUG Record 23H]");
  int16u i = 0;

  int8u typ = buf[i];
  fprintf(DesPt, "\n [Defined Type]=%2.2X ",typ);
  switch(typ)
  { case 0 : fprintf(DesPt, "(Local symbols)");   break;
    case 1 : fprintf(DesPt, "(Public symbols)");  break;
    case 2 : fprintf(DesPt, "(Segment symbols)"); break;
    case 3 : fprintf(DesPt, "(Line numbers)");    break;
    default: fprintf(DesPt, "(??????)");
  } // end switch
  ++i;

  while(i < rlen-1)
  { switch(typ)
    { case 0 :
      case 1 :
      case 2 : { fprintf(DesPt, "\n  [SEG ID]=%4.4X",buf16(i));
                 i+=2;

                 fprintf(DesPt, " [TYPE]=");
                 switch(buf[i])
                 { case 0 : fprintf(DesPt, "CODE "); break;
                   case 1 : fprintf(DesPt, "XDATA"); break;
                   case 2 : fprintf(DesPt, "DATA "); break;
                   case 3 : fprintf(DesPt, "IDATA"); break;
                   case 4 : fprintf(DesPt, "BIT  "); break;
                   case 5 : fprintf(DesPt, "NUM  "); break;
                   default: fprintf(DesPt, " ??? ");
                 } // end switch
                 ++i;

                 fprintf(DesPt, " [Offset]=%4.4X",buf16(i)); i+=2;

                 fprintf(DesPt, " [unused]=%2.2X",buf[i]); ++i;

                 fprintf(DesPt, " [Symbol Name]"); i += showStr(buf+i);
                 break;
               } // end case
      case 3 : { fprintf(DesPt, "\n\t[SEG ID]=%4.4X",buf16(i)); i+=2;

                 fprintf(DesPt, "\t[Offset]=%4.4X",buf16(i)); i+=2;

                 fprintf(DesPt, "\t[Line Number]=%4.4X",buf16(i)); i+=2;
                 break;
               } // end case
      default: fprintf(DesPt, " [??????]");
    } // end switch
  } // end while
} // end show23
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
void OBJ_Viewer::show24(int8u buf[])
{ fprintf(DesPt, "\n[SOURCE NAME Record 24H]");
  int16u i = 0;

  fprintf(DesPt, "\n   [unused byte]=%2.2X %2.2X %2.2X",buf[i],buf[i+1],buf[i+2]);
  i+=3;

  fprintf(DesPt, "\t\t[File Name]"); showStr(buf+i);
} // end show24
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
void OBJ_Viewer::show70(int8u buf[])
{ int16u i;

  fprintf(DesPt, "\n[Module 70H?] %2.2X", buf[0]);
  i = 1;

  fprintf(DesPt, "  [Command Line]"); i += showStr(buf + 1);

  fprintf(DesPt, "\n   [?] %4.4X",buf16(i)); i += 2;

  fprintf(DesPt, "\t[Modify time] ");
  char* tt = ctime((time_t*)(buf+i));
  tt[ strlen(tt)-1 ]='\0';
  fprintf(DesPt, tt);
  i += 4;

  fprintf(DesPt, "  "); i += showStr( buf + i );

  fprintf(DesPt, "\n   [?] %4.4X",buf16(i)); i += 2;

  fprintf(DesPt, "\t[Modify time] ");
  tt = ctime((time_t*)(buf+i));
  tt[ strlen(tt)-1 ]='\0';
  fprintf(DesPt, tt);
  i += 4;

  fprintf(DesPt, "  "); showStr( buf + i );
} // end show70
//---------------------------------------------------------------------------


/*
//---------------------------------------------------------------------------
void OBJ_Viewer::show0E(int8u buf[], int16u rlen)
{ fprintf(DesPt, "\n   [Segment Definitions Record]");
  int16u i = 0;
  while(i < rlen-1)
   { fprintf(DesPt, "\n   [SEG ID]=%2.2X",buf[i]);
     if(!buf[i]) { fprintf(DesPt, " (Absolute segment)"); } // endif
     else { fprintf(DesPt, " (Relocatable segment #%d)",buf[i]-1); }
     ++i;

     fprintf(DesPt, "\n   [SEG INFO]=%2.2X",buf[i]);
     ++i;

     fprintf(DesPt, "\n   [REL TYP]=%2.2X",buf[i]);
     ++i;

     fprintf(DesPt, "\n   [unused byte]=%2.2X",buf[i]);
     ++i;

     fprintf(DesPt, "\n   [Segment Base]=%4.4X", buf16(i));
     i+=2;

     fprintf(DesPt, "\n   [Segment Size]=%4.4X", buf16(i));
     i+=2;

     fprintf(DesPt, "\n   [Segment Name]=");
     i += 1 + showStr(buf+i);
   } // end while
} // end show0E
//---------------------------------------------------------------------------
*/

/*
//---------------------------------------------------------------------------
void PRfile(FILE *DesPt)
{ static int8u c = 0;
  int8u ch;
  ch = fgetc(SrcPt);
  fprintf(DesPt, "%2.2X ",ch);
  ++c;
  if( !(c % 4) ) { fprintf(DesPt, " "); } // endif
  if( !(c % 8) ) { fprintf(DesPt, "  "); } // endif
  if( !(c %16) ) { fprintf(DesPt, "\n"); } // endif
} // end PRfile
//---------------------------------------------------------------------------
*/



//---------------------------------------------------------------------------
// end OBJ_Viewer_C.cpp
//---------------------------------------------------------------------------
//               Written by JamesyFront.    ZLGmcu Dev.Co.Ltd.  2002.
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -