Annotation of coherent/d/bin/as/asm.h, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #include <setjmp.h>
        !             3: #include "asmch.h"
        !             4: #ifdef LADDR
        !             5: #include "n.out.h"
        !             6: #else
        !             7: #include <l.out.h>
        !             8: #endif
        !             9: 
        !            10: /* Basic */
        !            11: #define        HUGE    1000            /* A huge number */
        !            12: #define NERR   10              /* Errors per line */
        !            13: #define NINPUT 128             /* Input buffer size */
        !            14: #define NCODE  128             /* Listing code buffer size */
        !            15: #define NTIT   64              /* Title buffer size */
        !            16: #define        NHASH   64              /* Buckets in hash table */
        !            17: #define        HMASK   077             /* Hash mask */
        !            18: #define        NLPP    60              /* Lines per page */
        !            19: 
        !            20: /* Listing */
        !            21: #define NLIST  0               /* No listing */
        !            22: #define SLIST  1               /* Source only */
        !            23: #define ALIST  2               /* Address only */
        !            24: #define        BLIST   3               /* Bytes */
        !            25: #define        WLIST   4               /* Words */
        !            26: 
        !            27: #define        dot     (&sym[0])       /* Dot, current loc */
        !            28: 
        !            29: /*
        !            30:  * Symbol.
        !            31:  * The names `s_ref' and `s_base'
        !            32:  * don't get init. in `pst.c'.
        !            33:  * Good thing: you cannot initialise
        !            34:  * a union.
        !            35:  */
        !            36: struct sym
        !            37: {
        !            38:        struct  sym     *s_sp;          /* Hash link */
        !            39:        char            s_id[NCPLN];    /* Name */
        !            40:        unsigned char   s_kind;         /* Symbol kind (S_) */
        !            41:        unsigned char   s_flag;         /* Symbol flags */
        !            42:        int             s_type;         /* Expression type */
        !            43:        address         s_addr;         /* Address */
        !            44:        int             s_ref;          /* Ref. number */
        !            45:        int             s_total;        /* Hash total */
        !            46:        union   {
        !            47:                struct sym *s_sp;
        !            48:                struct loc *s_lp;
        !            49:                int s_segn;
        !            50:        } s_base;               /* Base */
        !            51: };
        !            52: 
        !            53: /* Flags */
        !            54: #define        S_GBL   01              /* Global */
        !            55: #define        S_ASG   02              /* Assigned */
        !            56: #define        S_MDF   04              /* Mult. def */
        !            57: #define        S_END   010             /* End mark */
        !            58: #define        S_SYMT  020             /* For l.out symbol table */
        !            59: 
        !            60: /* Kinds */
        !            61: #define        S_NEW   0               /* New name */
        !            62: #define        S_USER  1               /* User name */
        !            63: #define        S_LOC   2               /* Loc. counter */
        !            64: #define        S_SEG   3               /* Seg. name */
        !            65: #define        S_BYTE  4               /* .byte */
        !            66: #define        S_WORD  5               /* .word */
        !            67: #define        S_SDEF  6               /* .segdef */
        !            68: #define        S_ASCII 7               /* .ascii */
        !            69: #define        S_COMM  8               /* .comm */
        !            70: #define        S_LDEF  9               /* .locdef */
        !            71: #define        S_GLOBL 10              /* .globl */
        !            72: #define        S_PAGE  11              /* .page */
        !            73: #define        S_TITLE 12              /* .title */
        !            74: #define        S_BLK   13              /* .blk[bwl] */
        !            75: 
        !            76: /*
        !            77:  * Location counter.
        !            78:  */
        !            79: struct loc
        !            80: {
        !            81:        struct  loc *l_lp;      /* Link */
        !            82:        int     l_seg;          /* Seg. no. */
        !            83:        address l_break;        /* Size */
        !            84:        address l_offset;       /* Offset in area */
        !            85:        address l_fuzz;         /* Fuzz */
        !            86: };
        !            87: 
        !            88: /*
        !            89:  * Temp. symbols.
        !            90:  */
        !            91: struct tsym
        !            92: {
        !            93:        struct  tsym *t_fp;     /* Link to next */
        !            94:        struct  loc *t_lp;      /* Location counter */
        !            95:        address t_addr;         /* Address */
        !            96: };
        !            97: 
        !            98: struct tsymp
        !            99: {
        !           100:        struct  tsym *tp_fp;    /* Symbol for `n'f */
        !           101:        struct  tsym *tp_bp;    /* Symbol for `n'b */
        !           102:        struct  tsym *tp_lfp;   /* First symbol */
        !           103:        struct  tsym *tp_llp;   /* Last symbol */
        !           104: };
        !           105: 
        !           106: /*
        !           107:  * Globals.
        !           108:  */
        !           109: extern address absexpr();
        !           110: extern struct sym *lookup();
        !           111: extern int     inbss;
        !           112: extern  jmp_buf env;
        !           113: extern char    *new();
        !           114: extern struct  sym sym[];
        !           115: extern int     line;
        !           116: extern int     page;
        !           117: extern int     lop;
        !           118: extern int     pass;
        !           119: extern int     lflag;
        !           120: extern int     gflag;
        !           121: extern int     eflag;
        !           122: extern int     xflag;
        !           123: extern address laddr;
        !           124: extern address fuzz;
        !           125: extern int     lmode;
        !           126: extern struct  sym *symhash[NHASH];
        !           127: extern int     nloc;
        !           128: extern int     nerr;
        !           129: extern  struct  loc *loc[];
        !           130: extern  struct  loc *defloc;
        !           131: extern char    *ep;
        !           132: extern char    eb[NERR];
        !           133: extern char    *ip;
        !           134: extern char    ib[NINPUT];
        !           135: extern char    *cp;
        !           136: extern char    cb[NCODE];
        !           137: extern char    tb[NTIT];
        !           138: extern struct  tsymp tsymp[10];
        !           139: extern char    *ofn;
        !           140: extern char    *ifn;
        !           141: extern FILE    *ofp;
        !           142: extern FILE    *sfp;
        !           143: extern FILE    *efp;
        !           144: extern char    ctype[];
        !           145: 
        !           146: /*
        !           147:  * Character types.
        !           148:  * Letters are < 0.
        !           149:  * Letters and digits are <= 0.
        !           150:  * This speeds up getid.
        !           151:  */
        !           152: #define        LETTER  (-1)
        !           153: #define        DIGIT   0
        !           154: #define        BINOP   1
        !           155: #define ETC    2
        !           156: #define        ILL     3
        !           157: #define        SPACE   4
        !           158: 
        !           159: /*
        !           160:  * Expression.
        !           161:  */
        !           162: struct expr
        !           163: {
        !           164:        char    e_mode;         /* Address mode */
        !           165:        char    e_type;         /* Type */
        !           166:        address e_addr;         /* Address */
        !           167:        union   {
        !           168:                struct loc  *e_lp;
        !           169:                struct sym  *e_sp;
        !           170:                int e_segn;
        !           171:        } e_base;               /* Rel. base */
        !           172: };
        !           173: 
        !           174: /* Types */
        !           175: #define        E_ACON  0               /* A constant */
        !           176: #define        E_ASEG  1               /* An absolute segment */
        !           177: #define        E_SYM   2               /* Symbol base */
        !           178: #define        E_DIR   3               /* Direct address */
        !           179: #define        E_AREG  4               /* Reg */
        !           180: #define        E_SEG   5               /* Relocatable segment */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.