home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume4 / 68kdisassem / part1 / unc.h < prev   
Encoding:
C/C++ Source or Header  |  1986-11-30  |  4.4 KB  |  163 lines

  1. /*
  2.  *    SCCS:    @(#)unc.h    1.2    11/2/84    14:21:02
  3.  *    Header file for uncompile program.
  4.  *
  5.  ***********************************************************************
  6.  *    This software is copyright of
  7.  *
  8.  *        John M Collins
  9.  *        47 Cedarwood Drive
  10.  *        St Albans
  11.  *        Herts, AL4 0DN
  12.  *        England            +44 727 57267
  13.  *
  14.  *    and is released into the public domain on the following conditions:
  15.  *
  16.  *        1.  No free maintenance will be guaranteed.
  17.  *        2.  Nothing may be based on this software without
  18.  *            acknowledgement, including incorporation of this
  19.  *            notice.
  20.  *
  21.  *    Notwithstanding the above, the author welcomes correspondence and bug
  22.  *    fixes.
  23.  ***********************************************************************
  24.  */
  25.  
  26. #define    MAXCHARS    50
  27. #define    HASHMOD        97
  28.  
  29. /*
  30.  *    The following structure is used to keep track of symbols.
  31.  */
  32.  
  33. struct    symstr    {
  34.     struct    symstr    *s_next;        /*  Next in hash chain  */
  35.     struct    symstr    *s_link;        /*  Next in duplicate labels */
  36.     unsigned    s_type    :  3;        /*  Symbol type  */
  37.     unsigned    s_newsym:  1;        /*  A new symbol  */
  38.     unsigned    s_invent:  1;        /*  Invented symbol  */
  39.     unsigned    s_glob    :  1;        /*  Global symbol  */
  40.     long        s_value;        /*  Value if defined  */
  41.     short        s_defs;            /*  Defined count  */
  42.     short        s_used;            /*  Used count  */
  43.     unsigned short    s_lsymb;        /*  Local symbol  */
  44.     char        s_name[1];        /*  Chars of name null term */
  45. };
  46.  
  47. typedef    struct    symstr    *symbol;
  48.  
  49. symbol    symbhash[HASHMOD];
  50.  
  51. typedef    struct    {
  52.     int    ef_t;            /*  Text file fd  */
  53.     int    ef_d;            /*  Data file fd  */
  54.     long    ef_entry;        /*  Entry point  */
  55.     long    ef_tsize;        /*  Text size  */
  56.     long    ef_dsize;        /*  Data size  */
  57.     long    ef_bsize;        /*  Bss size  */
  58.     long    ef_end;            /*  End of it all  */
  59.     long    ef_tbase;        /*  Text base  */
  60.     long    ef_dbase;        /*  Data base  */
  61.     long    ef_bbase;        /*  Bss base  */
  62.     int    ef_stcnt;        /*  Number of symbols  */
  63.     int    ef_stmax;        /*  Max number of symbols  */
  64.     symbol    *ef_stvec;        /*  Symbol vector  */
  65. }  ef_fids;
  66.  
  67. typedef    ef_fids    *ef_fid;
  68.  
  69. /*
  70.  *    Description of word in text file.  This entry is held in the place
  71.  *    corresponding to the address in the text file.
  72.  */
  73.  
  74. typedef    struct    {
  75.     unsigned  short    t_contents;        /*  Actual contents  */
  76.     unsigned  short t_iindex;        /*  Index in table  */
  77.     unsigned    t_type    :  2;        /*  Type  */
  78.     unsigned    t_vins  :  1;        /*  Valid instruction  */
  79.     unsigned    t_bdest    :  1;        /*  Is branch dest  */
  80.     unsigned    t_gbdest:  1;        /*  Is global dest  */
  81.     unsigned    t_dref    :  1;        /*  Refered to in data  */
  82.     unsigned    t_bchtyp:  2;        /*  Branch type  */
  83.     unsigned    t_lng    :  3;        /*  Length in words  */
  84.     unsigned    t_reloc :  2;        /*  Relocatable  */
  85.     unsigned    t_rptr    :  2;        /*  Where relocated  */
  86.     unsigned    t_rdisp :  1;        /*  Relocatable displacement */
  87.     unsigned    t_isrel :  1;        /*  Relocated  */
  88.     unsigned    t_amap    :  1;        /*  Worked out  */
  89.     symbol        t_relsymb;        /*  Relocation symbol  */
  90.     long        t_reldisp;        /*  Offset + or - from symb */
  91.     symbol        t_lab;            /*  Label  */
  92.     unsigned  short    t_lsymb;        /*  Local symbol  */
  93.     long        t_reflo;        /*  Lowest place referred  */
  94.     long        t_refhi;        /*  Highest place referred  */
  95.     unsigned  short    t_match;        /*  Lib match lng  */
  96. }  t_entry;
  97.  
  98. /*
  99.  *    Types ......
  100.  */
  101.  
  102. #define    T_UNKNOWN    0
  103. #define    T_BEGIN        1
  104. #define    T_CONT        2
  105.  
  106. #define    R_NONE        0        /*  No relocation  */
  107. #define    R_BYTE        1        /*  Byte relocation  */
  108. #define    R_WORD        2        /*  Word relocation  */
  109. #define    R_LONG        3        /*  Long relocation  */
  110.  
  111. /*
  112.  *    Branch types.
  113.  */
  114.  
  115. #define    T_NOBR        0
  116. #define    T_CONDBR    1
  117. #define    T_UNBR        2
  118. #define    T_JSR        3
  119.  
  120. typedef    struct    {
  121.     unsigned  char    d_contents;        /*  Actual contents  */
  122.     unsigned    d_type  :  4;        /*  Data type  */
  123.     unsigned    d_reloc :  2;        /*  Relocatable  */
  124.     unsigned    d_rptr    :  2;        /*  Where relocated  */
  125.     short        d_lng;            /*  Length -ve for D_CONT */
  126.     symbol        d_relsymb;        /*  Relocation symbol  */
  127.     long        d_reldisp;        /*  Offset + or - from symb */
  128.     symbol        d_lab;            /*  Label  */
  129. }  d_entry;
  130.  
  131. /*
  132.  *    Data types.
  133.  */
  134.  
  135. #define    D_ASC        0        /*  Ascii chars  */
  136. #define    D_ASCZ        1        /*  Null-term ascii  */
  137. #define    D_BYTE        2        /*  Decimal bytes  */
  138. #define    D_WORD        3        /*  Words  */
  139. #define    D_LONG        4        /*  Longs  */
  140. #define    D_ADDR        5        /*  Address pointer  */
  141. #define    D_CONT        6        /*  Continuation of last  */
  142.  
  143. /*
  144.  *    'Common' items.
  145.  */
  146.  
  147. struct    commit    {
  148.     symbol    *c_symb;        /*  List of symbols  */
  149.     int    c_int;            /*  Current number  */
  150.     int    c_max;            /*  Maximum  */
  151. };
  152.  
  153. /*
  154.  *    Library file description.
  155.  */
  156.  
  157. struct    libit    {
  158.     int    lf_fd;            /*  File descriptor  */
  159.     long    lf_offset;        /*  Offset of current file  */
  160.     long    lf_next;        /*  Offset of next file  */
  161.     char    lf_name[14];        /*  Name of item  */
  162. };
  163.